diff --git a/mk/windoze/g3d_viewer.vcxproj b/mk/windoze/g3d_viewer.vcxproj index 666b7371..d2fe191a 100644 --- a/mk/windoze/g3d_viewer.vcxproj +++ b/mk/windoze/g3d_viewer.vcxproj @@ -84,8 +84,8 @@ /arch:SSE2 %(AdditionalOptions) - "..\..\source\win32_deps\wxWidgets-2.8.10\lib\vc_lib\mswd";"..\..\source\win32_deps\wxWidgets-2.8.10\include\msvc";..\..\source\shared_lib\include\util;..\..\source\shared_lib\include\platform\win32;..\..\source\shared_lib\include\graphics\gl;..\..\source\win32_deps\include;..\..\source\shared_lib\include\graphics;"..\..\source\win32_deps\wxWidgets-2.8.10\include";..\..\source\shared_lib\include\platform\sdl;../../source/shared_lib/include/streflop;../../source/shared_lib/include/platform/common;"../../source/win32_deps/SDL-1.2.x/include";"../../source/win32_deps/curl-7.21.3/include";..\..\source\glest_game\graphics;..\..\source\shared_lib\include\xml;"../../source/win32_deps/xerces-c-3.0.1/src";..\..\source\glest_game\global;..\..\source\glest_game\sound;..\..\source\shared_lib\include\sound;..\..\source\glest_game\game;../../source/shared_lib/include/map;../../source/win32_deps/lpng141;..\..\source\glest_game\facilities;"../../source/win32_deps/glew-1.7.0/include";%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;CURL_STATICLIB;UNICODE;GLEW_STATIC;%(PreprocessorDefinitions) + ..\..\source\windows_deps\wxWidgets-2.9.3\lib\vc_lib\mswu;..\..\source\shared_lib\include\util;..\..\source\shared_lib\include\graphics\gl;..\..\source\windows_deps\include;..\..\source\shared_lib\include\graphics;..\..\source\windows_deps\wxWidgets-2.9.3\include;..\..\source\shared_lib\include\platform\sdl;../../source/shared_lib/include/streflop;../../source/shared_lib/include/platform/common;../../source/windows_deps/SDL-1.2.15/include;../../source/windows_deps/curl-7.21.3/include;..\..\source\glest_game\graphics;..\..\source\shared_lib\include\xml;../../source/windows_deps/xerces-c-3.1.1/src;..\..\source\glest_game\global;..\..\source\glest_game\sound;..\..\source\shared_lib\include\sound;..\..\source\glest_game\game;../../source/shared_lib/include/map;../../source/windows_deps/lpng1510;..\..\source\glest_game\facilities;../../source/windows_deps/glew-1.7.0/include;..\..\source\shared_lib\include\xml\rapidxml;../../source/shared_lib/include/platform/win32;%(AdditionalIncludeDirectories) + _WINDOWS;WIN32;NDEBUG;CURL_STATICLIB;UNICODE;_UNICODE;GLEW_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) true Async MultiThreaded @@ -97,13 +97,15 @@ c:\temp\release\$(TargetName).pch Level3 ProgramDatabase + true + Fast - wxbase28.lib;wxbase28_net.lib;wxbase28_xml.lib;wxexpat.lib;wxjpeg.lib;wxmsw28_adv.lib;wxmsw28_aui.lib;wxmsw28_core.lib;wxmsw28_gl.lib;wxmsw28_html.lib;wxmsw28_media.lib;wxmsw28_qa.lib;wxmsw28_richtext.lib;wxmsw28_xrc.lib;wxregex.lib;wxtiff.lib;wxzlib.lib;winmm.lib;rpcrt4.lib;kernel32.lib;user32.lib;gdi32.lib;ole32.lib;oleaut32.lib;comctl32.lib;comdlg32.lib;uuid.lib;advapi32.lib;shell32.lib;libglest.lib;Dbghelp.lib;sdl.lib;sdlmain.lib;dxguid.lib;libstreflop.lib;libcurl.lib;ws2_32.lib;xerces-c_3.lib;libpng.lib;%(AdditionalDependencies) - $(OutDir)$(ProjectName).exe - ../../source/win32_deps/lib;../../build/$(Configuration)/libglest;../../source/shared_lib/sources/streflop/libstreflop;%(AdditionalLibraryDirectories) + wxbase29u.lib;wxbase29u_net.lib;wxbase29u_xml.lib;wxexpat.lib;wxjpeg.lib;wxtiff.lib;wxmsw29u_adv.lib;wxmsw29u_aui.lib;wxmsw29u_core.lib;wxmsw29u_gl.lib;wxmsw29u_html.lib;wxmsw29u_media.lib;wxmsw29u_qa.lib;wxmsw29u_richtext.lib;wxmsw29u_xrc.lib;wxregexu.lib;winmm.lib;rpcrt4.lib;kernel32.lib;user32.lib;gdi32.lib;ole32.lib;oleaut32.lib;comctl32.lib;comdlg32.lib;uuid.lib;advapi32.lib;shell32.lib;libglest.lib;Dbghelp.lib;sdl.lib;sdlmain.lib;dxguid.lib;libstreflop.lib;libcurl.lib;ws2_32.lib;xerces-c_static_3.lib;libpng15.lib;jpeg.lib;ftgl_static.lib;freetype244MT.lib;glew32s.lib;zlibstat.lib;%(AdditionalDependencies) + $(OutDir)\megaglest_g3dviewer.exe + ../../source/windows_deps/lib;../../build/$(Configuration)/libglest;../../source/shared_lib/sources/streflop/libstreflop;$(DXSDK_DIR)/lib/x86;../../source/windows_deps/Microsoft DirectX SDK %28November 2007%29/Lib/x86;%(AdditionalLibraryDirectories) true - Windows + Console diff --git a/mk/windoze/glest_editor.vcxproj b/mk/windoze/glest_editor.vcxproj index eaa397fc..295fb01f 100644 --- a/mk/windoze/glest_editor.vcxproj +++ b/mk/windoze/glest_editor.vcxproj @@ -84,8 +84,8 @@ /arch:SSE2 %(AdditionalOptions) - ..\..\source\win32_deps\wxWidgets-2.8.10\lib\vc_lib\msw;..\..\source\win32_deps\wxWidgets-2.8.10\include\msvc;..\..\source\shared_lib\include\util;..\..\source\shared_lib\include\platform\win32;..\..\source\shared_lib\include\graphics\gl;..\..\source\win32_deps\include;..\..\source\shared_lib\include\graphics;..\..\source\win32_deps\wxWidgets-2.8.10\include;..\..\source\shared_lib\include\platform\sdl;../../source/shared_lib/include/streflop;../../source/shared_lib/include/platform/common;../../source/win32_deps/SDL-1.2.x/include;../../source/win32_deps/curl-7.21.3/include;../../source/shared_lib/include/map;..\..\source\glest_game\global;..\..\source\glest_game\game;..\..\source\glest_game\facilities;%(AdditionalIncludeDirectories) - MWIN;__WXMSW__;CURL_STATICLIB;%(PreprocessorDefinitions) + ..\..\source\windows_deps\wxWidgets-2.9.3\lib\vc_lib\mswu;..\..\source\shared_lib\include\util;..\..\source\shared_lib\include\platform\win32;..\..\source\shared_lib\include\graphics\gl;..\..\source\windows_deps\include;..\..\source\shared_lib\include\graphics;..\..\source\windows_deps\wxWidgets-2.9.3\include;..\..\source\shared_lib\include\platform\sdl;../../source/shared_lib/include/streflop;../../source/shared_lib/include/platform/common;../../source/windows_deps/SDL-1.2.15/include;../../source/windows_deps/curl-7.21.3/include;../../source/shared_lib/include/map;..\..\source\glest_game\global;..\..\source\glest_game\game;..\..\source\glest_game\facilities;..\..\source\shared_lib\include\xml;..\..\source\shared_lib\include\xml\rapidxml;../../source/windows_deps/xerces-c-3.1.1/src;%(AdditionalIncludeDirectories) + _WINDOWS;WIN32;NDEBUG;CURL_STATICLIB;UNICODE;_UNICODE;GLEW_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) true Async MultiThreaded @@ -99,9 +99,9 @@ ProgramDatabase - wxbase28.lib;wxbase28_net.lib;wxbase28_xml.lib;wxexpat.lib;wxjpeg.lib;wxmsw28_adv.lib;wxmsw28_aui.lib;wxmsw28_core.lib;wxmsw28_gl.lib;wxmsw28_html.lib;wxmsw28_media.lib;wxmsw28_qa.lib;wxmsw28_richtext.lib;wxmsw28_xrc.lib;wxpng.lib;wxregex.lib;wxtiff.lib;wxzlib.lib;winmm.lib;rpcrt4.lib;kernel32.lib;user32.lib;gdi32.lib;ole32.lib;oleaut32.lib;comctl32.lib;comdlg32.lib;uuid.lib;advapi32.lib;shell32.lib;libglest.lib;sdl.lib;sdlmain.lib;dsound.lib;dxguid.lib;Dbghelp.lib;libcurl.lib;ws2_32.lib;%(AdditionalDependencies) - $(OutDir)$(ProjectName).exe - ../../source/win32_deps/lib;../../build/$(Configuration)/libglest;%(AdditionalLibraryDirectories) + wxbase29u.lib;wxbase29u_net.lib;wxbase29u_xml.lib;wxexpat.lib;wxjpeg.lib;wxmsw29u_adv.lib;wxmsw29u_aui.lib;wxmsw29u_core.lib;wxmsw29u_gl.lib;wxmsw29u_html.lib;wxmsw29u_media.lib;wxmsw29u_qa.lib;wxmsw29u_richtext.lib;wxmsw29u_xrc.lib;wxpng.lib;wxregexu.lib;wxtiff.lib;winmm.lib;rpcrt4.lib;kernel32.lib;user32.lib;gdi32.lib;ole32.lib;oleaut32.lib;comctl32.lib;comdlg32.lib;uuid.lib;advapi32.lib;shell32.lib;libglest.lib;sdl.lib;sdlmain.lib;dsound.lib;dxguid.lib;Dbghelp.lib;libcurl.lib;ws2_32.lib;ftgl_static.lib;freetype244MT.lib;zlibstat.lib;%(AdditionalDependencies) + $(OutDir)\megaglest_editor.exe + ../../source/windows_deps/lib;../../build/$(Configuration)/libglest;%(AdditionalLibraryDirectories) true Windows @@ -141,9 +141,7 @@ - - @@ -152,7 +150,6 @@ - diff --git a/mk/windoze/glest_game.vcxproj b/mk/windoze/glest_game.vcxproj index 40ef275c..91d04206 100644 --- a/mk/windoze/glest_game.vcxproj +++ b/mk/windoze/glest_game.vcxproj @@ -106,23 +106,23 @@ Speed true false - ../../source/shared_lib/include/graphics;../../source/shared_lib/include/graphics/gl;../../source/shared_lib/include/platform;../../source/shared_lib/include/platform/win32;../../source/shared_lib/include/sound;../../source/shared_lib/include/sound/ds8;../../source/shared_lib/include/util;../../source/shared_lib/include/lua;../../source/shared_lib/include/xml;../../source/shared_lib/include/tinyxml;../../source/glest_game/ai;../../source/glest_game/facilities;../../source/glest_game/game;../../source/glest_game/global;../../source/glest_game/graphics;../../source/glest_game/gui;../../source/glest_game/main;../../source/glest_game/menu;../../source/glest_game/network;../../source/glest_game/sound;../../source/glest_game/type_instances;../../source/glest_game/types;../../source/glest_game/world;../../source/win32_deps/include;../../source/win32_deps/xerces-c-3.0.1/src;../../source/win32_deps/SDL-1.2.x/include;../../source/shared_lib/include/platform/sdl;../../source/shared_lib/include/sound/openal;../../source/win32_deps/openal-soft-1.12.854/include;../../source/shared_lib/include/platform/posix;../../source/shared_lib/include/streflop;../../source/shared_lib/include/platform/common;../../source/win32_deps/curl-7.21.3/include;../../source/shared_lib/include/map;../../source/win32_deps/libircclient/include;../../source/win32_deps/glew-1.7.0/include + ../../source/shared_lib/include/graphics;../../source/shared_lib/include/graphics/gl;../../source/shared_lib/include/platform;../../source/shared_lib/include/platform/win32;../../source/shared_lib/include/sound;../../source/shared_lib/include/sound/ds8;../../source/shared_lib/include/util;../../source/shared_lib/include/lua;../../source/shared_lib/include/xml;../../source/shared_lib/include/xml/rapidxml;../../source/glest_game/ai;../../source/glest_game/facilities;../../source/glest_game/game;../../source/glest_game/global;../../source/glest_game/graphics;../../source/glest_game/gui;../../source/glest_game/main;../../source/glest_game/menu;../../source/glest_game/network;../../source/glest_game/sound;../../source/glest_game/type_instances;../../source/glest_game/types;../../source/glest_game/world;../../source/windows_deps/include;../../source/windows_deps/xerces-c-3.1.1/src;../../source/windows_deps/SDL-1.2.15/include;../../source/shared_lib/include/platform/sdl;../../source/shared_lib/include/sound/openal;../../source/windows_deps/openal-soft-1.14/include;../../source/shared_lib/include/platform/posix;../../source/shared_lib/include/streflop;../../source/shared_lib/include/platform/common;../../source/windows_deps/curl-7.21.3/include;../../source/shared_lib/include/map;../../source/windows_deps/libircclient/include;../../source/windows_deps/glew-1.7.0/include %(AdditionalUsingDirectories) - WIN32;NDEBUG;_WINDOWS;XML_LIBRARY;USE_PCH=1;_CRT_SECURE_NO_WARNINGS;USE_STREFLOP;STREFLOP_SSE;LIBM_COMPILING_FLT32;CURL_STATICLIB;UNICODE;GLEW_STATIC%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;XML_LIBRARY;USE_PCH=1;_CRT_SECURE_NO_WARNINGS;USE_STREFLOP;STREFLOP_SSE;LIBM_COMPILING_FLT32;CURL_STATICLIB;UNICODE;XERCES_STATIC_LIBRARY;GLEW_STATIC;ZLIB_WINAPI;%(PreprocessorDefinitions) true Async MultiThreaded true StreamingSIMDExtensions - Precise + Fast $(IntDir)$(ProjectName).pdb Level3 ProgramDatabase 4018;4244;4250;4503;%(DisableSpecificWarnings) - dsound.lib;dxguid.lib;ogg_static.lib;vorbis_static.lib;vorbisfile_static.lib;opengl32.lib;glu32.lib;wsock32.lib;libglest.lib;mmc.lib;lua5.1.lib;xerces-c_3.lib;Dbghelp.lib;libpng.lib;jpeg.lib;zlib.lib;sdl.lib;sdlmain.lib;winmm.lib;openal32.lib;iphlpapi.lib;libstreflop.lib;libcurl.lib;ws2_32.lib;libircclient.lib;%(AdditionalDependencies) - ../../source/win32_deps/lib;../../build/$(Configuration)/libglest;../../source/shared_lib/sources/streflop/libstreflop;../../source/win32_deps/libircclient/build/lib;%(AdditionalLibraryDirectories) + dsound.lib;dxguid.lib;glew32s.lib;libogg_static.lib;libvorbis_static.lib;libvorbisfile_static.lib;opengl32.lib;glu32.lib;wsock32.lib;libglest.lib;mmc.lib;lua.lib;xerces-c_static_3.lib;Dbghelp.lib;libpng15.lib;jpeg.lib;zlibstat.lib;sdl.lib;sdlmain.lib;winmm.lib;openal32.lib;iphlpapi.lib;libstreflop.lib;libcurl.lib;ws2_32.lib;libircclient.lib;freetype244MT.lib;ftgl_static.lib;%(AdditionalDependencies) + ../../source/windows_deps/lib;../../build/$(Configuration)/libglest;../../source/shared_lib/sources/streflop/libstreflop;$(DXSDK_DIR)/lib/x86;../../source/windows_deps/Microsoft DirectX SDK %28November 2007%29/Lib/x86;%(AdditionalLibraryDirectories) %(IgnoreSpecificDefaultLibraries) true Console @@ -136,6 +136,9 @@ NotSet + $(OutDir)\megaglest.exe + true + true @@ -222,6 +225,7 @@ + @@ -238,6 +242,7 @@ + @@ -311,12 +316,15 @@ + + + @@ -326,6 +334,7 @@ + @@ -351,6 +360,7 @@ + diff --git a/mk/windoze/shared_lib.vcxproj b/mk/windoze/shared_lib.vcxproj index e545d451..8e1e4ce6 100644 --- a/mk/windoze/shared_lib.vcxproj +++ b/mk/windoze/shared_lib.vcxproj @@ -94,8 +94,8 @@ true Speed false - ../../source/shared_lib/include;../../source/shared_lib/include/graphics;../../source/shared_lib/include/graphics/gl;../../source/shared_lib/include/platform;../../source/shared_lib/include/platform/win32;../../source/shared_lib/include/sound;../../source/shared_lib/include/sound/ds8;../../source/shared_lib/include/util;../../source/shared_lib/include/lua;../../source/shared_lib/include/xml;../../source/win32_deps/include;"../../source/win32_deps/xerces-c-3.0.1/src";"../../source/win32_deps/xerces-c-3.0.1/src/xercesc/xinclude";../../source/win32_deps/lpng141;"../../source/win32_deps/jpeg-8a";"../../source/win32_deps/SDL-1.2.x/include";../../source/shared_lib/include/platform/sdl;"../../source/win32_deps/openal-soft-1.12.854/include";../../source/shared_lib/include/sound/openal;../../source/shared_lib/include/platform/posix;../../source/shared_lib/include/streflop;../../source/shared_lib/include/streflop/libm_flt32_source;../../source/shared_lib/include/platform/common;"../../source/win32_deps/curl-7.21.3/include";../../source/shared_lib/include/map;../../source/shared_lib/include/platform/miniupnpc;../../source/shared_lib/include/libircclient/include;../../source/shared_lib/include/feathery_ftp;"../../source/win32_deps/ftgl-2.1.3-rc5/src";"../../source/win32_deps/freetype-2.4.4/include";"../../source/win32_deps/glew-1.7.0/include";../../source/shared_lib/include/graphics/md5;"../../source/shared_lib/include/graphics/freetype-gl";../../source/shared_lib/include/streflop/softfloat; - WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;USE_PCH=1;USE_STREFLOP;STREFLOP_SSE;STREFLOP_RANDOM_GEN_SIZE=32;LIBM_COMPILING_FLT32;CURL_STATICLIB;UNICODE;USE_FTGL;TA3D_PLATFORM_MSVC;TA3D_PLATFORM_WINDOWS;STATICLIB;USE_FREETYPEGL;GLEW_STATIC%(PreprocessorDefinitions) + ../../source/shared_lib/include;../../source/shared_lib/include/graphics;../../source/shared_lib/include/graphics/gl;../../source/shared_lib/include/platform;../../source/shared_lib/include/sound;../../source/shared_lib/include/sound/ds8;../../source/shared_lib/include/util;../../source/shared_lib/include/lua;../../source/shared_lib/include/xml;../../source/windows_deps/include;../../source/windows_deps/xerces-c-3.1.1/src;../../source/windows_deps/xerces-c-3.1.1/src/xercesc/xinclude;../../source/windows_deps/lpng1510;../../source/windows_deps/jpeg-8a;../../source/windows_deps/SDL-1.2.15/include;../../source/windows_deps/openal-soft-1.14/include;../../source/shared_lib/include/sound/openal;../../source/shared_lib/include/platform/posix;../../source/shared_lib/include/streflop;../../source/shared_lib/include/streflop/libm_flt32_source;../../source/shared_lib/include/platform/common;../../source/windows_deps/curl-7.21.3/include;../../source/shared_lib/include/map;../../source/shared_lib/include/platform/miniupnpc;../../source/shared_lib/include/libircclient/include;../../source/shared_lib/include/feathery_ftp;../../source/windows_deps/ftgl-2.1.3-rc5/src;../../source/windows_deps/freetype-2.4.4/include;../../source/windows_deps/glew-1.7.0/include;../../source/shared_lib/include/graphics/md5;../../source/shared_lib/include/graphics/freetype-gl;../../source/shared_lib/include/streflop/softfloat;../../source/shared_lib/include/xml/rapidxml;../../source/shared_lib/include/platform/sdl;../../source/shared_lib/include/platform/win32 + WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;USE_PCH=1;USE_STREFLOP;STREFLOP_SSE;STREFLOP_RANDOM_GEN_SIZE=32;LIBM_COMPILING_FLT32;CURL_STATICLIB;UNICODE;USE_FTGL;TA3D_PLATFORM_MSVC;TA3D_PLATFORM_WINDOWS;STATICLIB;USE_FREETYPEGL;XERCES_STATIC_LIBRARY;ZLIB_WINAPI;%(PreprocessorDefinitions) true Async MultiThreaded @@ -107,10 +107,11 @@ Level3 ProgramDatabase 4250;%(DisableSpecificWarnings) + true - libstreflop.lib;libcurl.lib;%(AdditionalDependencies) - .\;..\..\source\win32_deps\lib;../../source/win32_deps/libircclient/build/lib;%(AdditionalLibraryDirectories) + libstreflop.lib;libcurl.lib;glew32s.lib;freetype244MT.lib;%(AdditionalDependencies) + .\;..\..\source\windows_deps\lib;%(AdditionalLibraryDirectories) @@ -166,9 +167,30 @@ CompileAsC + + + + + + + + + + + + + + + + + + + + + + - @@ -206,6 +228,7 @@ + @@ -245,6 +268,7 @@ + @@ -332,7 +356,6 @@ - diff --git a/mk/windoze/xml2g.vcxproj b/mk/windoze/xml2g.vcxproj index 8c8a6472..9c955344 100644 --- a/mk/windoze/xml2g.vcxproj +++ b/mk/windoze/xml2g.vcxproj @@ -69,7 +69,7 @@ MaxSpeed true - ..\..\source\win32_deps\libxml2-2.7.7\include;%(AdditionalIncludeDirectories) + ..\..\source\windows_deps\libxml2-2.7.7\include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) MultiThreaded true @@ -80,7 +80,7 @@ wsock32.lib;libxml2_a.lib;%(AdditionalDependencies) - ..\..\source\win32_deps\libxml2-2.7.7\win32\bin.msvc;%(AdditionalLibraryDirectories) + ..\..\source\windows_deps\lib\;%(AdditionalLibraryDirectories) true Console true diff --git a/source/g3d_viewer/main.cpp b/source/g3d_viewer/main.cpp index c89fd0af..b17ab894 100644 --- a/source/g3d_viewer/main.cpp +++ b/source/g3d_viewer/main.cpp @@ -528,19 +528,26 @@ void MainWindow::setupStartupSettings() { } MainWindow::~MainWindow(){ - delete renderer; - renderer = NULL; - delete model; - model = NULL; delete timer; timer = NULL; - delete glCanvas; + + delete model; + model = NULL; + + delete renderer; + renderer = NULL; + + //delete glCanvas; + if(glCanvas) glCanvas->Destroy(); glCanvas = NULL; } void MainWindow::init() { -#if wxCHECK_VERSION(2, 9, 1) + +#if wxCHECK_VERSION(2, 9, 3) + glCanvas->setCurrentGLContext(); +#elif wxCHECK_VERSION(2, 9, 1) #else glCanvas->SetCurrent(); @@ -700,7 +707,21 @@ void MainWindow::onClose(wxCloseEvent &event){ //printf("OnClose about to END\n"); //fflush(stdout); - delete this; + delete timer; + timer = NULL; + + delete model; + model = NULL; + + delete renderer; + renderer = NULL; + + //delete glCanvas; + if(glCanvas) glCanvas->Destroy(); + glCanvas = NULL; + + //delete this; + this->Destroy(); } // for the mousewheel diff --git a/source/g3d_viewer/main.h b/source/g3d_viewer/main.h index 8683c6b1..5690ab1c 100644 --- a/source/g3d_viewer/main.h +++ b/source/g3d_viewer/main.h @@ -12,8 +12,12 @@ #ifndef _SHADER_G3DVIEWER_MAIN_H_ #define _SHADER_G3DVIEWER_MAIN_H_ -#include +#ifdef WIN32 + #include + #include +#endif +#include #include #include #include diff --git a/source/g3d_viewer/renderer.h b/source/g3d_viewer/renderer.h index 243dd9df..7f053ac5 100644 --- a/source/g3d_viewer/renderer.h +++ b/source/g3d_viewer/renderer.h @@ -12,12 +12,10 @@ #ifndef _SHADER_G3DVIEWER_RENDERER_H_ #define _SHADER_G3DVIEWER_RENDERER_H_ -/* -#include "model_renderer.h" -#include "texture_manager.h" -#include "model.h" -#include "texture.h" -*/ +#ifdef WIN32 + #include + #include +#endif #include "model_renderer.h" #include "texture_manager.h" diff --git a/source/glest_game/ai/ai_rule.h b/source/glest_game/ai/ai_rule.h index a9a6d23d..ff604015 100644 --- a/source/glest_game/ai/ai_rule.h +++ b/source/glest_game/ai/ai_rule.h @@ -12,8 +12,12 @@ #ifndef _GLEST_GAME_AIRULE_H_ #define _GLEST_GAME_AIRULE_H_ -#include +#ifdef WIN32 + #include + #include +#endif +#include #include "vec.h" #include "skill_type.h" #include "leak_dumper.h" diff --git a/source/glest_game/ai/annotated_map.h b/source/glest_game/ai/annotated_map.h index ab0f0596..e83106a8 100644 --- a/source/glest_game/ai/annotated_map.h +++ b/source/glest_game/ai/annotated_map.h @@ -17,6 +17,11 @@ #ifndef _GLEST_GAME_ANNOTATED_MAP_H_ #define _GLEST_GAME_ANNOTATED_MAP_H_ +#ifdef WIN32 + #include + #include +#endif + #include "vec.h" #include "map.h" diff --git a/source/glest_game/ai/cartographer.h b/source/glest_game/ai/cartographer.h index 4351b6b8..26f32dd6 100644 --- a/source/glest_game/ai/cartographer.h +++ b/source/glest_game/ai/cartographer.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_CARTOGRAPHER_H_ #define _GLEST_GAME_CARTOGRAPHER_H_ +#ifdef WIN32 + #include + #include +#endif + #include "game_constants.h" #include "influence_map.h" #include "annotated_map.h" diff --git a/source/glest_game/ai/cluster_map.h b/source/glest_game/ai/cluster_map.h index 2496fa18..2ef2688c 100644 --- a/source/glest_game/ai/cluster_map.h +++ b/source/glest_game/ai/cluster_map.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_CLUSTER_MAP_H_ #define _GLEST_GAME_CLUSTER_MAP_H_ +#ifdef WIN32 + #include + #include +#endif + #include "util.h" #include "game_constants.h" #include "skill_type.h" diff --git a/source/glest_game/ai/influence_map.h b/source/glest_game/ai/influence_map.h index e0b6ddd3..ec96fa90 100644 --- a/source/glest_game/ai/influence_map.h +++ b/source/glest_game/ai/influence_map.h @@ -14,7 +14,7 @@ #define _GAME_SEARCH_INLUENCE_MAP_H_ #include "vec.h" -#include "types.h" +#include "data_types.h" #include diff --git a/source/glest_game/ai/node_pool.h b/source/glest_game/ai/node_pool.h index 7ee92e33..900c37b0 100644 --- a/source/glest_game/ai/node_pool.h +++ b/source/glest_game/ai/node_pool.h @@ -15,12 +15,15 @@ #ifndef _GLEST_GAME_PATHFINDER_NODE_POOL_H_ #define _GLEST_GAME_PATHFINDER_NODE_POOL_H_ +#ifdef WIN32 + #include + #include +#endif + #include "vec.h" #include "game_constants.h" - #include "heap.h" -#include "types.h" - +#include "data_types.h" #include #include #include diff --git a/source/glest_game/ai/path_finder.h b/source/glest_game/ai/path_finder.h index 5828d0fc..23bc4631 100644 --- a/source/glest_game/ai/path_finder.h +++ b/source/glest_game/ai/path_finder.h @@ -12,8 +12,12 @@ #ifndef _GLEST_GAME_PATHFINDER_H_ #define _GLEST_GAME_PATHFINDER_H_ -#include "vec.h" +#ifdef WIN32 + #include + #include +#endif +#include "vec.h" #include #include #include "game_constants.h" diff --git a/source/glest_game/ai/route_planner.h b/source/glest_game/ai/route_planner.h index b4ecb1f0..cbb55d45 100644 --- a/source/glest_game/ai/route_planner.h +++ b/source/glest_game/ai/route_planner.h @@ -13,6 +13,11 @@ #ifndef _GLEST_GAME_ROUTEPLANNER_H_ #define _GLEST_GAME_ROUTEPLANNER_H_ +#ifdef WIN32 + #include + #include +#endif + #include "game_constants.h" #include "influence_map.h" #include "annotated_map.h" @@ -25,7 +30,7 @@ #include "node_pool.h" #include "world.h" -#include "types.h" +#include "data_types.h" #define PF_TRACE() SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__) diff --git a/source/glest_game/ai/search_engine.h b/source/glest_game/ai/search_engine.h index 6755415d..77fa5c0b 100644 --- a/source/glest_game/ai/search_engine.h +++ b/source/glest_game/ai/search_engine.h @@ -14,6 +14,11 @@ #ifndef _GLEST_GAME_SEARCH_ENGINE_ #define _GLEST_GAME_SEARCH_ENGINE_ +#ifdef WIN32 + #include + #include +#endif + #include "math_util.h" #include "game_constants.h" diff --git a/source/glest_game/facilities/auto_test.h b/source/glest_game/facilities/auto_test.h index 4cbff4e9..3e503932 100644 --- a/source/glest_game/facilities/auto_test.h +++ b/source/glest_game/facilities/auto_test.h @@ -12,6 +12,11 @@ #ifndef _SHARED_UTIL_AUTO_TEST_H_ #define _SHARED_UTIL_AUTO_TEST_H_ +#ifdef WIN32 + #include + #include +#endif + #include #include "randomgen.h" #include diff --git a/source/glest_game/facilities/components.h b/source/glest_game/facilities/components.h index 32dd0370..1be0da55 100644 --- a/source/glest_game/facilities/components.h +++ b/source/glest_game/facilities/components.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_GRAPHCOMPONENT_H_ #define _GLEST_GAME_GRAPHCOMPONENT_H_ +#ifdef WIN32 + #include + #include +#endif + #include #include #include diff --git a/source/glest_game/facilities/game_util.h b/source/glest_game/facilities/game_util.h index 68c219ac..6f0a96f6 100644 --- a/source/glest_game/facilities/game_util.h +++ b/source/glest_game/facilities/game_util.h @@ -12,9 +12,13 @@ #ifndef _GLEST_GAME_GAMEUTIL_H_ #define _GLEST_GAME_GAMEUTIL_H_ +#ifdef WIN32 + #include + #include +#endif + #include #include - #include "util.h" #include "leak_dumper.h" diff --git a/source/glest_game/facilities/logger.h b/source/glest_game/facilities/logger.h index 81aeef0a..21b00ec1 100644 --- a/source/glest_game/facilities/logger.h +++ b/source/glest_game/facilities/logger.h @@ -12,6 +12,11 @@ #ifndef _SHARED_UTIL_LOGGER_H_ #define _SHARED_UTIL_LOGGER_H_ +#ifdef WIN32 + #include + #include +#endif + #include #include diff --git a/source/glest_game/facilities/pos_iterator.h b/source/glest_game/facilities/pos_iterator.h index e0071085..67f36fe1 100644 --- a/source/glest_game/facilities/pos_iterator.h +++ b/source/glest_game/facilities/pos_iterator.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_UTIL_POSITERATOR_H_ #define _GLEST_GAME_UTIL_POSITERATOR_H_ +#ifdef WIN32 + #include + #include +#endif + #include #include #include "math_util.h" diff --git a/source/glest_game/game/chat_manager.h b/source/glest_game/game/chat_manager.h index 38d5fe28..9908558f 100644 --- a/source/glest_game/game/chat_manager.h +++ b/source/glest_game/game/chat_manager.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_CHATMANAGER_H_ #define _GLEST_GAME_CHATMANAGER_H_ +#ifdef WIN32 + #include + #include +#endif + #include #include "font.h" #include diff --git a/source/glest_game/game/commander.h b/source/glest_game/game/commander.h index ff21ab0f..169ea9b1 100644 --- a/source/glest_game/game/commander.h +++ b/source/glest_game/game/commander.h @@ -12,8 +12,12 @@ #ifndef _GLEST_GAME_COMMANDER_H_ #define _GLEST_GAME_COMMANDER_H_ -#include +#ifdef WIN32 + #include + #include +#endif +#include #include "vec.h" #include "selection.h" #include "command_type.h" diff --git a/source/glest_game/game/console.h b/source/glest_game/game/console.h index 4ff3cace..5c1c9e0a 100644 --- a/source/glest_game/game/console.h +++ b/source/glest_game/game/console.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_CONSOLE_H_ #define _GLEST_GAME_CONSOLE_H_ +#ifdef WIN32 + #include + #include +#endif + #include #include #include diff --git a/source/glest_game/game/game.h b/source/glest_game/game/game.h index 010ab550..16609116 100644 --- a/source/glest_game/game/game.h +++ b/source/glest_game/game/game.h @@ -12,8 +12,12 @@ #ifndef _GLEST_GAME_GAME_H_ #define _GLEST_GAME_GAME_H_ -#include +#ifdef WIN32 + #include + #include +#endif +#include #include "gui.h" #include "game_camera.h" #include "world.h" @@ -23,7 +27,7 @@ #include "script_manager.h" #include "game_settings.h" #include "network_interface.h" -#include "types.h" +#include "data_types.h" #include "leak_dumper.h" using std::vector; diff --git a/source/glest_game/game/game_camera.h b/source/glest_game/game/game_camera.h index 0ecb41e0..10154719 100644 --- a/source/glest_game/game/game_camera.h +++ b/source/glest_game/game/game_camera.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_GAMECAMERA_H_ #define _GLEST_GAME_GAMECAMERA_H_ +#ifdef WIN32 + #include + #include +#endif + #include "vec.h" #include "math_util.h" #include diff --git a/source/glest_game/game/script_manager.h b/source/glest_game/game/script_manager.h index 52d19a72..df59ebbc 100644 --- a/source/glest_game/game/script_manager.h +++ b/source/glest_game/game/script_manager.h @@ -12,10 +12,13 @@ #ifndef _GLEST_GAME_SCRIPT_MANAGER_H_ #define _GLEST_GAME_SCRIPT_MANAGER_H_ -#include -//#include -#include +#ifdef WIN32 + #include + #include +#endif +#include +#include #include "lua_script.h" #include "components.h" #include "game_constants.h" diff --git a/source/glest_game/game/stats.h b/source/glest_game/game/stats.h index 0c5b9629..a712bc54 100644 --- a/source/glest_game/game/stats.h +++ b/source/glest_game/game/stats.h @@ -12,8 +12,12 @@ #ifndef _GLEST_GAME_STATS_H_ #define _GLEST_GAME_STATS_H_ -#include +#ifdef WIN32 + #include + #include +#endif +#include #include "game_constants.h" #include "faction.h" #include "faction_type.h" diff --git a/source/glest_game/global/config.h b/source/glest_game/global/config.h index d93091f2..e856d82e 100644 --- a/source/glest_game/global/config.h +++ b/source/glest_game/global/config.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_CONFIG_H_ #define _GLEST_GAME_CONFIG_H_ +#ifdef WIN32 + #include + #include +#endif + #include "properties.h" #include #include "game_constants.h" diff --git a/source/glest_game/global/core_data.h b/source/glest_game/global/core_data.h index c31ec9ce..deecacb0 100644 --- a/source/glest_game/global/core_data.h +++ b/source/glest_game/global/core_data.h @@ -12,8 +12,12 @@ #ifndef _GLEST_GAME_COREDATA_H_ #define _GLEST_GAME_COREDATA_H_ -#include +#ifdef WIN32 + #include + #include +#endif +#include #include "sound.h" #include "font.h" #include "texture.h" diff --git a/source/glest_game/global/lang.h b/source/glest_game/global/lang.h index 17d6fada..f420ae57 100644 --- a/source/glest_game/global/lang.h +++ b/source/glest_game/global/lang.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_LANG_H_ #define _GLEST_GAME_LANG_H_ +#ifdef WIN32 + #include + #include +#endif + #include "properties.h" #include "leak_dumper.h" diff --git a/source/glest_game/global/metrics.h b/source/glest_game/global/metrics.h index 27de8bb1..0254d854 100644 --- a/source/glest_game/global/metrics.h +++ b/source/glest_game/global/metrics.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_METRICS_H_ #define _GLEST_GAME_METRICS_H_ +#ifdef WIN32 + #include + #include +#endif + #include "config.h" #include "leak_dumper.h" diff --git a/source/glest_game/graphics/debug_renderer.h b/source/glest_game/graphics/debug_renderer.h index 8ff9aafe..2c3269c3 100644 --- a/source/glest_game/graphics/debug_renderer.h +++ b/source/glest_game/graphics/debug_renderer.h @@ -16,6 +16,11 @@ #ifndef _GLEST_GAME_DEBUG_RENDERER_ #define _GLEST_GAME_DEBUG_RENDERER_ +#ifdef WIN32 + #include + #include +#endif + #include "vec.h" #include "math_util.h" #include "pixmap.h" diff --git a/source/glest_game/graphics/particle_type.h b/source/glest_game/graphics/particle_type.h index 0283d9db..39a9014b 100644 --- a/source/glest_game/graphics/particle_type.h +++ b/source/glest_game/graphics/particle_type.h @@ -12,9 +12,13 @@ #ifndef _GLEST_GAME_PARTICLETYPE_H_ #define _GLEST_GAME_PARTICLETYPE_H_ +#ifdef WIN32 + #include + #include +#endif + #include #include - #include "particle.h" #include "factory.h" #include "texture.h" diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index aa3a9344..01d85b49 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -8,6 +8,7 @@ // License, or (at your option) any later version // ============================================================== +#define NOMINMAX #include "renderer.h" #include "texture_gl.h" @@ -24,9 +25,9 @@ #include "faction.h" #include "factory_repository.h" #include -#include #include "cache_manager.h" #include "network_manager.h" +#include #include "leak_dumper.h" using namespace Shared::Graphics; diff --git a/source/glest_game/graphics/renderer.h b/source/glest_game/graphics/renderer.h index 235f9a20..42cba092 100644 --- a/source/glest_game/graphics/renderer.h +++ b/source/glest_game/graphics/renderer.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_RENDERER_H_ #define _GLEST_GAME_RENDERER_H_ +#ifdef WIN32 + #include + #include +#endif + #include "vec.h" #include "math_util.h" #include "model.h" diff --git a/source/glest_game/graphics/unit_particle_type.h b/source/glest_game/graphics/unit_particle_type.h index 4f591504..48d34dfd 100644 --- a/source/glest_game/graphics/unit_particle_type.h +++ b/source/glest_game/graphics/unit_particle_type.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_UNITPARTICLETYPE_H_ #define _GLEST_GAME_UNITPARTICLETYPE_H_ +#ifdef WIN32 + #include + #include +#endif + #include #include diff --git a/source/glest_game/gui/display.h b/source/glest_game/gui/display.h index 7206ef74..257eb516 100644 --- a/source/glest_game/gui/display.h +++ b/source/glest_game/gui/display.h @@ -12,8 +12,12 @@ #ifndef _GLEST_GAME_DISPLAY_H_ #define _GLEST_GAME_DISPLAY_H_ -#include +#ifdef WIN32 + #include + #include +#endif +#include #include "texture.h" #include "util.h" #include "command_type.h" diff --git a/source/glest_game/gui/selection.h b/source/glest_game/gui/selection.h index cc42d7f6..c3e2be0e 100644 --- a/source/glest_game/gui/selection.h +++ b/source/glest_game/gui/selection.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_SELECTION_ #define _GLEST_GAME_SELECTION_ +#ifdef WIN32 + #include + #include +#endif + #include "unit.h" #include #include "leak_dumper.h" diff --git a/source/glest_game/main/battle_end.h b/source/glest_game/main/battle_end.h index 59420fab..6d32269e 100644 --- a/source/glest_game/main/battle_end.h +++ b/source/glest_game/main/battle_end.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_BATTLEEND_H_ #define _GLEST_GAME_BATTLEEND_H_ +#ifdef WIN32 + #include + #include +#endif + #include "program.h" #include "stats.h" #include "leak_dumper.h" diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index 29e464ac..4ccd737c 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -8,6 +8,11 @@ // License, or (at your option) any later version // ============================================================== +#ifdef WIN32 + #include + #include +#endif + #include "math_wrapper.h" #include "main.h" @@ -3357,6 +3362,8 @@ int glestMain(int argc, char** argv) { char langValue[1024]=""; wcstombs(langValue,sysLocale, 1023); const char *lang_locale = &langValue[0]; + + delete [] sysLocale; #else const char *lang_locale = setlocale(LC_ALL,""); #endif diff --git a/source/glest_game/main/main.h b/source/glest_game/main/main.h index f24f52d0..9c326648 100644 --- a/source/glest_game/main/main.h +++ b/source/glest_game/main/main.h @@ -13,7 +13,6 @@ #define _GLEST_GAME_MAIN_H_ #include - #include "program.h" #include "window_gl.h" #include "leak_dumper.h" diff --git a/source/glest_game/main/program.h b/source/glest_game/main/program.h index a8433cb7..9b679d61 100644 --- a/source/glest_game/main/program.h +++ b/source/glest_game/main/program.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_PROGRAM_H_ #define _GLEST_GAME_PROGRAM_H_ +#ifdef WIN32 + #include + #include +#endif + #include "context.h" #include "platform_util.h" #include "window_gl.h" diff --git a/source/glest_game/menu/main_menu.h b/source/glest_game/menu/main_menu.h index 3718f982..6645b746 100644 --- a/source/glest_game/menu/main_menu.h +++ b/source/glest_game/menu/main_menu.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_MAINMENU_H_ #define _GLEST_GAME_MAINMENU_H_ +#ifdef WIN32 + #include + #include +#endif + #include "lang.h" #include "console.h" #include "vec.h" diff --git a/source/glest_game/menu/menu_background.h b/source/glest_game/menu/menu_background.h index 42bddfb3..96554ae4 100644 --- a/source/glest_game/menu/menu_background.h +++ b/source/glest_game/menu/menu_background.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_MENUBACKGROUND_H_ #define _GLEST_GAME_MENUBACKGROUND_H_ +#ifdef WIN32 + #include + #include +#endif + #include "particle.h" #include "camera.h" #include "vec.h" diff --git a/source/glest_game/menu/menu_state_about.h b/source/glest_game/menu/menu_state_about.h index bbeeb7c8..db30d21f 100644 --- a/source/glest_game/menu/menu_state_about.h +++ b/source/glest_game/menu/menu_state_about.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_MENUSTATEABOUT_H_ #define _GLEST_GAME_MENUSTATEABOUT_H_ +#ifdef WIN32 + #include + #include +#endif + #include "main_menu.h" #include "leak_dumper.h" diff --git a/source/glest_game/menu/menu_state_connected_game.h b/source/glest_game/menu/menu_state_connected_game.h index 8ec3e290..a143d88f 100644 --- a/source/glest_game/menu/menu_state_connected_game.h +++ b/source/glest_game/menu/menu_state_connected_game.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_MENUSTATECONNECTEDGAME_H_ #define _GLEST_GAME_MENUSTATECONNECTEDGAME_H_ +#ifdef WIN32 + #include + #include +#endif + #include "main_menu.h" #include "chat_manager.h" #include "map_preview.h" diff --git a/source/glest_game/menu/menu_state_join_game.h b/source/glest_game/menu/menu_state_join_game.h index 4e6509fb..82583a05 100644 --- a/source/glest_game/menu/menu_state_join_game.h +++ b/source/glest_game/menu/menu_state_join_game.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_MENUSTATEJOINGAME_H_ #define _GLEST_GAME_MENUSTATEJOINGAME_H_ +#ifdef WIN32 + #include + #include +#endif + #include "properties.h" #include "main_menu.h" #include "chat_manager.h" diff --git a/source/glest_game/menu/server_line.h b/source/glest_game/menu/server_line.h index b21b2477..841b1b63 100644 --- a/source/glest_game/menu/server_line.h +++ b/source/glest_game/menu/server_line.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_SERVERLINE_H_ #define _GLEST_GAME_SERVERLINE_H_ +#ifdef WIN32 + #include + #include +#endif + #include "masterserver_info.h" #include "components.h" #include "lang.h" diff --git a/source/glest_game/network/client_interface.h b/source/glest_game/network/client_interface.h index ca1128df..b585c6e4 100644 --- a/source/glest_game/network/client_interface.h +++ b/source/glest_game/network/client_interface.h @@ -12,8 +12,12 @@ #ifndef _GLEST_GAME_CLIENTINTERFACE_H_ #define _GLEST_GAME_CLIENTINTERFACE_H_ -#include +#ifdef WIN32 + #include + #include +#endif +#include #include "network_interface.h" #include "socket.h" #include "leak_dumper.h" diff --git a/source/glest_game/network/network_interface.cpp b/source/glest_game/network/network_interface.cpp index 66a62654..32e6e030 100644 --- a/source/glest_game/network/network_interface.cpp +++ b/source/glest_game/network/network_interface.cpp @@ -14,7 +14,7 @@ #include #include -#include "types.h" +#include "data_types.h" #include "conversion.h" #include "platform_util.h" #include diff --git a/source/glest_game/network/network_interface.h b/source/glest_game/network/network_interface.h index 00c73931..d724e1f5 100644 --- a/source/glest_game/network/network_interface.h +++ b/source/glest_game/network/network_interface.h @@ -12,17 +12,19 @@ #ifndef _GLEST_GAME_NETWORKINTERFACE_H_ #define _GLEST_GAME_NETWORKINTERFACE_H_ +#ifdef WIN32 + #include + #include +#endif + #include #include - #include "checksum.h" #include "network_message.h" #include "network_types.h" - #include "game_settings.h" - #include "thread.h" -#include "types.h" +#include "data_types.h" #include #include "leak_dumper.h" diff --git a/source/glest_game/network/network_manager.h b/source/glest_game/network/network_manager.h index 18283e7e..1f70a279 100644 --- a/source/glest_game/network/network_manager.h +++ b/source/glest_game/network/network_manager.h @@ -13,7 +13,6 @@ #define _GLEST_GAME_NETWORKMANAGER_H_ #include - #include "socket.h" #include "checksum.h" #include "server_interface.h" diff --git a/source/glest_game/network/network_message.cpp b/source/glest_game/network/network_message.cpp index bf844437..7733a9b8 100644 --- a/source/glest_game/network/network_message.cpp +++ b/source/glest_game/network/network_message.cpp @@ -14,7 +14,7 @@ #include #include -#include "types.h" +#include "data_types.h" #include "util.h" #include "game_settings.h" diff --git a/source/glest_game/network/network_types.h b/source/glest_game/network/network_types.h index 183c1038..aaf6d136 100644 --- a/source/glest_game/network/network_types.h +++ b/source/glest_game/network/network_types.h @@ -12,9 +12,13 @@ #ifndef _GLEST_GAME_NETWORKTYPES_H_ #define _GLEST_GAME_NETWORKTYPES_H_ -#include +#ifdef WIN32 + #include + #include +#endif -#include "types.h" +#include +#include "data_types.h" #include "vec.h" #include "command.h" #include "leak_dumper.h" diff --git a/source/glest_game/network/server_interface.h b/source/glest_game/network/server_interface.h index 416ad2ec..83431915 100644 --- a/source/glest_game/network/server_interface.h +++ b/source/glest_game/network/server_interface.h @@ -12,8 +12,12 @@ #ifndef _GLEST_GAME_SERVERINTERFACE_H_ #define _GLEST_GAME_SERVERINTERFACE_H_ -#include +#ifdef WIN32 + #include + #include +#endif +#include #include "game_constants.h" #include "network_interface.h" #include "connection_slot.h" diff --git a/source/glest_game/sound/sound_container.h b/source/glest_game/sound/sound_container.h index ece64217..fabb4759 100644 --- a/source/glest_game/sound/sound_container.h +++ b/source/glest_game/sound/sound_container.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_SOUNDCONTAINER_H_ #define _GLEST_GAME_SOUNDCONTAINER_H_ +#ifdef WIN32 + #include + #include +#endif + #include #include "sound.h" #include "randomgen.h" diff --git a/source/glest_game/sound/sound_renderer.h b/source/glest_game/sound/sound_renderer.h index 5e2ed52d..caafb5ae 100644 --- a/source/glest_game/sound/sound_renderer.h +++ b/source/glest_game/sound/sound_renderer.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_SOUNDRENDERER_H_ #define _GLEST_GAME_SOUNDRENDERER_H_ +#ifdef WIN32 + #include + #include +#endif + #include "sound.h" #include "sound_player.h" #include "window.h" diff --git a/source/glest_game/type_instances/command.h b/source/glest_game/type_instances/command.h index a7ae7066..f525ee57 100644 --- a/source/glest_game/type_instances/command.h +++ b/source/glest_game/type_instances/command.h @@ -12,8 +12,12 @@ #ifndef _GLEST_GAME_COMMAND_H_ #define _GLEST_GAME_COMMAND_H_ -#include +#ifdef WIN32 + #include + #include +#endif +#include #include "unit.h" #include "vec.h" #include "game_constants.h" diff --git a/source/glest_game/type_instances/faction.h b/source/glest_game/type_instances/faction.h index d1f4833b..9920ce12 100644 --- a/source/glest_game/type_instances/faction.h +++ b/source/glest_game/type_instances/faction.h @@ -12,9 +12,13 @@ #ifndef _GLEST_GAME_FACTION_H_ #define _GLEST_GAME_FACTION_H_ +#ifdef WIN32 + #include + #include +#endif + #include #include - #include "upgrade.h" #include "texture.h" #include "resource.h" diff --git a/source/glest_game/type_instances/object.h b/source/glest_game/type_instances/object.h index cda663d3..ab46f558 100644 --- a/source/glest_game/type_instances/object.h +++ b/source/glest_game/type_instances/object.h @@ -11,6 +11,11 @@ #ifndef _GLEST_GAME_OBJECT_H_ #define _GLEST_GAME_OBJECT_H_ +#ifdef WIN32 + #include + #include +#endif + #include "model.h" #include "vec.h" #include "leak_dumper.h" diff --git a/source/glest_game/type_instances/resource.h b/source/glest_game/type_instances/resource.h index ed8fef24..c055bee5 100644 --- a/source/glest_game/type_instances/resource.h +++ b/source/glest_game/type_instances/resource.h @@ -11,6 +11,11 @@ #ifndef _GLEST_GAME_RESOURCE_H_ #define _GLEST_GAME_RESOURCE_H_ +#ifdef WIN32 + #include + #include +#endif + #include #include "vec.h" #include "platform_common.h" diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 9daa8292..dcbdea3e 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -8,10 +8,10 @@ // by the Free Software Foundation; either version 2 of the // License, or (at your option) any later version // ============================================================== + +#define NOMINMAX #include "faction.h" - #include - #include "unit.h" #include "unit_particle_type.h" #include "world.h" diff --git a/source/glest_game/type_instances/unit.h b/source/glest_game/type_instances/unit.h index 11f5462c..4a6b1bfc 100644 --- a/source/glest_game/type_instances/unit.h +++ b/source/glest_game/type_instances/unit.h @@ -11,6 +11,11 @@ #ifndef _GLEST_GAME_UNIT_H_ #define _GLEST_GAME_UNIT_H_ +#ifdef WIN32 + #include + #include +#endif + #include "model.h" #include "upgrade_type.h" #include "particle.h" diff --git a/source/glest_game/type_instances/upgrade.h b/source/glest_game/type_instances/upgrade.h index ea3eaae5..2fa7c075 100644 --- a/source/glest_game/type_instances/upgrade.h +++ b/source/glest_game/type_instances/upgrade.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_UPGRADE_H_ #define _GLEST_GAME_UPGRADE_H_ +#ifdef WIN32 + #include + #include +#endif + #include #include #include diff --git a/source/glest_game/types/command_type.h b/source/glest_game/types/command_type.h index 0211e873..0063e0b2 100644 --- a/source/glest_game/types/command_type.h +++ b/source/glest_game/types/command_type.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_COMMANDTYPE_H_ #define _GLEST_GAME_COMMANDTYPE_H_ +#ifdef WIN32 + #include + #include +#endif + #include "element_type.h" #include "resource_type.h" #include "lang.h" diff --git a/source/glest_game/types/damage_multiplier.h b/source/glest_game/types/damage_multiplier.h index 46824d48..b95762c5 100644 --- a/source/glest_game/types/damage_multiplier.h +++ b/source/glest_game/types/damage_multiplier.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_DAMAGEMULTIPLIER_H_ #define _GLEST_GAME_DAMAGEMULTIPLIER_H_ +#ifdef WIN32 + #include + #include +#endif + #include #include "xml_parser.h" #include "leak_dumper.h" diff --git a/source/glest_game/types/element_type.h b/source/glest_game/types/element_type.h index 55483f23..5e044535 100644 --- a/source/glest_game/types/element_type.h +++ b/source/glest_game/types/element_type.h @@ -12,9 +12,13 @@ #ifndef _GLEST_GAME_ELEMENTTYPE_H_ #define _GLEST_GAME_ELEMENTTYPE_H_ +#ifdef WIN32 + #include + #include +#endif + #include #include - #include "texture.h" #include "resource.h" #include "leak_dumper.h" diff --git a/source/glest_game/types/faction_type.h b/source/glest_game/types/faction_type.h index 6a56a750..ea05d81c 100644 --- a/source/glest_game/types/faction_type.h +++ b/source/glest_game/types/faction_type.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_FACTIONTYPE_H_ #define _GLEST_GAME_FACTIONTYPE_H_ +#ifdef WIN32 + #include + #include +#endif + #include "unit_type.h" #include "upgrade_type.h" #include "sound.h" diff --git a/source/glest_game/types/object_type.h b/source/glest_game/types/object_type.h index 5776f68e..f6e5bdee 100644 --- a/source/glest_game/types/object_type.h +++ b/source/glest_game/types/object_type.h @@ -11,8 +11,12 @@ #ifndef _GLEST_GAME_OBJECTTYPE_H_ #define _GLEST_GAME_OBJECTTYPE_H_ -#include +#ifdef WIN32 + #include + #include +#endif +#include #include "model.h" #include "vec.h" #include "leak_dumper.h" diff --git a/source/glest_game/types/resource_type.h b/source/glest_game/types/resource_type.h index 8870e5b1..11e9ac09 100644 --- a/source/glest_game/types/resource_type.h +++ b/source/glest_game/types/resource_type.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_RESOURCETYPE_H_ #define _GLEST_GAME_RESOURCETYPE_H_ +#ifdef WIN32 + #include + #include +#endif + #include "element_type.h" #include "model.h" #include "checksum.h" diff --git a/source/glest_game/types/skill_type.h b/source/glest_game/types/skill_type.h index 4cd509ef..4a5b5fdc 100644 --- a/source/glest_game/types/skill_type.h +++ b/source/glest_game/types/skill_type.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_SKILLTYPE_H_ #define _GLEST_GAME_SKILLTYPE_H_ +#ifdef WIN32 + #include + #include +#endif + #include "sound.h" #include "vec.h" #include "model.h" diff --git a/source/glest_game/types/tech_tree.h b/source/glest_game/types/tech_tree.h index c05c59db..3dcb242c 100644 --- a/source/glest_game/types/tech_tree.h +++ b/source/glest_game/types/tech_tree.h @@ -12,8 +12,12 @@ #ifndef _GLEST_GAME_TECHTREE_H_ #define _GLEST_GAME_TECHTREE_H_ -#include +#ifdef WIN32 + #include + #include +#endif +#include #include "util.h" #include "resource_type.h" #include "faction_type.h" diff --git a/source/glest_game/types/tileset_model_type.h b/source/glest_game/types/tileset_model_type.h index 7bc9a9b7..ef9e7e76 100644 --- a/source/glest_game/types/tileset_model_type.h +++ b/source/glest_game/types/tileset_model_type.h @@ -11,8 +11,12 @@ #ifndef _GLEST_GAME_TILESET_MODEL_TYPE_H_ #define _GLEST_GAME_TILESET_MODEL_TYPE_H_ -#include +#ifdef WIN32 + #include + #include +#endif +#include #include "model.h" #include "vec.h" #include "leak_dumper.h" diff --git a/source/glest_game/types/unit_type.cpp b/source/glest_game/types/unit_type.cpp index 5a9050b5..10d216f7 100644 --- a/source/glest_game/types/unit_type.cpp +++ b/source/glest_game/types/unit_type.cpp @@ -9,10 +9,13 @@ // License, or (at your option) any later version // ============================================================== +#ifdef WIN32 + #include + #include +#endif + #include "unit_type.h" - #include - #include "util.h" #include "upgrade_type.h" #include "resource_type.h" diff --git a/source/glest_game/types/unit_type.h b/source/glest_game/types/unit_type.h index c42e08b2..df236503 100644 --- a/source/glest_game/types/unit_type.h +++ b/source/glest_game/types/unit_type.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_UNITTYPE_H_ #define _GLEST_GAME_UNITTYPE_H_ +#ifdef WIN32 + #include + #include +#endif + #include "element_type.h" #include "command_type.h" #include "damage_multiplier.h" diff --git a/source/glest_game/types/upgrade_type.h b/source/glest_game/types/upgrade_type.h index 7f156436..592dc561 100644 --- a/source/glest_game/types/upgrade_type.h +++ b/source/glest_game/types/upgrade_type.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_UPGRADETYPE_H_ #define _GLEST_GAME_UPGRADETYPE_H_ +#ifdef WIN32 + #include + #include +#endif + #include "element_type.h" #include "checksum.h" #include "conversion.h" diff --git a/source/glest_game/world/map.h b/source/glest_game/world/map.h index 9083c899..da467d2d 100644 --- a/source/glest_game/world/map.h +++ b/source/glest_game/world/map.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_MAP_H_ #define _GLEST_GAME_MAP_H_ +#ifdef WIN32 + #include + #include +#endif + #include "vec.h" #include "math_util.h" #include "command_type.h" diff --git a/source/glest_game/world/minimap.h b/source/glest_game/world/minimap.h index 9ed5f4c3..5ef7c37b 100644 --- a/source/glest_game/world/minimap.h +++ b/source/glest_game/world/minimap.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_MINIMAP_H_ #define _GLEST_GAME_MINIMAP_H_ +#ifdef WIN32 + #include + #include +#endif + #include "pixmap.h" #include "texture.h" #include "xml_parser.h" diff --git a/source/glest_game/world/scenario.h b/source/glest_game/world/scenario.h index f75143f6..b57ff8cd 100644 --- a/source/glest_game/world/scenario.h +++ b/source/glest_game/world/scenario.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_SCENARIO_H_ #define _GLEST_GAME_SCENARIO_H_ +#ifdef WIN32 + #include + #include +#endif + #include #include #include "xml_parser.h" diff --git a/source/glest_game/world/surface_atlas.h b/source/glest_game/world/surface_atlas.h index b80a8318..b836d121 100644 --- a/source/glest_game/world/surface_atlas.h +++ b/source/glest_game/world/surface_atlas.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_SURFACEATLAS_H_ #define _GLEST_GAME_SURFACEATLAS_H_ +#ifdef WIN32 + #include + #include +#endif + #include #include #include "texture.h" diff --git a/source/glest_game/world/tileset.h b/source/glest_game/world/tileset.h index 2d21f287..9615780a 100644 --- a/source/glest_game/world/tileset.h +++ b/source/glest_game/world/tileset.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_TILESET_H_ #define _GLEST_GAME_TILESET_H_ +#ifdef WIN32 + #include + #include +#endif + #include #include "graphics_interface.h" #include "xml_parser.h" diff --git a/source/glest_game/world/time_flow.h b/source/glest_game/world/time_flow.h index 0373690e..fc8ab597 100644 --- a/source/glest_game/world/time_flow.h +++ b/source/glest_game/world/time_flow.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_TIMEFLOW_H_ #define _GLEST_GAME_TIMEFLOW_H_ +#ifdef WIN32 + #include + #include +#endif + #include "tileset.h" #include "sound.h" #include "leak_dumper.h" diff --git a/source/glest_game/world/unit_updater.h b/source/glest_game/world/unit_updater.h index 7a5f2ae1..c57ad6a1 100644 --- a/source/glest_game/world/unit_updater.h +++ b/source/glest_game/world/unit_updater.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_UNITUPDATER_H_ #define _GLEST_GAME_UNITUPDATER_H_ +#ifdef WIN32 + #include + #include +#endif + #include "gui.h" #include "particle.h" #include "randomgen.h" diff --git a/source/glest_game/world/water_effects.h b/source/glest_game/world/water_effects.h index fcc7ae81..6cd85030 100644 --- a/source/glest_game/world/water_effects.h +++ b/source/glest_game/world/water_effects.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_WATER_EFFECTS_H_ #define _GLEST_GAME_WATER_EFFECTS_H_ +#ifdef WIN32 + #include + #include +#endif + #include #include "vec.h" #include "leak_dumper.h" diff --git a/source/glest_game/world/world.h b/source/glest_game/world/world.h index f51970b4..226604bb 100644 --- a/source/glest_game/world/world.h +++ b/source/glest_game/world/world.h @@ -12,6 +12,11 @@ #ifndef _GLEST_GAME_WORLD_H_ #define _GLEST_GAME_WORLD_H_ +#ifdef WIN32 + #include + #include +#endif + #include "vec.h" #include "math_util.h" #include "resource.h" diff --git a/source/glest_map_editor/main.cpp b/source/glest_map_editor/main.cpp index f5458662..b96b8671 100644 --- a/source/glest_map_editor/main.cpp +++ b/source/glest_map_editor/main.cpp @@ -435,7 +435,16 @@ void MainWindow::onClose(wxCloseEvent &event) { wxCommandEvent ev; MainWindow::onMenuFileSave(ev); } - delete this; + + delete program; + program = NULL; + + //delete glCanvas; + if(glCanvas) glCanvas->Destroy(); + glCanvas = NULL; + + //delete this; + this->Destroy(); } void MainWindow::setupStartupSettings() { diff --git a/source/glest_map_editor/main.h b/source/glest_map_editor/main.h index 4c26ca9a..3ead01a2 100644 --- a/source/glest_map_editor/main.h +++ b/source/glest_map_editor/main.h @@ -12,6 +12,11 @@ #ifndef _MAPEDITOR_MAIN_H_ #define _MAPEDITOR_MAIN_H_ +#ifdef WIN32 + #include + #include +#endif + #include #include diff --git a/source/glest_map_editor/renderer.cpp b/source/glest_map_editor/renderer.cpp deleted file mode 100644 index 32450433..00000000 --- a/source/glest_map_editor/renderer.cpp +++ /dev/null @@ -1,201 +0,0 @@ -// ============================================================== -// This file is part of Glest (www.glest.org) -// -// Copyright (C) 2001-2008 Martiño Figueroa -// -// You can redistribute this code and/or modify it under -// the terms of the GNU General Public License as published -// by the Free Software Foundation; either version 2 of the -// License, or (at your option) any later version -// ============================================================== - -//this file is not used - -/* - -#include "renderer.h" - -#include - -#include "opengl.h" -#include "vec.h" - -using namespace Shared::Graphics; -using namespace Shared::Graphics::Gl; - -namespace MapEditor { - -// =============================================== -// class Renderer -// =============================================== - -void Renderer::init(int clientW, int clientH) { - assertGl(); - - glFrontFace(GL_CW); - glEnable(GL_CULL_FACE); - glPolygonMode(GL_FRONT, GL_FILL); - glClearColor(0.5, 0.5, 0.5, 1.0); - - assertGl(); -} - -void Renderer::renderMap(MapPreview *map, int x, int y, int clientW, int clientH, int cellSize, bool grid) { - float alt; - float showWater; - - assertGl(); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, clientW, 0, clientH, 1, -1); - glViewport(0, 0, clientW, clientH); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glPushAttrib(GL_CURRENT_BIT); - - glTranslatef(static_cast(x), static_cast(y), 0.0f); - glLineWidth(1); - glClear(GL_COLOR_BUFFER_BIT); - glColor3f(0, 0, 0); - - for (int j = 0; j < map->getH(); j++) { - for (int i = 0; i < map->getW(); i++) { - if (i * cellSize + x > -cellSize - && i * cellSize + x < clientW - && clientH - cellSize - j * cellSize + y > -cellSize - && clientH - cellSize - j * cellSize + y < clientH) { - - //surface - alt = map->getHeight(i, j) / 20.f; - showWater = map->getWaterLevel()/ 20.f - alt; - showWater = (showWater > 0)? showWater:0; - Vec3f surfColor; - switch (map->getSurface(i, j)) { - case 1: surfColor = Vec3f(0.0, 0.8f * alt, 0.f + showWater); break; - case 2: surfColor = Vec3f(0.4f * alt, 0.6f * alt, 0.f + showWater); break; - case 3: surfColor = Vec3f(0.6f * alt, 0.3f * alt, 0.f + showWater); break; - case 4: surfColor = Vec3f(0.7f * alt, 0.7f * alt, 0.7f * alt + showWater); break; - case 5: surfColor = Vec3f(0.7f * alt, 0.5f * alt, 0.3f * alt + showWater); break; - } - - glColor3fv(surfColor.ptr()); - - glBegin(GL_TRIANGLE_STRIP); - glVertex2i(i * cellSize, clientH - j * cellSize - cellSize); - glVertex2i(i * cellSize, clientH - j * cellSize); - glVertex2i(i * cellSize + cellSize, clientH - j * cellSize - cellSize); - glVertex2i(i * cellSize + cellSize, clientH - j * cellSize); - glEnd(); - - //objects - switch (map->getObject(i, j)) { - case 0: glColor3f(0.f, 0.f, 0.f); break; - case 1: glColor3f(1.f, 0.f, 0.f); break; - case 2: glColor3f(1.f, 1.f, 1.f); break; - case 3: glColor3f(0.5f, 0.5f, 1.f); break; - case 4: glColor3f(0.f, 0.f, 1.f); break; - case 5: glColor3f(0.5f, 0.5f, 0.5f); break; - case 6: glColor3f(1.f, 0.8f, 0.5f); break; - case 7: glColor3f(0.f, 1.f, 1.f); break; - case 8: glColor3f(0.7f, 0.1f, 0.3f); break; - case 9: glColor3f(0.5f, 1.f, 0.1f); break; - case 10: glColor3f(1.f, 0.2f, 0.8f); break; - } - - if (map->getObject(i, j) != 0) { - glPointSize(cellSize / 2.f); - glBegin(GL_POINTS); - glVertex2i(i * cellSize + cellSize / 2, clientH - j * cellSize - cellSize / 2); - glEnd(); - } - -// bool found = false; - - //height lines -// if (!found) { - glColor3fv((surfColor*0.5f).ptr()); - //left - if (i > 0 && map->getHeight(i - 1, j) > map->getHeight(i, j)) { - glBegin(GL_LINES); - glVertex2i(i * cellSize, clientH - (j + 1) * cellSize); - glVertex2i(i * cellSize, clientH - j * cellSize); - glEnd(); - } - //down - if (j > 0 && map->getHeight(i, j - 1) > map->getHeight(i, j)) { - glBegin(GL_LINES); - glVertex2i(i * cellSize, clientH - j * cellSize); - glVertex2i((i + 1) * cellSize, clientH - j * cellSize); - glEnd(); - } - - glColor3fv((surfColor*2.f).ptr()); - //left - if (grid || (i > 0 && map->getHeight(i - 1, j) < map->getHeight(i, j))) { - glBegin(GL_LINES); - glVertex2i(i * cellSize, clientH - (j + 1) * cellSize); - glVertex2i(i * cellSize, clientH - j * cellSize); - glEnd(); - } - if (grid || (j > 0 && map->getHeight(i, j - 1) < map->getHeight(i, j))) { - glBegin(GL_LINES); - glVertex2i(i * cellSize, clientH - j * cellSize); - glVertex2i((i + 1) * cellSize, clientH - j * cellSize); - glEnd(); - } -// } - - //resources - switch (map->getResource(i, j)) { - case 1: glColor3f(1.f, 1.f, 0.f); break; - case 2: glColor3f(0.5f, 0.5f, 0.5f); break; - case 3: glColor3f(1.f, 0.f, 0.f); break; - case 4: glColor3f(0.f, 0.f, 1.f); break; - case 5: glColor3f(0.5f, 0.5f, 1.f); break; - } - - if (map->getResource(i, j) != 0) { - glBegin(GL_LINES); - glVertex2i(i * cellSize, clientH - j * cellSize - cellSize); - glVertex2i(i * cellSize + cellSize, clientH - j * cellSize); - glVertex2i(i * cellSize, clientH - j * cellSize); - glVertex2i(i * cellSize + cellSize, clientH - j * cellSize - cellSize); - glEnd(); - } - } - } - } - - //start locations - glLineWidth(3); - for (int i = 0; i < map->getMaxFactions(); i++) { - switch (i) { - case 0: glColor3f(1.f, 0.f, 0.f); break; - case 1: glColor3f(0.f, 0.f, 1.f); break; - case 2: glColor3f(0.f, 1.f, 0.f); break; - case 3: glColor3f(1.f, 1.f, 0.f); break; - case 4: glColor3f(1.f, 1.f, 1.f); break; - case 5: glColor3f(0.f, 1.f, 0.8f); break; - case 6: glColor3f(1.f, 0.5f, 0.f); break; - case 7: glColor3f(1.f, 0.5f, 1.f); break; - } - glBegin(GL_LINES); - glVertex2i((map->getStartLocationX(i) - 1) * cellSize, clientH - (map->getStartLocationY(i) - 1) * cellSize); - glVertex2i((map->getStartLocationX(i) + 1) * cellSize + cellSize, clientH - (map->getStartLocationY(i) + 1) * cellSize - cellSize); - glVertex2i((map->getStartLocationX(i) - 1) * cellSize, clientH - (map->getStartLocationY(i) + 1) * cellSize - cellSize); - glVertex2i((map->getStartLocationX(i) + 1) * cellSize + cellSize, clientH - (map->getStartLocationY(i) - 1) * cellSize); - glEnd(); - } - - glPopMatrix(); - glPopAttrib(); - - assertGl(); -} - - -}// end namespace - -*/ - diff --git a/source/glest_map_editor/renderer.h b/source/glest_map_editor/renderer.h deleted file mode 100644 index 252ba473..00000000 --- a/source/glest_map_editor/renderer.h +++ /dev/null @@ -1,40 +0,0 @@ -// ============================================================== -// This file is part of Glest (www.glest.org) -// -// Copyright (C) 2001-2008 Martiño Figueroa -// -// You can redistribute this code and/or modify it under -// the terms of the GNU General Public License as published -// by the Free Software Foundation; either version 2 of the -// License, or (at your option) any later version -// ============================================================== - - -//this file is not used - -/* - -#ifndef _MAPEDITOR_RENDERER_H_ -#define _MAPEDITOR_RENDERER_H_ - -#include "map_preview.h" - -using namespace Shared::Map; - -namespace MapEditor { - -// =============================================== -// class Renderer -// =============================================== - -class Renderer { -public: - void init(int clientW, int clientH); - void renderMap(MapPreview *map, int x, int y, int clientW, int clientH, int cellSize, bool grid=false); -}; - -}// end namespace - -#endif - -*/ diff --git a/source/shared_lib/include/graphics/context.h b/source/shared_lib/include/graphics/context.h index 962ec36d..42764130 100644 --- a/source/shared_lib/include/graphics/context.h +++ b/source/shared_lib/include/graphics/context.h @@ -12,7 +12,7 @@ #ifndef _SHARED_GRAPHICS_CONTEXT_H_ #define _SHARED_GRAPHICS_CONTEXT_H_ -#include "types.h" +#include "data_types.h" #include "leak_dumper.h" namespace Shared{ namespace Graphics{ diff --git a/source/shared_lib/include/graphics/model.h b/source/shared_lib/include/graphics/model.h index 67a92e5e..70c74d95 100644 --- a/source/shared_lib/include/graphics/model.h +++ b/source/shared_lib/include/graphics/model.h @@ -14,7 +14,7 @@ #include #include -#include "types.h" +#include "data_types.h" #include "pixmap.h" #include "texture_manager.h" #include "texture.h" diff --git a/source/shared_lib/include/graphics/model_header.h b/source/shared_lib/include/graphics/model_header.h index 23f3375d..0c55d816 100644 --- a/source/shared_lib/include/graphics/model_header.h +++ b/source/shared_lib/include/graphics/model_header.h @@ -12,7 +12,7 @@ #ifndef _SHARED_GRAPHICTYPES_MODELHEADER_H_ #define _SHARED_GRAPHICTYPES_MODELHEADER_H_ -#include "types.h" +#include "data_types.h" #include "leak_dumper.h" using Shared::Platform::uint8; diff --git a/source/shared_lib/include/graphics/pixmap.h b/source/shared_lib/include/graphics/pixmap.h index f149c39c..e09e998c 100644 --- a/source/shared_lib/include/graphics/pixmap.h +++ b/source/shared_lib/include/graphics/pixmap.h @@ -14,7 +14,7 @@ #include #include "vec.h" -#include "types.h" +#include "data_types.h" #include #include "checksum.h" #include "leak_dumper.h" diff --git a/source/shared_lib/include/graphics/texture.h b/source/shared_lib/include/graphics/texture.h index 3a1ff24e..5b88ddc1 100644 --- a/source/shared_lib/include/graphics/texture.h +++ b/source/shared_lib/include/graphics/texture.h @@ -12,7 +12,7 @@ #ifndef _SHARED_GRAPHICS_TEXTURE_H_ #define _SHARED_GRAPHICS_TEXTURE_H_ -#include "types.h" +#include "data_types.h" #include "pixmap.h" #include #include "leak_dumper.h" diff --git a/source/shared_lib/include/map/map_preview.h b/source/shared_lib/include/map/map_preview.h index 89d49c41..04ee18bf 100644 --- a/source/shared_lib/include/map/map_preview.h +++ b/source/shared_lib/include/map/map_preview.h @@ -13,7 +13,7 @@ #define _MAPPREVIEW_MAP_H_ #include "util.h" -#include "types.h" +#include "data_types.h" #include "randomgen.h" #include "vec.h" #include diff --git a/source/shared_lib/include/platform/common/platform_common.h b/source/shared_lib/include/platform/common/platform_common.h index c29a317c..f91df27f 100644 --- a/source/shared_lib/include/platform/common/platform_common.h +++ b/source/shared_lib/include/platform/common/platform_common.h @@ -20,7 +20,7 @@ #include #include -#include "types.h" +#include "data_types.h" #include "checksum.h" #include #include diff --git a/source/shared_lib/include/platform/posix/ircclient.h b/source/shared_lib/include/platform/posix/ircclient.h index 8f03ae60..109bc353 100644 --- a/source/shared_lib/include/platform/posix/ircclient.h +++ b/source/shared_lib/include/platform/posix/ircclient.h @@ -12,6 +12,11 @@ #ifndef _SHARED_PLATFORMCOMMON_IRCTHREAD_H_ #define _SHARED_PLATFORMCOMMON_IRCTHREAD_H_ +#ifdef WIN32 + #include + #include +#endif + #include "base_thread.h" #include #include diff --git a/source/shared_lib/include/platform/posix/miniftpserver.h b/source/shared_lib/include/platform/posix/miniftpserver.h index 5316ee03..30dddee3 100644 --- a/source/shared_lib/include/platform/posix/miniftpserver.h +++ b/source/shared_lib/include/platform/posix/miniftpserver.h @@ -12,10 +12,15 @@ #ifndef _SHARED_PLATFORMCOMMON_MINIFTPSERVERTHREAD_H_ #define _SHARED_PLATFORMCOMMON_MINIFTPSERVERTHREAD_H_ +#ifdef WIN32 + #include + #include +#endif + #include "base_thread.h" #include #include -#include "types.h" +#include "data_types.h" #include "socket.h" #include "leak_dumper.h" diff --git a/source/shared_lib/include/platform/posix/socket.h b/source/shared_lib/include/platform/posix/socket.h index c730dee6..2c5fda2d 100644 --- a/source/shared_lib/include/platform/posix/socket.h +++ b/source/shared_lib/include/platform/posix/socket.h @@ -12,23 +12,11 @@ #ifndef _SHARED_PLATFORM_SOCKET_H_ #define _SHARED_PLATFORM_SOCKET_H_ -#include - -#include -#include -#include -#include -#include -#include "base_thread.h" -#include "simple_threads.h" -#include "types.h" - -using std::string; - #ifdef WIN32 #ifdef __MINGW32__ #include #else + #include #include #endif @@ -44,6 +32,18 @@ using std::string; #endif +#include +#include +#include +#include +#include +#include +#include "base_thread.h" +#include "simple_threads.h" +#include "data_types.h" + +using std::string; + #include "leak_dumper.h" using namespace Shared::PlatformCommon; diff --git a/source/shared_lib/include/platform/win32/types.h b/source/shared_lib/include/platform/sdl/data_types.h similarity index 88% rename from source/shared_lib/include/platform/win32/types.h rename to source/shared_lib/include/platform/sdl/data_types.h index 1206f151..ba9e12d8 100644 --- a/source/shared_lib/include/platform/win32/types.h +++ b/source/shared_lib/include/platform/sdl/data_types.h @@ -1,7 +1,7 @@ // ============================================================== // This file is part of Glest Shared Library (www.glest.org) // -// Copyright (C) 2001-2008 Martiño Figueroa +// Copyright (C) 2005 Matthias Braun // // You can redistribute this code and/or modify it under // the terms of the GNU General Public License as published @@ -12,279 +12,318 @@ #ifndef _SHARED_PLATFORM_TYPES_H_ #define _SHARED_PLATFORM_TYPES_H_ -#define NOMINMAX -#include -#include "leak_dumper.h" +#ifndef WIN32 + +#include +//#include "leak_dumper.h" + +#else + +#define NOMINMAX +#include +//#include "leak_dumper.h" + +#endif namespace Shared{ namespace Platform{ -typedef HWND WindowHandle; -typedef HDC DeviceContextHandle; -typedef HGLRC GlContextHandle; +#ifndef WIN32 + +// These don't have a real meaning in the SDL port +typedef void* WindowHandle; +typedef void* DeviceContextHandle; +typedef void* GlContextHandle; typedef float float32; typedef double float64; +// don't use Sint8 here because that is defined as signed char +// and some parts of the code do std::string str = (int8*) var; typedef char int8; -typedef unsigned char uint8; -typedef short int int16; -typedef unsigned short int uint16; -typedef int int32; -typedef unsigned int uint32; -typedef long long int64; -typedef unsigned long long uint64; +typedef Uint8 uint8; +typedef Sint16 int16; +typedef Uint16 uint16; +typedef Sint32 int32; +typedef Uint32 uint32; +typedef Sint64 int64; +typedef Uint64 uint64; +typedef uint8 byte; + +// !!! WINDOWS +#else + +typedef HWND WindowHandle; +typedef HDC DeviceContextHandle; +typedef HGLRC GlContextHandle; + +typedef float float32; +typedef double float64; +typedef char int8; +typedef unsigned char uint8; +typedef short int int16; +typedef unsigned short int uint16; +typedef int int32; +typedef unsigned int uint32; +typedef long long int64; +typedef unsigned long long uint64; + +#endif }}//end namespace -#ifndef __MINGW32__ - -// ISO C9x compliant stdint.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006-2008 Alexander Chemeris -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. The name of the author may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _MSC_VER // [ -#error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] - -#ifndef _MSC_STDINT_H_ // [ -#define _MSC_STDINT_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#include - -// For Visual Studio 6 in C++ mode and for many Visual Studio versions when -// compiling for ARM we should wrap include with 'extern "C++" {}' -// or compiler give many errors like this: -// error C2733: second C linkage of overloaded function 'wmemchr' not allowed -#ifdef __cplusplus -extern "C" { -#endif -# include -#ifdef __cplusplus -} -#endif - -// Define _W64 macros to mark types changing their size, like intptr_t. -#ifndef _W64 -# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 -# define _W64 __w64 -# else -# define _W64 -# endif -#endif - - -// 7.18.1 Integer types - -// 7.18.1.1 Exact-width integer types - -// Visual Studio 6 and Embedded Visual C++ 4 doesn't -// realize that, e.g. char has the same size as __int8 -// so we give up on __intX for them. -#if (_MSC_VER < 1300) - typedef signed char int8_t; - typedef signed short int16_t; - typedef signed int int32_t; - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; -#else - typedef signed __int8 int8_t; - typedef signed __int16 int16_t; - typedef signed __int32 int32_t; - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; -#endif -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; - - -// 7.18.1.2 Minimum-width integer types -typedef int8_t int_least8_t; -typedef int16_t int_least16_t; -typedef int32_t int_least32_t; -typedef int64_t int_least64_t; -typedef uint8_t uint_least8_t; -typedef uint16_t uint_least16_t; -typedef uint32_t uint_least32_t; -typedef uint64_t uint_least64_t; - -// 7.18.1.3 Fastest minimum-width integer types -typedef int8_t int_fast8_t; -typedef int16_t int_fast16_t; -typedef int32_t int_fast32_t; -typedef int64_t int_fast64_t; -typedef uint8_t uint_fast8_t; -typedef uint16_t uint_fast16_t; -typedef uint32_t uint_fast32_t; -typedef uint64_t uint_fast64_t; - -// 7.18.1.4 Integer types capable of holding object pointers -#ifdef _WIN64 // [ - typedef signed __int64 intptr_t; - typedef unsigned __int64 uintptr_t; -#else // _WIN64 ][ - typedef _W64 signed int intptr_t; - typedef _W64 unsigned int uintptr_t; -#endif // _WIN64 ] - -// 7.18.1.5 Greatest-width integer types -typedef int64_t intmax_t; -typedef uint64_t uintmax_t; - - -// 7.18.2 Limits of specified-width integer types - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 - -// 7.18.2.1 Limits of exact-width integer types -#define INT8_MIN ((int8_t)_I8_MIN) -#define INT8_MAX _I8_MAX -#define INT16_MIN ((int16_t)_I16_MIN) -#define INT16_MAX _I16_MAX -#define INT32_MIN ((int32_t)_I32_MIN) -#define INT32_MAX _I32_MAX -#define INT64_MIN ((int64_t)_I64_MIN) -#define INT64_MAX _I64_MAX -#define UINT8_MAX _UI8_MAX -#define UINT16_MAX _UI16_MAX -#define UINT32_MAX _UI32_MAX -#define UINT64_MAX _UI64_MAX - -// 7.18.2.2 Limits of minimum-width integer types -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MIN INT64_MIN -#define INT_LEAST64_MAX INT64_MAX -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -// 7.18.2.3 Limits of fastest minimum-width integer types -#define INT_FAST8_MIN INT8_MIN -#define INT_FAST8_MAX INT8_MAX -#define INT_FAST16_MIN INT16_MIN -#define INT_FAST16_MAX INT16_MAX -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MIN INT64_MIN -#define INT_FAST64_MAX INT64_MAX -#define UINT_FAST8_MAX UINT8_MAX -#define UINT_FAST16_MAX UINT16_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -// 7.18.2.4 Limits of integer types capable of holding object pointers -#ifdef _WIN64 // [ -# define INTPTR_MIN INT64_MIN -# define INTPTR_MAX INT64_MAX -# define UINTPTR_MAX UINT64_MAX -#else // _WIN64 ][ -# define INTPTR_MIN INT32_MIN -# define INTPTR_MAX INT32_MAX -# define UINTPTR_MAX UINT32_MAX -#endif // _WIN64 ] - -// 7.18.2.5 Limits of greatest-width integer types -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -// 7.18.3 Limits of other integer types - -#ifdef _WIN64 // [ -# define PTRDIFF_MIN _I64_MIN -# define PTRDIFF_MAX _I64_MAX -#else // _WIN64 ][ -# define PTRDIFF_MIN _I32_MIN -# define PTRDIFF_MAX _I32_MAX -#endif // _WIN64 ] - -#define SIG_ATOMIC_MIN INT_MIN -#define SIG_ATOMIC_MAX INT_MAX - -#ifndef SIZE_MAX // [ -# ifdef _WIN64 // [ -# define SIZE_MAX _UI64_MAX -# else // _WIN64 ][ -# define SIZE_MAX _UI32_MAX -# endif // _WIN64 ] -#endif // SIZE_MAX ] - -// WCHAR_MIN and WCHAR_MAX are also defined in -#ifndef WCHAR_MIN // [ -# define WCHAR_MIN 0 -#endif // WCHAR_MIN ] -#ifndef WCHAR_MAX // [ -# define WCHAR_MAX _UI16_MAX -#endif // WCHAR_MAX ] - -#define WINT_MIN 0 -#define WINT_MAX _UI16_MAX - -#endif // __STDC_LIMIT_MACROS ] - - -// 7.18.4 Limits of other integer types - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 - -// 7.18.4.1 Macros for minimum-width integer constants - -#define INT8_C(val) val##i8 -#define INT16_C(val) val##i16 -#define INT32_C(val) val##i32 -#define INT64_C(val) val##i64 - -#define UINT8_C(val) val##ui8 -#define UINT16_C(val) val##ui16 -#define UINT32_C(val) val##ui32 -#define UINT64_C(val) val##ui64 - -// 7.18.4.2 Macros for greatest-width integer constants -#define INTMAX_C INT64_C -#define UINTMAX_C UINT64_C - -#endif // __STDC_CONSTANT_MACROS ] - - -#endif // _MSC_STDINT_H_ ] +// ======================================================= +#ifdef WIN32 +#ifndef __MINGW32__ + +// ISO C9x compliant stdint.h for Microsoft Visual Studio +// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 +// +// Copyright (c) 2006-2008 Alexander Chemeris +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// 3. The name of the author may be used to endorse or promote products +// derived from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +/////////////////////////////////////////////////////////////////////////////// + +#ifndef _MSC_VER // [ +#error "Use this header only with Microsoft Visual C++ compilers!" +#endif // _MSC_VER ] + +#ifndef _MSC_STDINT_H_ // [ +#define _MSC_STDINT_H_ + +#if _MSC_VER > 1000 +#pragma once +#endif + +#include + +// For Visual Studio 6 in C++ mode and for many Visual Studio versions when +// compiling for ARM we should wrap include with 'extern "C++" {}' +// or compiler give many errors like this: +// error C2733: second C linkage of overloaded function 'wmemchr' not allowed +#ifdef __cplusplus +extern "C" { +#endif +# include +#ifdef __cplusplus +} +#endif + +// Define _W64 macros to mark types changing their size, like intptr_t. +#ifndef _W64 +# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 +# define _W64 __w64 +# else +# define _W64 +# endif +#endif + + +// 7.18.1 Integer types + +// 7.18.1.1 Exact-width integer types + +// Visual Studio 6 and Embedded Visual C++ 4 doesn't +// realize that, e.g. char has the same size as __int8 +// so we give up on __intX for them. +#if (_MSC_VER < 1300) + typedef signed char int8_t; + typedef signed short int16_t; + typedef signed int int32_t; + typedef unsigned char uint8_t; + typedef unsigned short uint16_t; + typedef unsigned int uint32_t; +#else + typedef signed __int8 int8_t; + typedef signed __int16 int16_t; + typedef signed __int32 int32_t; + typedef unsigned __int8 uint8_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int32 uint32_t; +#endif +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; + + +// 7.18.1.2 Minimum-width integer types +typedef int8_t int_least8_t; +typedef int16_t int_least16_t; +typedef int32_t int_least32_t; +typedef int64_t int_least64_t; +typedef uint8_t uint_least8_t; +typedef uint16_t uint_least16_t; +typedef uint32_t uint_least32_t; +typedef uint64_t uint_least64_t; + +// 7.18.1.3 Fastest minimum-width integer types +typedef int8_t int_fast8_t; +typedef int16_t int_fast16_t; +typedef int32_t int_fast32_t; +typedef int64_t int_fast64_t; +typedef uint8_t uint_fast8_t; +typedef uint16_t uint_fast16_t; +typedef uint32_t uint_fast32_t; +typedef uint64_t uint_fast64_t; + +// 7.18.1.4 Integer types capable of holding object pointers +#ifdef _WIN64 // [ + typedef signed __int64 intptr_t; + typedef unsigned __int64 uintptr_t; +#else // _WIN64 ][ + typedef _W64 signed int intptr_t; + typedef _W64 unsigned int uintptr_t; +#endif // _WIN64 ] + +// 7.18.1.5 Greatest-width integer types +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; + + +// 7.18.2 Limits of specified-width integer types + +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 + +// 7.18.2.1 Limits of exact-width integer types +#define INT8_MIN ((int8_t)_I8_MIN) +#define INT8_MAX _I8_MAX +#define INT16_MIN ((int16_t)_I16_MIN) +#define INT16_MAX _I16_MAX +#define INT32_MIN ((int32_t)_I32_MIN) +#define INT32_MAX _I32_MAX +#define INT64_MIN ((int64_t)_I64_MIN) +#define INT64_MAX _I64_MAX +#define UINT8_MAX _UI8_MAX +#define UINT16_MAX _UI16_MAX +#define UINT32_MAX _UI32_MAX +#define UINT64_MAX _UI64_MAX + +// 7.18.2.2 Limits of minimum-width integer types +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MIN INT64_MIN +#define INT_LEAST64_MAX INT64_MAX +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +// 7.18.2.3 Limits of fastest minimum-width integer types +#define INT_FAST8_MIN INT8_MIN +#define INT_FAST8_MAX INT8_MAX +#define INT_FAST16_MIN INT16_MIN +#define INT_FAST16_MAX INT16_MAX +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST32_MAX INT32_MAX +#define INT_FAST64_MIN INT64_MIN +#define INT_FAST64_MAX INT64_MAX +#define UINT_FAST8_MAX UINT8_MAX +#define UINT_FAST16_MAX UINT16_MAX +#define UINT_FAST32_MAX UINT32_MAX +#define UINT_FAST64_MAX UINT64_MAX + +// 7.18.2.4 Limits of integer types capable of holding object pointers +#ifdef _WIN64 // [ +# define INTPTR_MIN INT64_MIN +# define INTPTR_MAX INT64_MAX +# define UINTPTR_MAX UINT64_MAX +#else // _WIN64 ][ +# define INTPTR_MIN INT32_MIN +# define INTPTR_MAX INT32_MAX +# define UINTPTR_MAX UINT32_MAX +#endif // _WIN64 ] + +// 7.18.2.5 Limits of greatest-width integer types +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +// 7.18.3 Limits of other integer types + +#ifdef _WIN64 // [ +# define PTRDIFF_MIN _I64_MIN +# define PTRDIFF_MAX _I64_MAX +#else // _WIN64 ][ +# define PTRDIFF_MIN _I32_MIN +# define PTRDIFF_MAX _I32_MAX +#endif // _WIN64 ] + +#define SIG_ATOMIC_MIN INT_MIN +#define SIG_ATOMIC_MAX INT_MAX + +#ifndef SIZE_MAX // [ +# ifdef _WIN64 // [ +# define SIZE_MAX _UI64_MAX +# else // _WIN64 ][ +# define SIZE_MAX _UI32_MAX +# endif // _WIN64 ] +#endif // SIZE_MAX ] + +// WCHAR_MIN and WCHAR_MAX are also defined in +#ifndef WCHAR_MIN // [ +# define WCHAR_MIN 0 +#endif // WCHAR_MIN ] +#ifndef WCHAR_MAX // [ +# define WCHAR_MAX _UI16_MAX +#endif // WCHAR_MAX ] + +#define WINT_MIN 0 +#define WINT_MAX _UI16_MAX + +#endif // __STDC_LIMIT_MACROS ] + + +// 7.18.4 Limits of other integer types + +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 + +// 7.18.4.1 Macros for minimum-width integer constants + +#define INT8_C(val) val##i8 +#define INT16_C(val) val##i16 +#define INT32_C(val) val##i32 +#define INT64_C(val) val##i64 + +#define UINT8_C(val) val##ui8 +#define UINT16_C(val) val##ui16 +#define UINT32_C(val) val##ui32 +#define UINT64_C(val) val##ui64 + +// 7.18.4.2 Macros for greatest-width integer constants +#define INTMAX_C INT64_C +#define UINTMAX_C UINT64_C + +#endif // __STDC_CONSTANT_MACROS ] + + +#endif // _MSC_STDINT_H_ ] + +#endif #endif #endif diff --git a/source/shared_lib/include/platform/sdl/gl_wrap.h b/source/shared_lib/include/platform/sdl/gl_wrap.h index b54f5da3..5765be47 100644 --- a/source/shared_lib/include/platform/sdl/gl_wrap.h +++ b/source/shared_lib/include/platform/sdl/gl_wrap.h @@ -28,7 +28,7 @@ #include #include "font.h" -#include "types.h" +#include "data_types.h" #include #include "leak_dumper.h" diff --git a/source/shared_lib/include/platform/sdl/platform_util.h b/source/shared_lib/include/platform/sdl/platform_util.h index c5ec2ad4..943e790d 100644 --- a/source/shared_lib/include/platform/sdl/platform_util.h +++ b/source/shared_lib/include/platform/sdl/platform_util.h @@ -11,6 +11,12 @@ #ifndef _SHARED_PLATFORM_PLATFORMUTIL_H_ #define _SHARED_PLATFORM_PLATFORMUTIL_H_ +#ifdef WIN32 + +#include + +#endif + #include #include #include "platform_common.h" @@ -27,6 +33,7 @@ public: megaglest_runtime_error(const string& __arg); }; +#ifndef WIN32 // ===================================================== // class PlatformExceptionHandler // ===================================================== @@ -51,6 +58,78 @@ void exceptionMessage(const exception &excp); string getCommandLine(); +// WINDOWS +#else + +// ===================================================== +// class PlatformExceptionHandler +// ===================================================== + +class PlatformExceptionHandler { +private: + static PlatformExceptionHandler *thisPointer; + +private: + static LONG WINAPI handler(LPEXCEPTION_POINTERS pointers); + string dumpFileName; + +public: + static string application_binary; + static string getStackTrace(); + + void install(string dumpFileName); + virtual void handle()=0; + static string codeToStr(DWORD code); +}; + +LONG WINAPI UnhandledExceptionFilter2(struct _EXCEPTION_POINTERS *ExceptionInfo); + +// ===================================================== +// Misc +// ===================================================== +LPWSTR Ansi2WideString(LPCSTR lpaszString); +std::string utf8_encode(const std::wstring wstr); +std::wstring utf8_decode(const std::string &str); + +void message(string message); +bool ask(string message); +void exceptionMessage(const exception &excp); +string getCommandLine(); +void init_win32(); +void done_win32(); + + +// The following is used for stacking tracing for windows based exceptions +#if !defined(_DEBUG) && !defined(__GNUC__) + +// easy safe strings +#define MAXSTRLEN 260 +typedef char stringType[MAXSTRLEN]; + +inline void vformatstring(char *d, const char *fmt, va_list v, int len = MAXSTRLEN) { _vsnprintf(d, len, fmt, v); d[len-1] = 0; } +inline char *copystring(char *d, const char *s, size_t len = MAXSTRLEN) { strncpy(d, s, len); d[len-1] = 0; return d; } +inline char *concatstring(char *d, const char *s, size_t len = MAXSTRLEN) { size_t used = strlen(d); return used < len ? copystring(d+used, s, len-used) : d; } + +struct stringformatter { + char *buf; + stringformatter(char *buf): buf((char *)buf) {} + void operator()(const char *fmt, ...) { + va_list v; + va_start(v, fmt); + vformatstring(buf, fmt, v); + va_end(v); + } +}; + +#define formatstring(d) stringformatter((char *)d) +#define defformatstring(d) stringType d; formatstring(d) +#define defvformatstring(d,last,fmt) stringType d; { va_list ap; va_start(ap, last); vformatstring(d, fmt, ap); va_end(ap); } + +#endif + }}//end namespace #endif + + +#endif diff --git a/source/shared_lib/include/platform/sdl/thread.h b/source/shared_lib/include/platform/sdl/thread.h index b632d70a..03db9808 100644 --- a/source/shared_lib/include/platform/sdl/thread.h +++ b/source/shared_lib/include/platform/sdl/thread.h @@ -18,13 +18,13 @@ #include #include #include + +#include "data_types.h" #ifdef DEBUG_PERFORMANCE_MUTEXES #include "platform_common.h" #endif -//#include "util.h" #include -#include "types.h" //#include "leak_dumper.h" // ===================================================== @@ -39,6 +39,7 @@ using namespace Shared::PlatformCommon; namespace Shared { namespace Platform { class Mutex; +//class uint32; class Thread { public: diff --git a/source/shared_lib/include/platform/sdl/types.h b/source/shared_lib/include/platform/sdl/types.h deleted file mode 100644 index df709165..00000000 --- a/source/shared_lib/include/platform/sdl/types.h +++ /dev/null @@ -1,43 +0,0 @@ -// ============================================================== -// This file is part of Glest Shared Library (www.glest.org) -// -// Copyright (C) 2005 Matthias Braun -// -// You can redistribute this code and/or modify it under -// the terms of the GNU General Public License as published -// by the Free Software Foundation; either version 2 of the -// License, or (at your option) any later version -// ============================================================== -#ifndef _SHARED_PLATFORM_TYPES_H_ -#define _SHARED_PLATFORM_TYPES_H_ - -#include -//#include "leak_dumper.h" - -namespace Shared{ namespace Platform{ - -// These don't have a real meaning in the SDL port -typedef void* WindowHandle; -typedef void* DeviceContextHandle; -typedef void* GlContextHandle; - -typedef float float32; -typedef double float64; -// don't use Sint8 here because that is defined as signed char -// and some parts of the code do std::string str = (int8*) var; -typedef char int8; -typedef Uint8 uint8; -typedef Sint16 int16; -typedef Uint16 uint16; -typedef Sint32 int32; -typedef Uint32 uint32; -typedef Sint64 int64; -typedef Uint64 uint64; - -#ifndef WIN32 -typedef uint8 byte; -#endif - -}}//end namespace - -#endif diff --git a/source/shared_lib/include/platform/sdl/window.h b/source/shared_lib/include/platform/sdl/window.h index 1e071090..eba4b095 100644 --- a/source/shared_lib/include/platform/sdl/window.h +++ b/source/shared_lib/include/platform/sdl/window.h @@ -17,7 +17,7 @@ #include #include #include -#include "types.h" +#include "data_types.h" #include "vec.h" #include "leak_dumper.h" @@ -25,6 +25,13 @@ using std::map; using std::string; using Shared::Graphics::Vec2i; +#if SDL_VERSION_ATLEAST(2,0,0) + +typedef SDL_Keysym SDL_keysym; +typedef SDL_Keycode SDLKey; + +#endif + namespace Shared{ namespace Platform{ class Timer; diff --git a/source/shared_lib/include/platform/win32/platform_util.h b/source/shared_lib/include/platform/win32/platform_util.h deleted file mode 100644 index 25863c11..00000000 --- a/source/shared_lib/include/platform/win32/platform_util.h +++ /dev/null @@ -1,102 +0,0 @@ -// ============================================================== -// This file is part of Glest Shared Library (www.glest.org) -// -// Copyright (C) 2001-2008 Martiño Figueroa -// -// You can redistribute this code and/or modify it under -// the terms of the GNU General Public License as published -// by the Free Software Foundation; either version 2 of the -// License, or (at your option) any later version -// ============================================================== - -#ifndef _SHARED_PLATFORM_PLATFORMUTIL_H_ -#define _SHARED_PLATFORM_PLATFORMUTIL_H_ - -#include -#include -#include -#include "platform_common.h" -#include "leak_dumper.h" - -using namespace Shared::PlatformCommon; -using std::string; -using std::exception; - -namespace Shared{ namespace Platform{ - -LPWSTR Ansi2WideString(LPCSTR lpaszString); -std::string utf8_encode(const std::wstring wstr); -std::wstring utf8_decode(const std::string &str); - -class megaglest_runtime_error : public runtime_error { -public: - megaglest_runtime_error(const string& __arg); -}; - -// ===================================================== -// class PlatformExceptionHandler -// ===================================================== - -LONG WINAPI UnhandledExceptionFilter2(struct _EXCEPTION_POINTERS *ExceptionInfo); - -class PlatformExceptionHandler { -private: - static PlatformExceptionHandler *thisPointer; - -private: - static LONG WINAPI handler(LPEXCEPTION_POINTERS pointers); - string dumpFileName; - -public: - static string application_binary; - static string getStackTrace(); - - void install(string dumpFileName); - virtual void handle()=0; - static string codeToStr(DWORD code); -}; - -// ===================================================== -// Misc -// ===================================================== -void message(string message); -bool ask(string message); -void exceptionMessage(const exception &excp); -string getCommandLine(); -void init_win32(); -void done_win32(); - - -// The following is used for stacking tracing for windows based exceptions -#if defined(WIN32) && !defined(_DEBUG) && !defined(__GNUC__) - -// easy safe strings -#define MAXSTRLEN 260 -typedef char stringType[MAXSTRLEN]; - -inline void vformatstring(char *d, const char *fmt, va_list v, int len = MAXSTRLEN) { _vsnprintf(d, len, fmt, v); d[len-1] = 0; } -inline char *copystring(char *d, const char *s, size_t len = MAXSTRLEN) { strncpy(d, s, len); d[len-1] = 0; return d; } -inline char *concatstring(char *d, const char *s, size_t len = MAXSTRLEN) { size_t used = strlen(d); return used < len ? copystring(d+used, s, len-used) : d; } - -struct stringformatter -{ - char *buf; - stringformatter(char *buf): buf((char *)buf) {} - void operator()(const char *fmt, ...) - { - va_list v; - va_start(v, fmt); - vformatstring(buf, fmt, v); - va_end(v); - } -}; - -#define formatstring(d) stringformatter((char *)d) -#define defformatstring(d) stringType d; formatstring(d) -#define defvformatstring(d,last,fmt) stringType d; { va_list ap; va_start(ap, last); vformatstring(d, fmt, ap); va_end(ap); } - -#endif - -}}//end namespace - -#endif diff --git a/source/shared_lib/include/sound/sound_file_loader.h b/source/shared_lib/include/sound/sound_file_loader.h index e71fcea6..82ffa167 100644 --- a/source/shared_lib/include/sound/sound_file_loader.h +++ b/source/shared_lib/include/sound/sound_file_loader.h @@ -14,7 +14,7 @@ #include #include -#include "types.h" +#include "data_types.h" #include "factory.h" #include "leak_dumper.h" diff --git a/source/shared_lib/include/sound/sound_player.h b/source/shared_lib/include/sound/sound_player.h index e976d562..5b0ed4cc 100644 --- a/source/shared_lib/include/sound/sound_player.h +++ b/source/shared_lib/include/sound/sound_player.h @@ -13,7 +13,7 @@ #define _SHARED_SOUND_SOUNDPLAYER_H_ #include "sound.h" -#include "types.h" +#include "data_types.h" #include "leak_dumper.h" using Shared::Platform::uint32; diff --git a/source/shared_lib/include/util/checksum.h b/source/shared_lib/include/util/checksum.h index 89f6372d..f397d3c8 100644 --- a/source/shared_lib/include/util/checksum.h +++ b/source/shared_lib/include/util/checksum.h @@ -14,7 +14,7 @@ #include #include -#include "types.h" +#include "data_types.h" #include "thread.h" #include "leak_dumper.h" diff --git a/source/shared_lib/include/util/conversion.h b/source/shared_lib/include/util/conversion.h index b154b515..87c3fadc 100644 --- a/source/shared_lib/include/util/conversion.h +++ b/source/shared_lib/include/util/conversion.h @@ -13,7 +13,7 @@ #define _SHARED_UTIL_CONVERSION_H_ #include -#include "types.h" +#include "data_types.h" #include "leak_dumper.h" using std::string; diff --git a/source/shared_lib/include/util/leak_dumper.h b/source/shared_lib/include/util/leak_dumper.h index d9fc0d29..8aecdcc7 100644 --- a/source/shared_lib/include/util/leak_dumper.h +++ b/source/shared_lib/include/util/leak_dumper.h @@ -21,6 +21,7 @@ // START - Special includes because the use a special new operator that we cannot override #include #include "rapidxml.hpp" + #include // END - Special includes because the use a special new operator that we cannot override diff --git a/source/shared_lib/include/util/string_utils.h b/source/shared_lib/include/util/string_utils.h index 90131be4..6d31d5e5 100644 --- a/source/shared_lib/include/util/string_utils.h +++ b/source/shared_lib/include/util/string_utils.h @@ -23,7 +23,7 @@ # include # include # include -#include "types.h" +#include "data_types.h" #ifdef __MINGW32__ typedef unsigned char byte; diff --git a/source/shared_lib/sources/graphics/BMPReader.cpp b/source/shared_lib/sources/graphics/BMPReader.cpp index fa58f985..3bdb8b6e 100644 --- a/source/shared_lib/sources/graphics/BMPReader.cpp +++ b/source/shared_lib/sources/graphics/BMPReader.cpp @@ -10,7 +10,7 @@ // ============================================================== #include "BMPReader.h" -#include "types.h" +#include "data_types.h" #include "pixmap.h" #include #include "util.h" diff --git a/source/shared_lib/sources/graphics/JPGReader.cpp b/source/shared_lib/sources/graphics/JPGReader.cpp index 2c3b13b2..a7fbe0ca 100644 --- a/source/shared_lib/sources/graphics/JPGReader.cpp +++ b/source/shared_lib/sources/graphics/JPGReader.cpp @@ -12,7 +12,7 @@ #include "JPGReader.h" #include "FileReader.h" -#include "types.h" +#include "data_types.h" #include "pixmap.h" #include #include diff --git a/source/shared_lib/sources/graphics/PNGReader.cpp b/source/shared_lib/sources/graphics/PNGReader.cpp index 63a067a5..c71043e0 100644 --- a/source/shared_lib/sources/graphics/PNGReader.cpp +++ b/source/shared_lib/sources/graphics/PNGReader.cpp @@ -11,7 +11,7 @@ #include "PNGReader.h" -#include "types.h" +#include "data_types.h" #include "pixmap.h" #include #include diff --git a/source/shared_lib/sources/graphics/TGAReader.cpp b/source/shared_lib/sources/graphics/TGAReader.cpp index 615936e2..59ce3e1b 100644 --- a/source/shared_lib/sources/graphics/TGAReader.cpp +++ b/source/shared_lib/sources/graphics/TGAReader.cpp @@ -10,7 +10,7 @@ // ============================================================== #include "TGAReader.h" -#include "types.h" +#include "data_types.h" #include "pixmap.h" #include #include diff --git a/source/shared_lib/sources/platform/common/platform_common.cpp b/source/shared_lib/sources/platform/common/platform_common.cpp index d3f42463..ae56fb1e 100644 --- a/source/shared_lib/sources/platform/common/platform_common.cpp +++ b/source/shared_lib/sources/platform/common/platform_common.cpp @@ -6,6 +6,12 @@ //the terms of the GNU General Public License as published by the Free Software //Foundation; either version 2 of the License, or (at your option) any later //version. + +#ifdef WIN32 + #include + #include +#endif + #include "platform_common.h" #include "cache_manager.h" diff --git a/source/shared_lib/sources/platform/posix/socket.cpp b/source/shared_lib/sources/platform/posix/socket.cpp index b393fd59..f0790d7a 100644 --- a/source/shared_lib/sources/platform/posix/socket.cpp +++ b/source/shared_lib/sources/platform/posix/socket.cpp @@ -29,6 +29,7 @@ #ifdef WIN32 #include + #include #include #include #include diff --git a/source/shared_lib/sources/util/leak_dumper.cpp b/source/shared_lib/sources/util/leak_dumper.cpp index 751430ec..c6801972 100644 --- a/source/shared_lib/sources/util/leak_dumper.cpp +++ b/source/shared_lib/sources/util/leak_dumper.cpp @@ -11,6 +11,8 @@ #include "leak_dumper.h" #ifdef SL_LEAK_DUMP +#include "platform_util.h" +#include bool AllocInfo::application_binary_initialized = false; //static AllocRegistry memoryLeaks = AllocRegistry::getInstance(); @@ -30,14 +32,19 @@ AllocRegistry::~AllocRegistry() { void AllocRegistry::dump(const char *path) { #ifdef WIN32 - FILE* f= = _wfopen(utf8_decode(path).c_str(), L"wt"); + FILE* f= _wfopen(utf8_decode(path).c_str(), L"wt"); #else FILE *f= fopen(path, "wt"); #endif int leakCount=0; size_t leakBytes=0; - fprintf(f, "Memory leak dump\n\n"); + time_t debugTime = time(NULL); + struct tm *loctime = localtime (&debugTime); + char szBuf2[100]=""; + strftime(szBuf2,100,"%Y-%m-%d %H:%M:%S",loctime); + + fprintf(f, "Memory leak dump at: %s\n\n",szBuf2); for(int i=0; i #include #include "util.h" -#include "types.h" +#include "data_types.h" #include "properties.h" #include "platform_common.h" #include "platform_util.h"