1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Patch from Dikamilo:

* compatibility fixes for MinGW
* Code::Blocks project files
This commit is contained in:
Michał W. Urbańczyk 2009-02-08 15:39:26 +00:00
parent fb4ee65d0e
commit dd36cfce50
9 changed files with 490 additions and 80 deletions

View File

@ -14,7 +14,7 @@ using namespace boost::lambda;
using namespace std;
using namespace GeniusAI;
#if defined (_MSC_VER) && (_MSC_VER >= 1020)
#if defined (_MSC_VER) && (_MSC_VER >= 1020) && (__MINGW32__)
#include <windows.h>
#endif

74
AI/GeniusAI/genius.cbp Normal file
View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="AI" />
<Option platforms="Windows;" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug Win32">
<Option platforms="Windows;" />
<Option output="..\..\..\..\..\Install\Heroes3\AI\GeniusAI" prefix_auto="1" extension_auto="1" />
<Option working_dir="..\..\..\..\..\Install\Heroes3\AI" />
<Option object_output="Debug Win32" />
<Option type="3" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-g" />
<Add option="-O0" />
<Add option="-DWIN32" />
<Add option="-D_DEBUG" />
<Add option="-D_WINDOWS" />
<Add option="-D_USRDLL" />
<Add option="-DGENIUS_EXPORTS" />
</Compiler>
</Target>
<Target title="Release Win32">
<Option platforms="Windows;" />
<Option output="..\..\..\..\..\Install\Heroes3\AI\GeniusAI" prefix_auto="1" extension_auto="1" />
<Option working_dir="..\..\..\..\..\Install\Heroes3\AI" />
<Option object_output="Release Win32" />
<Option type="3" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-fexpensive-optimizations" />
<Add option="-Os" />
<Add option="-O3" />
<Add option="-O2" />
<Add option="-O1" />
<Add option="-O" />
<Add option="-W" />
<Add option="-DWIN32" />
<Add option="-DNDEBUG" />
<Add option="-D_WINDOWS" />
<Add option="-D_USRDLL" />
<Add option="-DGENIUS_EXPORTS" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-D_WIN32" />
<Add directory="$(#boost.include)" />
</Compiler>
<Linker>
<Add library="..\..\..\..\..\Install\Heroes3\libVCMI_lib.a" />
<Add directory="$(#boost.lib)" />
</Linker>
<Unit filename="CGeniusAI.cpp" />
<Unit filename="CGeniusAI.h" />
<Unit filename="DLLMain.cpp" />
<Extensions>
<code_completion />
<envvars />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>

View File

@ -43,6 +43,9 @@
#include "lib/VCMI_Lib.h"
#include <cstdlib>
#if __MINGW32__
#undef main
#endif
std::string NAME = NAME_VER + std::string(" (client)");
DLL_EXPORT void initDLL(CLodHandler *b);
SDL_Surface * screen, * screen2;

View File

@ -27,15 +27,7 @@ bool isItIn(const SDL_Rect * rect, int x, int y)
return true;
else return false;
}
inline SDL_Rect genRect(const int & hh, const int & ww, const int & xx, const int & yy)
{
SDL_Rect ret;
ret.h=hh;
ret.w=ww;
ret.x=xx;
ret.y=yy;
return ret;
}
void blitAtWR(SDL_Surface * src, int x, int y, SDL_Surface * dst)
{
SDL_Rect pom = genRect(src->h,src->w,x,y);
@ -248,16 +240,7 @@ inline void CSDL_Ext::SDL_PutPixel(SDL_Surface *ekran, const int & x, const int
SDL_UpdateRect(ekran, x, y, 1, 1);
}
inline void CSDL_Ext::SDL_PutPixelWithoutRefresh(SDL_Surface *ekran, const int & x, const int & y, const Uint8 & R, const Uint8 & G, const Uint8 & B, Uint8 A)
{
Uint8 *p = (Uint8 *)ekran->pixels + y * ekran->pitch + x * ekran->format->BytesPerPixel;
p[0] = B;
p[1] = G;
p[2] = R;
if(ekran->format->BytesPerPixel==4)
p[3] = A;
}
///**************/
///Reverses the toRot surface by the vertical axis

View File

@ -20,12 +20,32 @@ template <typename T> int getIndexOf(const std::vector<T> & v, const T & val)
return i;
return -1;
}
inline SDL_Rect genRect(const int & hh, const int & ww, const int & xx, const int & yy);
inline SDL_Rect genRect(const int & hh, const int & ww, const int & xx, const int & yy)
{
SDL_Rect ret;
ret.h=hh;
ret.w=ww;
ret.x=xx;
ret.y=yy;
return ret;
}
namespace CSDL_Ext
{
extern SDL_Surface * std32bppSurface;
inline void SDL_PutPixel(SDL_Surface *ekran, const int & x, const int & y, const Uint8 & R, const Uint8 & G, const Uint8 & B, Uint8 A = 255); //myC influences the start of reading pixels
inline void SDL_PutPixelWithoutRefresh(SDL_Surface *ekran, const int & x, const int & y, const Uint8 & R, const Uint8 & G, const Uint8 & B, Uint8 A = 255); //myC influences the start of reading pixels ; without refreshing
//inline void SDL_PutPixelWithoutRefresh(SDL_Surface *ekran, const int & x, const int & y, const Uint8 & R, const Uint8 & G, const Uint8 & B, Uint8 A = 255); //myC influences the start of reading pixels ; without refreshing
inline void SDL_PutPixelWithoutRefresh(SDL_Surface *ekran, const int & x, const int & y, const Uint8 & R, const Uint8 & G, const Uint8 & B, Uint8 A = 255)
{
Uint8 *p = (Uint8 *)ekran->pixels + y * ekran->pitch + x * ekran->format->BytesPerPixel;
p[0] = B;
p[1] = G;
p[2] = R;
if(ekran->format->BytesPerPixel==4)
p[3] = A;
}
SDL_Surface * rotate01(SDL_Surface * toRot); //vertical flip
SDL_Surface * hFlip(SDL_Surface * toRot); //horizontal flip
SDL_Surface * rotate02(SDL_Surface * toRot); //rotate 90 degrees left

142
client/VCMI_client.cbp Normal file
View File

@ -0,0 +1,142 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Client" />
<Option platforms="Windows;" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug Win32">
<Option platforms="Windows;" />
<Option output="..\..\..\..\Install\Heroes3\VCMI_client" prefix_auto="1" extension_auto="1" />
<Option working_dir="..\..\..\..\Install\Heroes3" />
<Option object_output="Debug Win32" />
<Option type="1" />
<Option compiler="gcc" />
<Option use_console_runner="0" />
<Compiler>
<Add option="-g" />
<Add option="-D_DEBUG" />
</Compiler>
</Target>
<Target title="Release Win32">
<Option platforms="Windows;" />
<Option output="..\..\..\..\Install\Heroes3\VCMI_client" prefix_auto="1" extension_auto="1" />
<Option working_dir="..\..\..\..\Install\Heroes3" />
<Option object_output="Release Win32" />
<Option type="1" />
<Option compiler="gcc" />
<Option use_console_runner="0" />
<Compiler>
<Add option="-fexpensive-optimizations" />
<Add option="-Os" />
<Add option="-O3" />
<Add option="-O2" />
<Add option="-O1" />
<Add option="-O" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-D_WIN32" />
<Add option="-D_WIN32_WINDOWS" />
<Add directory="$(#boost.include)" />
<Add directory="$(#sdl.include)" />
<Add directory="$(#zlib.include)" />
</Compiler>
<Linker>
<Add option="-lSDL" />
<Add option="-lSDL_image" />
<Add option="-lSDL_ttf" />
<Add option="-lSDL_mixer" />
<Add option="-lzlib1" />
<Add option="-llibboost_thread-mgw43-mt-1_37" />
<Add option="-llibboost_system-mgw43-mt-1_37" />
<Add option="-llibboost_filesystem-mgw43-mt-1_37" />
<Add library="..\..\..\..\Install\Heroes3\libVCMI_lib.a" />
<Add directory="$(#sdl.lib)" />
<Add directory="$(#boost.lib)" />
<Add directory="$(#zlib.lib)" />
</Linker>
<Unit filename="..\AI_Base.h" />
<Unit filename="..\AdventureMapButton.cpp" />
<Unit filename="..\AdventureMapButton.h" />
<Unit filename="..\CAdvmapInterface.cpp" />
<Unit filename="..\CAdvmapInterface.h" />
<Unit filename="..\CBattleInterface.cpp" />
<Unit filename="..\CBattleInterface.h" />
<Unit filename="..\CCallback.cpp" />
<Unit filename="..\CCallback.h" />
<Unit filename="..\CCastleInterface.cpp" />
<Unit filename="..\CCastleInterface.h" />
<Unit filename="..\CCursorHandler.cpp" />
<Unit filename="..\CCursorHandler.h" />
<Unit filename="..\CGameInfo.cpp" />
<Unit filename="..\CGameInfo.h" />
<Unit filename="..\CGameInterface.cpp" />
<Unit filename="..\CGameInterface.h" />
<Unit filename="..\CHeroWindow.cpp" />
<Unit filename="..\CHeroWindow.h" />
<Unit filename="..\CMT.cpp" />
<Unit filename="..\CMessage.cpp" />
<Unit filename="..\CMessage.h" />
<Unit filename="..\CPathfinder.cpp" />
<Unit filename="..\CPathfinder.h" />
<Unit filename="..\CPlayerInterface.cpp" />
<Unit filename="..\CPlayerInterface.h" />
<Unit filename="..\CPreGame.cpp" />
<Unit filename="..\CPreGame.h" />
<Unit filename="..\CThreadHelper.cpp" />
<Unit filename="..\CThreadHelper.h" />
<Unit filename="..\ChangeLog" />
<Unit filename="..\SDL_Extensions.cpp" />
<Unit filename="..\SDL_Extensions.h" />
<Unit filename="..\SDL_framerate.cpp" />
<Unit filename="..\SDL_framerate.h" />
<Unit filename="..\StartInfo.h" />
<Unit filename="CBitmapHandler.cpp" />
<Unit filename="CBitmapHandler.h" />
<Unit filename="CConfigHandler.cpp" />
<Unit filename="CConfigHandler.h" />
<Unit filename="CCreatureAnimation.cpp" />
<Unit filename="CCreatureAnimation.h" />
<Unit filename="CSpellWindow.cpp" />
<Unit filename="CSpellWindow.h" />
<Unit filename="Client.cpp" />
<Unit filename="Client.h" />
<Unit filename="FunctionList.h" />
<Unit filename="Graphics.cpp" />
<Unit filename="Graphics.h" />
<Unit filename="..\global.h" />
<Unit filename="..\hch\CAbilityHandler.cpp" />
<Unit filename="..\hch\CAbilityHandler.h" />
<Unit filename="..\hch\CAmbarCendamo.h" />
<Unit filename="..\hch\CArtHandler.h" />
<Unit filename="..\hch\CBuildingHandler.h" />
<Unit filename="..\hch\CDefHandler.cpp" />
<Unit filename="..\hch\CDefHandler.h" />
<Unit filename="..\hch\CHeroHandler.h" />
<Unit filename="..\hch\CMusicHandler.cpp" />
<Unit filename="..\hch\CMusicHandler.h" />
<Unit filename="..\hch\CObjectHandler.h" />
<Unit filename="..\hch\CSndHandler.cpp" />
<Unit filename="..\hch\CSndHandler.h" />
<Unit filename="..\int3.h" />
<Unit filename="..\map.h" />
<Unit filename="..\mapHandler.cpp" />
<Unit filename="..\mapHandler.h" />
<Unit filename="..\nodrze.h" />
<Unit filename="..\stdafx.h" />
<Unit filename="..\timeHandler.h" />
<Extensions>
<code_completion />
<envvars />
<debugger />
<lib_finder disable_auto="1" />
</Extensions>
</Project>
</CodeBlocks_project_file>

111
lib/VCMI_lib.cbp Normal file
View File

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Lib" />
<Option platforms="Windows;" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug Win32">
<Option platforms="Windows;" />
<Option output="..\..\..\..\Install\Heroes3\VCMI_lib" prefix_auto="1" extension_auto="1" />
<Option working_dir="..\..\..\..\Install\Heroes3" />
<Option object_output="Debug Win32" />
<Option type="3" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-g" />
<Add option="-D_DEBUG" />
</Compiler>
</Target>
<Target title="Release Win32">
<Option platforms="Windows;" />
<Option output="..\..\..\..\Install\Heroes3\VCMI_lib" prefix_auto="1" extension_auto="1" />
<Option working_dir="..\..\..\..\Install\Heroes3" />
<Option object_output="Release Win32" />
<Option type="3" />
<Option compiler="gcc" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-fexpensive-optimizations" />
<Add option="-Os" />
<Add option="-O3" />
<Add option="-O2" />
<Add option="-O1" />
<Add option="-O" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-std=c++98" />
<Add option="-Wfatal-errors" />
<Add option="-Wextra" />
<Add option="-D_WIN32" />
<Add option="-D_WIN32_WINNT" />
<Add directory="$(#boost.include)" />
<Add directory="$(#sdl.include)" />
<Add directory="$(#zlib.include)" />
</Compiler>
<Linker>
<Add option="-lzlib1" />
<Add option="-llibboost_thread-mgw43-mt-1_37" />
<Add option="-llibboost_system-mgw43-mt-1_37" />
<Add option="-llibboost_filesystem-mgw43-mt-1_37" />
<Add option="-lwsock32" />
<Add option="-lws2_32" />
<Add library="..\..\..\mingw\lib\libws2_32.a" />
<Add directory="$(#boost.lib)" />
<Add directory="$(#sdl.lib)" />
<Add directory="$(#zlib.lib)" />
</Linker>
<Unit filename="..\CConsoleHandler.cpp" />
<Unit filename="..\CConsoleHandler.h" />
<Unit filename="..\CGameState.cpp" />
<Unit filename="..\CGameState.h" />
<Unit filename="..\hch\CArtHandler.cpp" />
<Unit filename="..\hch\CArtHandler.h" />
<Unit filename="..\hch\CBuildingHandler.cpp" />
<Unit filename="..\hch\CBuildingHandler.h" />
<Unit filename="..\hch\CCreatureHandler.cpp" />
<Unit filename="..\hch\CCreatureHandler.h" />
<Unit filename="..\hch\CDefObjInfoHandler.cpp" />
<Unit filename="..\hch\CDefObjInfoHandler.h" />
<Unit filename="..\hch\CGeneralTextHandler.cpp" />
<Unit filename="..\hch\CGeneralTextHandler.h" />
<Unit filename="..\hch\CHeroHandler.cpp" />
<Unit filename="..\hch\CHeroHandler.h" />
<Unit filename="..\hch\CLodHandler.cpp" />
<Unit filename="..\hch\CLodHandler.h" />
<Unit filename="..\hch\CObjectHandler.cpp" />
<Unit filename="..\hch\CObjectHandler.h" />
<Unit filename="..\hch\CSpellHandler.cpp" />
<Unit filename="..\hch\CSpellHandler.h" />
<Unit filename="..\hch\CTownHandler.cpp" />
<Unit filename="..\hch\CTownHandler.h" />
<Unit filename="BattleAction.h" />
<Unit filename="CondSh.h" />
<Unit filename="Connection.cpp" />
<Unit filename="Connection.h" />
<Unit filename="IGameCallback.cpp" />
<Unit filename="IGameCallback.h" />
<Unit filename="Interprocess.h" />
<Unit filename="NetPacks.h" />
<Unit filename="VCMI_Lib.cpp" />
<Unit filename="VCMI_Lib.h" />
<Unit filename="..\map.cpp" />
<Unit filename="..\map.h" />
<Unit filename="..\stdafx.cpp" />
<Extensions>
<code_completion />
<envvars />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>

68
server/VCMI_server.cbp Normal file
View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="Server" />
<Option platforms="Windows;" />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug Win32">
<Option platforms="Windows;" />
<Option output="..\..\..\..\Install\Heroes3\VCMI_server" prefix_auto="1" extension_auto="1" />
<Option working_dir="..\..\..\..\Install\Heroes3" />
<Option object_output="Debug Win32" />
<Option type="1" />
<Option compiler="gcc" />
<Option use_console_runner="0" />
<Compiler>
<Add option="-g" />
</Compiler>
</Target>
<Target title="Release Win32">
<Option platforms="Windows;" />
<Option output="..\..\..\..\Install\Heroes3\VCMI_server" prefix_auto="1" extension_auto="1" />
<Option working_dir="..\..\..\..\Install\Heroes3" />
<Option object_output="Release Win32" />
<Option type="1" />
<Option compiler="gcc" />
<Option use_console_runner="0" />
<Compiler>
<Add option="-fexpensive-optimizations" />
<Add option="-Os" />
<Add option="-O3" />
<Add option="-O2" />
<Add option="-O1" />
<Add option="-O" />
</Compiler>
<Linker>
<Add option="-s" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-D_WIN32" />
<Add directory="$(#zlib.include)" />
<Add directory="$(#boost.include)" />
</Compiler>
<Linker>
<Add option="-llibboost_thread-mgw43-mt-1_37" />
<Add option="-llibboost_system-mgw43-mt-1_37" />
<Add option="-llibboost_filesystem-mgw43-mt-1_37" />
<Add option="-lwsock32" />
<Add option="-lws2_32" />
<Add library="..\..\..\..\Install\Heroes3\libVCMI_lib.a" />
<Add directory="$(#zlib.lib)" />
<Add directory="$(#boost.lib)" />
</Linker>
<Unit filename="CGameHandler.cpp" />
<Unit filename="CGameHandler.h" />
<Unit filename="CVCMIServer.cpp" />
<Unit filename="CVCMIServer.h" />
<Extensions>
<code_completion />
<envvars />
<debugger />
</Extensions>
</Project>
</CodeBlocks_project_file>

9
vcmi.workspace Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_workspace_file>
<Workspace title="VCMI">
<Project filename="client\VCMI_client.cbp" />
<Project filename="server\VCMI_server.cbp" />
<Project filename="lib\VCMI_lib.cbp" active="1" />
<Project filename="AI\GeniusAI\genius.cbp" />
</Workspace>
</CodeBlocks_workspace_file>