00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <scorched/ScorchedParams.h>
00022 #include <engine/ModDirs.h>
00023 #include <common/OptionsGame.h>
00024 #include <common/ARGParser.h>
00025 #include <common/Defines.h>
00026 #include <graph/OptionsDisplay.h>
00027 #include <wx/wx.h>
00028 #include <wx/utils.h>
00029 #include <locale.h>
00030 #include <math.h>
00031 #include <signal.h>
00032 #include <float.h>
00033 #include <time.h>
00034 #include <common/main.h>
00035
00036 bool newVersion = false;
00037
00038 int main(int argc, char *argv[])
00039 {
00040 setlocale(LC_ALL, "C");
00041
00042
00043 run_main(argc, argv, *ScorchedParams::instance());
00044
00045
00046
00047 if (!OptionsDisplay::instance()->readOptionsFromFile())
00048 {
00049 return false;
00050 }
00051
00052
00053 if (!OptionsDisplay::instance()->getHostDescription()[0])
00054 {
00055 OptionsDisplay::instance()->getHostDescriptionEntry().setValue(S3D::getOSDesc());
00056 OptionsDisplay::instance()->getOnlineUserNameEntry().setValue("Player");
00057 }
00058
00059
00060 if (S3D::stristr(S3D::ScorchedVersion.c_str(), "BETA"))
00061 {
00062 newVersion = true;
00063 }
00064 else if (0 != strcmp(S3D::ScorchedVersion.c_str(), OptionsDisplay::instance()->getLastVersionPlayed()))
00065 {
00066 newVersion = true;
00067 OptionsDisplay::instance()->getLastVersionPlayedEntry().setValue(S3D::ScorchedVersion);
00068 }
00069
00070
00071 OptionsDisplay::instance()->writeOptionsToFile();
00072
00073
00074 unsigned int initFlags = SDL_INIT_VIDEO;
00075 if (ScorchedParams::instance()->getAllowExceptions()) initFlags |= SDL_INIT_NOPARACHUTE;
00076 if (SDL_Init(initFlags) < 0)
00077 {
00078 S3D::dialogMessage(
00079 scorched3dAppName,
00080 "Warning: This game uses the SDL library to provide graphics.\n"
00081 "The graphics section of this library failed to initialize.\n"
00082 "You will only be able to run a server for this game.");
00083 }
00084 else
00085 {
00086 ScorchedParams::instance()->getSDLInitVideo() = true;
00087 }
00088
00089 #ifdef _WIN32
00090 wxEntry((WXHINSTANCE) (HINSTANCE) GetModuleHandle(NULL),
00091 (WXHINSTANCE) NULL, "", SW_SHOWNORMAL);
00092 #else
00093 wxEntry(argc, argv);
00094 #endif
00095
00096 SDL_Quit();
00097 return 0;
00098 }