From 9cfa09c076bcf412a605ed89790a912c3363f402 Mon Sep 17 00:00:00 2001 From: Vadim Glazunov Date: Wed, 19 Nov 2008 07:55:17 +0000 Subject: [PATCH] Some gcc fixups. Automake project updates --- CPathfinder.cpp | 8 +-- CPlayerInterface.h | 4 ++ client/Makefile.am | 4 +- lib/Connection.h | 134 ++++++++++++++++++++++----------------------- 4 files changed, 78 insertions(+), 72 deletions(-) diff --git a/CPathfinder.cpp b/CPathfinder.cpp index ecd89aad5..bf0a44078 100644 --- a/CPathfinder.cpp +++ b/CPathfinder.cpp @@ -37,7 +37,7 @@ CPath * CPathfinder::getPath(int3 src, int3 dest, const CGHeroInstance * hero, u tribool blockLandSea; //true - blocks sea, false - blocks land, indeterminate - allows all if (!hero->canWalkOnSea()) { - if (CGI->mh->ttiles[hpos.x][hpos.y][hpos.z].tileInfo->tertype==EterrainType::water) + if (CGI->mh->ttiles[hpos.x][hpos.y][hpos.z].tileInfo->tertype==water) blockLandSea=false; else blockLandSea=true; @@ -63,11 +63,11 @@ CPath * CPathfinder::getPath(int3 src, int3 dest, const CGHeroInstance * hero, u graph[i][j].coord.x = i; graph[i][j].coord.y = j; graph[i][j].coord.z = dest.z; - if (CGI->mh->ttiles[i][j][src.z].tileInfo->tertype==EterrainType::rock) + if (CGI->mh->ttiles[i][j][src.z].tileInfo->tertype==rock) graph[i][j].accesible = false; - if ((blockLandSea) && (CGI->mh->ttiles[i][j][src.z].tileInfo->tertype==EterrainType::water)) + if ((blockLandSea) && (CGI->mh->ttiles[i][j][src.z].tileInfo->tertype==water)) graph[i][j].accesible = false; - else if ((!blockLandSea) && (CGI->mh->ttiles[i][j][src.z].tileInfo->tertype!=EterrainType::water)) + else if ((!blockLandSea) && (CGI->mh->ttiles[i][j][src.z].tileInfo->tertype!=water)) graph[i][j].accesible = false; if(graph[i][j].accesible) graph[i][j].accesible = CGI->state->players[hero->tempOwner].fogOfWarMap[i][j][src.z]; diff --git a/CPlayerInterface.h b/CPlayerInterface.h index f58fafeea..9baf0f1e0 100644 --- a/CPlayerInterface.h +++ b/CPlayerInterface.h @@ -6,6 +6,10 @@ #include #include +#ifdef __GNUC__ +#define sprintf_s snprintf +#endif + class CDefEssential; class AdventureMapButton; class CHighlightableButtonsGroup; diff --git a/client/Makefile.am b/client/Makefile.am index 725ba3a72..8272cb20d 100644 --- a/client/Makefile.am +++ b/client/Makefile.am @@ -36,6 +36,7 @@ vcmiclient_SOURCES = \ ../mapHandler.cpp \ ../SDL_Extensions.cpp \ ../SDL_framerate.cpp \ +./CConfigHandler.cpp \ ./CSpellWindow.cpp \ ../AdventureMapButton.h \ ../AI_Base.h \ @@ -79,4 +80,5 @@ vcmiclient_SOURCES = \ ../StartInfo.h \ ../stdafx.h \ ../timeHandler.h \ -./CSpellWindow.h +./CSpellWindow.h \ +./CConfigHandler.h diff --git a/lib/Connection.h b/lib/Connection.h index 11fc75f9e..8ec1a730a 100644 --- a/lib/Connection.h +++ b/lib/Connection.h @@ -49,6 +49,72 @@ enum SerializationLvl Serializable }; +template +struct SavePrimitive +{ + static void invoke(Ser &s, const T &data) + { + s.savePrimitive(data); + } +}; +template +struct SaveSerializable +{ + static void invoke(Ser &s, const T &data) + { + s.saveSerializable(data); + } +}; +template +struct LoadPrimitive +{ + static void invoke(Ser &s, T &data) + { + s.loadPrimitive(data); + } +}; +template +struct SavePointer +{ + static void invoke(Ser &s, const T &data) + { + s.savePointer(data); + } +}; +template +struct LoadPointer +{ + static void invoke(Ser &s, T &data) + { + s.loadPointer(data); + } +}; +template +struct LoadSerializable +{ + static void invoke(Ser &s, T &data) + { + s.loadSerializable(data); + } +}; + +template +struct SaveWrong +{ + static void invoke(Ser &s, const T &data) + { + throw std::exception("Wrong save serialization call!"); + } +}; +template +struct LoadWrong +{ + static void invoke(Ser &s, const T &data) + { + throw std::exception("Wrong load serialization call!"); + } +}; + template struct SerializationLevel { @@ -288,72 +354,6 @@ public: }; -template -struct SavePrimitive -{ - static void invoke(Ser &s, const T &data) - { - s.savePrimitive(data); - } -}; -template -struct SaveSerializable -{ - static void invoke(Ser &s, const T &data) - { - s.saveSerializable(data); - } -}; -template -struct LoadPrimitive -{ - static void invoke(Ser &s, T &data) - { - s.loadPrimitive(data); - } -}; -template -struct SavePointer -{ - static void invoke(Ser &s, const T &data) - { - s.savePointer(data); - } -}; -template -struct LoadPointer -{ - static void invoke(Ser &s, T &data) - { - s.loadPointer(data); - } -}; -template -struct LoadSerializable -{ - static void invoke(Ser &s, T &data) - { - s.loadSerializable(data); - } -}; - -template -struct SaveWrong -{ - static void invoke(Ser &s, const T &data) - { - throw std::exception("Wrong save serialization call!"); - } -}; -template -struct LoadWrong -{ - static void invoke(Ser &s, const T &data) - { - throw std::exception("Wrong load serialization call!"); - } -}; - class DLL_EXPORT CSaveFile : public COSer @@ -397,4 +397,4 @@ public: int readLine(void * data, unsigned maxSize); void close(); ~CConnection(void); -}; \ No newline at end of file +};