Просмотр исходного кода

Added main.h, removed rc_ methods.

Thomas Buck 10 лет назад
Родитель
Сommit
3fe7ac2ece

+ 2
- 1
include/Sound.h Просмотреть файл

@@ -2,8 +2,8 @@
2 2
  * \file include/Sound.h
3 3
  * \brief This is the audio manager Header
4 4
  *
5
- * \author xythobuz
6 5
  * \author Mongoose
6
+ * \author xythobuz
7 7
  */
8 8
 
9 9
 #ifndef _SOUND_H_
@@ -109,3 +109,4 @@ private:
109 109
 };
110 110
 
111 111
 #endif
112
+

+ 24
- 0
include/main.h Просмотреть файл

@@ -0,0 +1,24 @@
1
+/*!
2
+ * \file include/main.h
3
+ * \brief Where main() is
4
+ *
5
+ * \author xythobuz
6
+ */
7
+#ifndef _MAIN_H_
8
+#define _MAIN_H_
9
+
10
+/*!
11
+ * \brief atexit() handler
12
+ */
13
+void cleanupHandler(void);
14
+
15
+/*!
16
+ * \brief Program entry point
17
+ * \param argc number of arguments
18
+ * \param argv array with argc strings
19
+ * \returns 0 on success
20
+ */
21
+int main(int argc, char *argv[]);
22
+
23
+#endif
24
+

+ 1
- 0
include/math/Matrix.h Просмотреть файл

@@ -199,3 +199,4 @@ private:
199 199
 };
200 200
 
201 201
 #endif
202
+

+ 1
- 0
include/math/Quaternion.h Просмотреть файл

@@ -199,3 +199,4 @@ private:
199 199
 };
200 200
 
201 201
 #endif
202
+

+ 1
- 0
include/math/Vector3d.h Просмотреть файл

@@ -158,3 +158,4 @@ public:
158 158
 };
159 159
 
160 160
 #endif
161
+

+ 1
- 0
include/math/math.h Просмотреть файл

@@ -69,3 +69,4 @@ void helMidpoint3v(vec3_t a, vec3_t b, vec3_t mid);
69 69
 vec_t helRandomNum(vec_t from, vec_t to);
70 70
 
71 71
 #endif
72
+

+ 1
- 17
include/utils/strings.h Просмотреть файл

@@ -41,21 +41,5 @@ char *bufferString(const char *string, ...) __attribute__((format(printf, 1, 2))
41 41
  */
42 42
 char *fullPath(const char *path, char end);
43 43
 
44
-/*!
45
- * \brief Checks if Command matches Symbol.
46
- * Returns the rest of the argument list back in command buffer, if any
47
- * \param symbol command string
48
- * \param command with arguments
49
- * \returns true if command matches symbol
50
- */
51
-bool rc_command(const char *symbol, char *command);
52
-
53
-/*!
54
- * \brief Interpret a string as a bool
55
- * \param buffer "true" or "false"
56
- * \param val is set to boolean interpretation of buffer
57
- * \returns -1 for null string, -2 if string is not "true" or "false"
58
- */
59
-int rc_get_bool(const char *buffer, bool *val);
60
-
61 44
 #endif
45
+

+ 1
- 0
include/utils/tga.h Просмотреть файл

@@ -87,3 +87,4 @@ int tgaSaveFilename(unsigned char *image,
87 87
     __attribute__((format(printf, 5, 6)));
88 88
 
89 89
 #endif
90
+

+ 1
- 0
include/utils/time.h Просмотреть файл

@@ -30,3 +30,4 @@ unsigned int systemTimerGet();
30 30
 void systemTimerReset();
31 31
 
32 32
 #endif
33
+

+ 2
- 3
src/Sound.cpp Просмотреть файл

@@ -2,8 +2,8 @@
2 2
  * \file src/Sound.cpp
3 3
  * \brief This is the audio manager Implementation
4 4
  *
5
- * \author xythobuz
6 5
  * \author Mongoose
6
+ * \author xythobuz
7 7
  */
8 8
 
9 9
 #ifdef __APPLE__
@@ -122,8 +122,7 @@ void Sound::sourceAt(int source, float pos[3]) {
122 122
 }
123 123
 
124 124
 //! \fixme Seperate sourcing and buffering, Mongoose 2002.01.04
125
-int Sound::addFile(const char *filename, int *source, unsigned int flags)
126
-{
125
+int Sound::addFile(const char *filename, int *source, unsigned int flags) {
127 126
     ALsizei size;
128 127
     ALfloat freq;
129 128
     ALenum format;

+ 2
- 0
src/main.cpp Просмотреть файл

@@ -9,6 +9,7 @@
9 9
 #include <stdio.h>
10 10
 
11 11
 #include "config.h"
12
+#include "main.h"
12 13
 
13 14
 void cleanupHandler() {
14 15
 
@@ -28,3 +29,4 @@ int main(int argc, char *argv[]) {
28 29
 
29 30
     return 0;
30 31
 }
32
+

+ 5
- 40
src/utils/strings.cpp Просмотреть файл

@@ -74,16 +74,20 @@ char *fullPath(const char *path, char end) {
74 74
 
75 75
     if (path[0] == '~') {
76 76
 #if defined(unix) || defined(__APPLE__)
77
+
77 78
 #ifdef __APPLE__
78 79
         // Workaround for Mac OS X. See:
79 80
         // http://stackoverflow.com/questions/20534788/why-does-wordexp-fail-with-wrde-syntax-on-os-x
80 81
         signal(SIGCHLD, SIG_DFL);
81 82
 #endif
83
+
82 84
         // Expand string into segments
83 85
         int res = wordexp(path, &word, 0);
86
+
84 87
 #ifdef __APPLE__
85 88
         signal(SIGCHLD, SIG_IGN);
86 89
 #endif
90
+
87 91
         if (res != 0) {
88 92
             printf("fullPath> wordexp() failed: %d\n", res);
89 93
             return NULL;
@@ -108,7 +112,7 @@ char *fullPath(const char *path, char end) {
108 112
 
109 113
         wordfree(&word);
110 114
 #else
111
-        printf("WARNING: Tilde expansion not supported on this platform!\n");
115
+        printf("WARNING: Tilde expansion not supported on this platform:\n\t%s\n", path);
112 116
         lenPath = strlen(path);
113 117
         dir = new char[lenPath + 2]; // space for end char
114 118
         strncpy(dir, path, lenPath);
@@ -130,42 +134,3 @@ char *fullPath(const char *path, char end) {
130 134
     return dir;
131 135
 }
132 136
 
133
-bool rc_command(const char *symbol, char *command) {
134
-    assert(symbol != NULL);
135
-    assert(symbol[0] != '\0');
136
-    assert(command != NULL);
137
-    assert(command[0] != '\0');
138
-
139
-    int lens = strlen(symbol);
140
-
141
-    if (strncmp(command, symbol, lens) == 0) {
142
-        int lenc = strlen(command);
143
-
144
-        //! \fixme Should ignore whitespace, but only if it is really there...?
145
-        // lens+1 skips '=' or ' '
146
-        for (int i = 0, j = lens+1; j < lenc; ++i, ++j) {
147
-            command[i] = command[j];
148
-            command[i+1] = 0;
149
-        }
150
-
151
-        return true;
152
-    }
153
-
154
-    return false;
155
-}
156
-
157
-int rc_get_bool(const char *buffer, bool *val) {
158
-    assert(buffer != NULL);
159
-    assert(buffer[0] != '\0');
160
-    assert(val != NULL);
161
-
162
-    if ((buffer[0] == '1') || (strncmp(buffer, "true", 4) == 0))
163
-        *val = true;
164
-    else if ((buffer[0] == '0') || (strncmp(buffer, "false", 5) == 0))
165
-        *val = false;
166
-    else
167
-        return -2;
168
-
169
-    return 0;
170
-}
171
-

Загрузка…
Отмена
Сохранить