1 /*
2  * CRRCsim - the Charles River Radio Control Club Flight Simulator Project
3  *
4  * Copyright (C) 2000, 2001, 2004 Jan Edward Kansky (original author)
5  * Copyright (C) 2004, 2005, 2006, 2008 Jan Reucker
6  * Copyright (C) 2004, 2005, 2006, 2008 Jens Wilhelm Wulf
7  * Copyright (C) 2004 Kees Lemmens
8  * Copyright (C) 2004 Lionel Cailler
9  * Copyright (C) 2005 Joel Lienard
10  * Copyright (C) 2005 Olivier Bordes
11  * Copyright (C) 2006 Todd Templeton
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License version 2
15  * as published by the Free Software Foundation.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330,
25  * Boston, MA 02111-1307, USA.
26  *
27  */
28 
29 
30 #ifndef CRRC_MAIN_H
31 #define CRRC_MAIN_H
32 
33 #include <stdlib.h>
34 #include <stdio.h>
35 #include <string>
36 #include <string.h>
37 
38 #ifdef WIN32
39 #  include <windows.h>
40 // DISABLED FOR DEV-CPP #  include "dlportio.h"
41 # endif
42 
43 #if defined(__APPLE__) || defined(MACOSX)
44  #include <unistd.h>
45  #include <sys/types.h>
46  #include <sys/mman.h>
47  #include <sys/stat.h>
48  #include <sys/param.h> // for MAXPATHLEN
49  #include <time.h>
50  #include <sys/time.h>
51 #endif  // __APPLE__
52 #ifdef linux
53  #include <sys/types.h>
54  #include <sys/mman.h>
55  #include <sys/stat.h>
56  #include <time.h>
57  #include <sys/time.h>
58 #endif
59 
60 #include <fcntl.h>
61 #include <math.h>
62 
63 #include "config.h"
64 #include "defines.h"
65 #include "crrc_soundserver.h"
66 #include "crrc_sound.h"
67 #include "mouse_kbd.h"
68 #include "CTime.h"
69 #include <crrc_config.h>
70 #include "mod_misc/SimpleXMLTransfer.h"
71 #include "mod_inputdev/inputdev.h"
72 #include "mod_fdm/fdm.h"
73 
74 
75 
76 
77 /*****************************************************************************/
78 // Functions define inside crrc_main.c and used in- or outside crrc_main.c :
79 
80 void initialize_flight_model();
81 void set_aux(int aux_num, int setting);
82 void activate_test_mode();
83 void leave_test_mode();
84 std::string reconfigureInputMethod(bool boRevertToMouse = true);
85 
86 /**
87  * todo: maybe this should be moved to somewhere else...
88  */
89 void Init_mod_windfield();
90 
91 /**
92  * Tries to load the airplane specified in the config file.
93  * Throws an exception on error.
94  */
95 void loadAirplane();
96 
97 void write_globals_into_config();
98 
99 /// Exit from CRRCsim as clean as possible
100 void crrc_exit(int exit_code, const char *errmsg = NULL);
101 
102 
103 /*****************************************************************************/
104 //Variables used outside crrc_main.c :
105 
106 // Configuration :
107 extern T_Config*  cfg;
108 
109 extern CRRCMath::Vector3 player_pos;
110 
111 extern char scenery_filename[256];
112 
113 // Interface to TX
114 extern T_TX_Interface* TXInterface;
115 
116 extern CTime *crrc_time;
117 
118 // Variometer sound
119 extern T_VariometerSound *vario_sound;
120 extern int vario_sound_channel;
121 
122 #endif  // CRRC_MAIN_H
123