mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
Added GameSettings to gamestate, potentially allowing to define game
settings per map (or in random map template)
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
#include "texts/CGeneralTextHandler.h"
|
||||
#include "StartInfo.h" // for StartInfo
|
||||
#include "battle/BattleInfo.h" // for BattleInfo
|
||||
#include "GameSettings.h"
|
||||
#include "IGameSettings.h"
|
||||
#include "TerrainHandler.h"
|
||||
#include "spells/CSpellHandler.h"
|
||||
#include "mapping/CMap.h"
|
||||
@@ -274,6 +274,11 @@ bool CGameInfoCallback::getTownInfo(const CGObjectInstance * town, InfoAboutTown
|
||||
return true;
|
||||
}
|
||||
|
||||
const IGameSettings & CGameInfoCallback::getSettings() const
|
||||
{
|
||||
return gs->getSettings();
|
||||
}
|
||||
|
||||
int3 CGameInfoCallback::guardingCreaturePosition (int3 pos) const //FIXME: redundant?
|
||||
{
|
||||
ERROR_RET_VAL_IF(!isVisible(pos), "Tile is not visible!", int3(-1,-1,-1));
|
||||
@@ -626,7 +631,7 @@ EBuildingState CGameInfoCallback::canBuildStructure( const CGTownInstance *t, Bu
|
||||
if (!t->genBuildingRequirements(ID).test(buildTest))
|
||||
return EBuildingState::PREREQUIRES;
|
||||
|
||||
if(t->built >= VLC->settings()->getInteger(EGameSettings::TOWNS_BUILDINGS_PER_TURN_CAP))
|
||||
if(t->built >= getSettings().getInteger(EGameSettings::TOWNS_BUILDINGS_PER_TURN_CAP))
|
||||
return EBuildingState::CANT_BUILD_TODAY; //building limit
|
||||
|
||||
//checking resources
|
||||
|
||||
Reference in New Issue
Block a user