fb5035c230
- network fixes for multiplayer defects found - initial code (disabled currently) for content crc checking and downloading - code compiles on Win32 using VS2008 express, project files not yet included
132 lines
5.2 KiB
C++
132 lines
5.2 KiB
C++
// ==============================================================
|
|
// 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
|
|
// ==============================================================
|
|
|
|
#ifndef _GLEST_GAME_GAMESETTINGS_H_
|
|
#define _GLEST_GAME_GAMESETTINGS_H_
|
|
|
|
#include "game_constants.h"
|
|
|
|
namespace Glest{ namespace Game{
|
|
|
|
// =====================================================
|
|
// class GameSettings
|
|
// =====================================================
|
|
|
|
class GameSettings{
|
|
private:
|
|
string description;
|
|
string map;
|
|
string tileset;
|
|
string tech;
|
|
string scenario;
|
|
string scenarioDir;
|
|
string factionTypeNames[GameConstants::maxPlayers]; //faction names
|
|
|
|
ControlType factionControls[GameConstants::maxPlayers];
|
|
|
|
int thisFactionIndex;
|
|
int factionCount;
|
|
int teams[GameConstants::maxPlayers];
|
|
int startLocationIndex[GameConstants::maxPlayers];
|
|
|
|
bool defaultUnits;
|
|
bool defaultResources;
|
|
bool defaultVictoryConditions;
|
|
|
|
void CopyAll(const GameSettings &game)
|
|
{
|
|
description = game.description;
|
|
map = game.map;
|
|
tileset = game.tileset;
|
|
tech = game.tech;
|
|
scenario = game.scenario;
|
|
scenarioDir = game.scenarioDir;
|
|
thisFactionIndex = game.thisFactionIndex;
|
|
factionCount = game.factionCount;
|
|
defaultUnits = game.defaultUnits;
|
|
defaultResources = game.defaultResources;
|
|
defaultVictoryConditions = game.defaultVictoryConditions;
|
|
|
|
for(int i = 0; i < GameConstants::maxPlayers; i++)
|
|
{
|
|
factionTypeNames[i] = game.factionTypeNames[i]; //faction names
|
|
factionControls[i] = game.factionControls[i];
|
|
teams[i] = game.teams[i];
|
|
startLocationIndex[i] = game.startLocationIndex[i];
|
|
}
|
|
|
|
//if(Socket::enableDebugText) printf("In [%s::%s] gameSettings->getTileset() = [%s]\n",__FILE__,__FUNCTION__,getTileset().c_str());
|
|
//if(Socket::enableDebugText) printf("In [%s::%s] gameSettings->getTech() = [%s]\n",__FILE__,__FUNCTION__,getTech().c_str());
|
|
//if(Socket::enableDebugText) printf("In [%s::%s] gameSettings->getMap() = [%s]\n",__FILE__,__FUNCTION__,getMap().c_str());
|
|
|
|
}
|
|
|
|
public:
|
|
|
|
|
|
GameSettings() { }
|
|
|
|
GameSettings(const GameSettings &game)
|
|
{
|
|
CopyAll(game);
|
|
}
|
|
|
|
GameSettings & operator=(const GameSettings &game)
|
|
{
|
|
CopyAll(game);
|
|
return *this;
|
|
}
|
|
|
|
//get
|
|
const string &getDescription() const {return description;}
|
|
const string &getMap() const {return map;}
|
|
const string &getTileset() const {return tileset;}
|
|
const string &getTech() const {return tech;}
|
|
const string &getScenario() const {return scenario;}
|
|
const string &getScenarioDir() const {return scenarioDir;}
|
|
const string &getFactionTypeName(int factionIndex) const {return factionTypeNames[factionIndex];}
|
|
ControlType getFactionControl(int factionIndex) const {return factionControls[factionIndex];}
|
|
|
|
int getThisFactionIndex() const {return thisFactionIndex;}
|
|
int getFactionCount() const {return factionCount;}
|
|
int getTeam(int factionIndex) const {return teams[factionIndex];}
|
|
int getStartLocationIndex(int factionIndex) const {return startLocationIndex[factionIndex];}
|
|
|
|
bool getDefaultUnits() const {return defaultUnits;}
|
|
bool getDefaultResources() const {return defaultResources;}
|
|
bool getDefaultVictoryConditions() const {return defaultVictoryConditions;}
|
|
|
|
//set
|
|
void setDescription(const string& description) {this->description= description;}
|
|
void setMap(const string& map) {this->map= map;}
|
|
void setTileset(const string& tileset) {this->tileset= tileset;}
|
|
void setTech(const string& tech) {this->tech= tech;}
|
|
void setScenario(const string& scenario) {this->scenario= scenario;}
|
|
void setScenarioDir(const string& scenarioDir) {this->scenarioDir= scenarioDir;}
|
|
|
|
void setFactionTypeName(int factionIndex, const string& factionTypeName) {this->factionTypeNames[factionIndex]= factionTypeName;}
|
|
|
|
void setFactionControl(int factionIndex, ControlType controller) {this->factionControls[factionIndex]= controller;}
|
|
|
|
void setThisFactionIndex(int thisFactionIndex) {this->thisFactionIndex= thisFactionIndex;}
|
|
void setFactionCount(int factionCount) {this->factionCount= factionCount;}
|
|
void setTeam(int factionIndex, int team) {this->teams[factionIndex]= team;}
|
|
void setStartLocationIndex(int factionIndex, int startLocationIndex) {this->startLocationIndex[factionIndex]= startLocationIndex;}
|
|
|
|
void setDefaultUnits(bool defaultUnits) {this->defaultUnits= defaultUnits;}
|
|
void setDefaultResources(bool defaultResources) {this->defaultResources= defaultResources;}
|
|
void setDefaultVictoryConditions(bool defaultVictoryConditions) {this->defaultVictoryConditions= defaultVictoryConditions;}
|
|
};
|
|
|
|
}}//end namespace
|
|
|
|
#endif
|