From c925665d31d025c2315a318bd3c6ff9e1db72cfb Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Tue, 16 Mar 2010 21:44:22 +0000 Subject: [PATCH] Bugfix for multiplayer binary and data checksum checking. --- source/glest_game/game/game_constants.h | 59 +++++++++++++++++++++++++ source/glest_game/global/config.cpp | 48 ++++++++++++++++++++ source/glest_game/global/config.h | 4 ++ 3 files changed, 111 insertions(+) create mode 100644 source/glest_game/game/game_constants.h diff --git a/source/glest_game/game/game_constants.h b/source/glest_game/game/game_constants.h new file mode 100644 index 000000000..04e00f2bc --- /dev/null +++ b/source/glest_game/game/game_constants.h @@ -0,0 +1,59 @@ +#ifndef _GLEST_GAME_GAMECONSTANTS_H_ +#define _GLEST_GAME_GAMECONSTANTS_H_ + +// ============================================================== +// 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 +// ============================================================== + +namespace Glest{ namespace Game{ + +// ===================================================== +// class GameConstants +// ===================================================== + +enum ControlType{ + ctClosed, + ctCpuEasy, + ctCpu, + ctCpuUltra, + ctCpuMega, + ctNetwork, + ctHuman +}; + +class GameConstants { +public: + static const int maxPlayers= 8; + static const int serverPort= 61357; + static const int updateFps= 40; + static const int cameraFps= 100; + static const int networkFramePeriod= 10; + static const int networkExtraLatency= 200; + + static const char *folder_path_maps; + static const char *folder_path_scenarios; + static const char *folder_path_techs; + static const char *folder_path_tilesets; + static const char *folder_path_tutorials; +}; + +enum PathType { + ptMaps, + ptScenarios, + ptTechs, + ptTilesets, + ptTutorials +}; + + + +}}//end namespace + +#endif diff --git a/source/glest_game/global/config.cpp b/source/glest_game/global/config.cpp index bff0409d7..6afb31d88 100644 --- a/source/glest_game/global/config.cpp +++ b/source/glest_game/global/config.cpp @@ -14,9 +14,18 @@ #include "util.h" #include "leak_dumper.h" +#include "game_constants.h" namespace Glest{ namespace Game{ + +const char *GameConstants::folder_path_maps = "maps"; +const char *GameConstants::folder_path_scenarios = "scenarios"; +const char *GameConstants::folder_path_techs = "techs"; +const char *GameConstants::folder_path_tilesets = "tilesets"; +const char *GameConstants::folder_path_tutorials = "tutorials"; + + // ===================================================== // class Config // ===================================================== @@ -86,4 +95,43 @@ string Config::toString(){ return properties.toString(); } +vector Config::getPathListForType(PathType type) { + vector pathList; + + switch(type) { + case ptMaps: + pathList.push_back(GameConstants::folder_path_maps); + if(getString("UserData_Maps","") != "") { + pathList.push_back(getString("UserData_Maps")); + } + break; + case ptScenarios: + pathList.push_back(GameConstants::folder_path_scenarios); + if(getString("UserData_Scenarios","") != "") { + pathList.push_back(getString("UserData_Scenarios")); + } + break; + case ptTechs: + pathList.push_back(GameConstants::folder_path_techs); + if(getString("UserData_Techs","") != "") { + pathList.push_back(getString("UserData_Techs")); + } + break; + case ptTilesets: + pathList.push_back(GameConstants::folder_path_tilesets); + if(getString("UserData_Tilesets","") != "") { + pathList.push_back(getString("UserData_Tilesets")); + } + break; + case ptTutorials: + pathList.push_back(GameConstants::folder_path_tutorials); + if(getString("UserData_Tutorials","") != "") { + pathList.push_back(getString("UserData_Tutorials")); + } + break; + } + + return pathList; +} + }}// end namespace diff --git a/source/glest_game/global/config.h b/source/glest_game/global/config.h index 9e1330e67..fcbd4d2c1 100644 --- a/source/glest_game/global/config.h +++ b/source/glest_game/global/config.h @@ -13,6 +13,8 @@ #define _GLEST_GAME_CONFIG_H_ #include "properties.h" +#include +#include "game_constants.h" namespace Glest{ namespace Game{ @@ -50,6 +52,8 @@ public: void setFloat(const string &key, float value); void setString(const string &key, const string &value); + vector getPathListForType(PathType type); + string toString(); };