Fri, 18 Oct 2013 21:52:09 +0300
Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | * Copyright (C) 2013 Santeri Piippo |
359
bcdfc801658b
more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
4 | * |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
359
bcdfc801658b
more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
9 | * |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
359
bcdfc801658b
more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
14 | * |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
471 | 17 | * ===================================================================== |
18 | * | |
19 | * config.cpp: Configuration management. I don't like how unsafe QSettings | |
20 | * is so this implements a type-safer and idenitifer-safer wrapping system of | |
21 | * configuration variables. QSettings is used underlyingly, this is a matter | |
22 | * of interface. | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | */ |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | #include <errno.h> |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | #include <QDir> |
359
bcdfc801658b
more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
27 | #include <QTextStream> |
436
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
28 | #include <QSettings> |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | #include "common.h" |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | #include "config.h" |
198
f246725199dc
Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
31 | #include "misc.h" |
238
3b35f502a6c7
Use a more Windows-like config dir name under Windows; warn when unable to read it
Santeri Piippo <crimsondusk64@gmail.com>
parents:
199
diff
changeset
|
32 | #include "gui.h" |
436
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
33 | #include "file.h" |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | |
461
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
455
diff
changeset
|
35 | Config* g_configPointers[MAX_CONFIG]; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
36 | static int g_cfgPointerCursor = 0; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
38 | // ============================================================================= |
471 | 39 | // Get the QSettings object. A portable build refers to a file in the current |
40 | // directory, a non-portable build to ~/.config/LDForge or to registry. | |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
436
diff
changeset
|
41 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
42 | static QSettings* getSettingsObject() |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
43 | { |
436
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
44 | #ifdef PORTABLE |
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
45 | # ifdef _WIN32 |
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
46 | # define EXTENSION ".ini" |
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
47 | # else |
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
48 | # define EXTENSION ".cfg" |
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
49 | # endif // _WIN32 |
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
50 | return new QSettings (str (APPNAME).toLower() + EXTENSION, QSettings::IniFormat); |
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
51 | #else |
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
52 | return new QSettings; |
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
53 | #endif // PORTABLE |
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
54 | } |
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
55 | |
463
22bdcca9f78d
ensure that all Configs are polymorphic
Santeri Piippo <crimsondusk64@gmail.com>
parents:
462
diff
changeset
|
56 | Config::Config (const char* name, const char* defstring) : |
465
0f67ff766458
removed broken config type check
Santeri Piippo <crimsondusk64@gmail.com>
parents:
464
diff
changeset
|
57 | name (name), m_defstring (defstring) {} |
463
22bdcca9f78d
ensure that all Configs are polymorphic
Santeri Piippo <crimsondusk64@gmail.com>
parents:
462
diff
changeset
|
58 | |
436
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
59 | // ============================================================================= |
471 | 60 | // Load the configuration from file |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
436
diff
changeset
|
61 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
62 | bool Config::load() |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
63 | { QSettings* settings = getSettingsObject(); |
513
29eb671b34f6
Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents:
493
diff
changeset
|
64 | log ("config::load: Loading configuration file from %1\n", settings->fileName()); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
65 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
66 | for (Config* cfg : g_configPointers) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
67 | { if (!cfg) |
239
ea09eeba1c2b
Use a C-array for config too for the same reasons as with actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
238
diff
changeset
|
68 | break; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
69 | |
468
7b3159f1a9e2
woo smallification!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
467
diff
changeset
|
70 | QVariant val = settings->value (cfg->name, cfg->defaultVariant()); |
7b3159f1a9e2
woo smallification!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
467
diff
changeset
|
71 | cfg->loadFromVariant (val); |
436
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
72 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
73 | |
436
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
74 | settings->deleteLater(); |
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
75 | return true; |
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
76 | } |
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
77 | |
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
78 | // ============================================================================= |
471 | 79 | // Save the configuration to disk |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
436
diff
changeset
|
80 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
81 | bool Config::save() |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
82 | { QSettings* settings = getSettingsObject(); |
513
29eb671b34f6
Added a crash catcher which trigger under Linux. It calls GDB and tries to get a backtrace. Also integrated assertion failure handling to this new system. Removed the print() function in the process (because the new bomb box uses a text edit and QTextDocuments's print method clashes with the macro and I figured it was a good idea to rid it anyway) and replaced all calls with log().
Santeri Piippo <crimsondusk64@gmail.com>
parents:
493
diff
changeset
|
83 | log ("Saving configuration to %1...\n", settings->fileName()); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
84 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
85 | for (Config* cfg : g_configPointers) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
86 | { if (!cfg) |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
87 | break; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
88 | |
469
f2faed654633
more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
468
diff
changeset
|
89 | if (cfg->isDefault()) |
f2faed654633
more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
468
diff
changeset
|
90 | continue; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
91 | |
467
59549731151a
Added ListConfig type, using it in recent files now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
465
diff
changeset
|
92 | settings->setValue (cfg->name, cfg->toVariant()); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
93 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
94 | |
436
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
95 | settings->sync(); |
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
96 | settings->deleteLater(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
97 | return true; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
98 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
99 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
100 | // ============================================================================= |
471 | 101 | // Reset configuration defaults. |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
436
diff
changeset
|
102 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
103 | void Config::reset() |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
104 | { for (Config * cfg : g_configPointers) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
105 | { if (!cfg) |
239
ea09eeba1c2b
Use a C-array for config too for the same reasons as with actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
238
diff
changeset
|
106 | break; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
107 | |
359
bcdfc801658b
more restyle/refactor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
108 | cfg->resetValue(); |
239
ea09eeba1c2b
Use a C-array for config too for the same reasons as with actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
238
diff
changeset
|
109 | } |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
110 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
111 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
112 | // ============================================================================= |
471 | 113 | // Where is the configuration file located at? Note that the Windows build uses |
114 | // the registry so only use this with PORTABLE code. | |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
436
diff
changeset
|
115 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
116 | str Config::filepath (str file) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
117 | { return Config::dirpath() + DIRSLASH + file; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
118 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
119 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
120 | // ============================================================================= |
471 | 121 | // Directory of the configuration file. PORTABLE code here as well. |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
436
diff
changeset
|
122 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
123 | str Config::dirpath() |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
124 | { QSettings* cfg = getSettingsObject(); |
436
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
125 | return dirname (cfg->fileName()); |
239
ea09eeba1c2b
Use a C-array for config too for the same reasons as with actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
238
diff
changeset
|
126 | } |
ea09eeba1c2b
Use a C-array for config too for the same reasons as with actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
238
diff
changeset
|
127 | |
436
4268a5507725
Converted configuration code to use QSettings.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
430
diff
changeset
|
128 | // ============================================================================= |
468
7b3159f1a9e2
woo smallification!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
467
diff
changeset
|
129 | // We cannot just add config objects to a list or vector because that would rely |
7b3159f1a9e2
woo smallification!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
467
diff
changeset
|
130 | // on the vector's c-tor being called before the configs' c-tors. With global |
7b3159f1a9e2
woo smallification!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
467
diff
changeset
|
131 | // variables we cannot assume that!! Therefore we need to use a C-style array here. |
455
c5d14d112034
Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
436
diff
changeset
|
132 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
133 | void Config::addToArray (Config* ptr) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
134 | { if (g_cfgPointerCursor == 0) |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
359
diff
changeset
|
135 | memset (g_configPointers, 0, sizeof g_configPointers); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
136 | |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
359
diff
changeset
|
137 | assert (g_cfgPointerCursor < MAX_CONFIG); |
239
ea09eeba1c2b
Use a C-array for config too for the same reasons as with actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
238
diff
changeset
|
138 | g_configPointers[g_cfgPointerCursor++] = ptr; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
471
diff
changeset
|
139 | } |