X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2Fmain.cpp;h=33a7b37edb679baba5a81e7ea318d0ef3a11e27c;hb=211943fca2a77110d07c4eab259ed0208462766e;hp=09f6960be03b6dfd8ca9b4100984c542001d433a;hpb=ff29f47f799d99cec7c2a6aa2cf818da2b931fc5;p=lugaru.git diff --git a/Source/main.cpp b/Source/main.cpp index 09f6960..33a7b37 100644 --- a/Source/main.cpp +++ b/Source/main.cpp @@ -42,7 +42,6 @@ using namespace Game; #endif extern float multiplier; -extern float sps; extern float realmultiplier; extern int slomo; extern bool cellophane; @@ -243,9 +242,6 @@ bool SetUp () fprintf(stderr, "Failed to load config, creating default\n"); SaveSettings(); } - if (kBitsPerPixel != 32 && kBitsPerPixel != 16) { - kBitsPerPixel = 16; - } if (SDL_GL_LoadLibrary(NULL) == -1) { fprintf(stderr, "SDL_GL_LoadLibrary() failed: %s\n", SDL_GetError()); @@ -521,6 +517,8 @@ void CleanUp (void) { LOGFUNC; + delete[] commandLineOptionsBuffer; + SDL_Quit(); #ifndef __MINGW32__ // FIXME: Temporary workaround for GL-8 #define GL_FUNC(ret,fn,params,call,rt) p##fn = NULL; @@ -530,7 +528,6 @@ void CleanUp (void) // the context is destroyed and libGL unloaded by SDL_Quit(). pglDeleteTextures = glDeleteTextures_doNothing; #endif // __MINGW32__ - } // -------------------------------------------------------------------------- @@ -655,6 +652,7 @@ const option::Descriptor usage[] = }; option::Option commandLineOptions[commandLineOptionsNumber]; +option::Option* commandLineOptionsBuffer; int main(int argc, char **argv) { @@ -664,21 +662,24 @@ int main(int argc, char **argv) std::cerr << "Found incorrect command line option number" << std::endl; return 1; } - option::Option buffer[stats.buffer_max]; - option::Parser parse(true, usage, argc, argv, commandLineOptions, buffer); + commandLineOptionsBuffer = new option::Option[stats.buffer_max]; + option::Parser parse(true, usage, argc, argv, commandLineOptions, commandLineOptionsBuffer); if (parse.error()) { + delete[] commandLineOptionsBuffer; return 1; } if (commandLineOptions[HELP]) { option::printUsage(std::cout, usage); + delete[] commandLineOptionsBuffer; return 0; } if (option::Option* opt = commandLineOptions[UNKNOWN]) { std::cerr << "Unknown option: " << opt->name << "\n"; option::printUsage(std::cerr, usage); + delete[] commandLineOptionsBuffer; return 1; } @@ -693,8 +694,10 @@ int main(int argc, char **argv) { newGame(); - if (!SetUp ()) + if (!SetUp ()) { + delete[] commandLineOptionsBuffer; return 42; + } bool gameDone = false; bool gameFocused = true;