mirror of
https://github.com/glest/glest-source.git
synced 2025-09-02 20:42:34 +02:00
Bugfix for multiplayer binary and data checksum checking.
This commit is contained in:
59
source/glest_game/game/game_constants.h
Normal file
59
source/glest_game/game/game_constants.h
Normal file
@@ -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<74>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
|
@@ -14,9 +14,18 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#include "leak_dumper.h"
|
#include "leak_dumper.h"
|
||||||
|
#include "game_constants.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
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
|
// class Config
|
||||||
// =====================================================
|
// =====================================================
|
||||||
@@ -86,4 +95,43 @@ string Config::toString(){
|
|||||||
return properties.toString();
|
return properties.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vector<string> Config::getPathListForType(PathType type) {
|
||||||
|
vector<string> 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
|
}}// end namespace
|
||||||
|
@@ -13,6 +13,8 @@
|
|||||||
#define _GLEST_GAME_CONFIG_H_
|
#define _GLEST_GAME_CONFIG_H_
|
||||||
|
|
||||||
#include "properties.h"
|
#include "properties.h"
|
||||||
|
#include <vector>
|
||||||
|
#include "game_constants.h"
|
||||||
|
|
||||||
namespace Glest{ namespace Game{
|
namespace Glest{ namespace Game{
|
||||||
|
|
||||||
@@ -50,6 +52,8 @@ public:
|
|||||||
void setFloat(const string &key, float value);
|
void setFloat(const string &key, float value);
|
||||||
void setString(const string &key, const string &value);
|
void setString(const string &key, const string &value);
|
||||||
|
|
||||||
|
vector<string> getPathListForType(PathType type);
|
||||||
|
|
||||||
string toString();
|
string toString();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user