1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

* CGameInterface.h/.cpp moved from client project to lib (and, appropriately, to lib subfolder).

* New files in lib: ResourceSet.h/.cpp -> containing new structure for managing resources logic
* Minor changes and fixes
This commit is contained in:
Michał W. Urbańczyk
2011-07-05 06:14:07 +00:00
parent 08b7d0db17
commit b3234e8bfa
28 changed files with 490 additions and 191 deletions

View File

@@ -157,14 +157,17 @@ bool CCallback::assembleArtifacts (const CGHeroInstance * hero, ui16 artifactSlo
bool CCallback::buildBuilding(const CGTownInstance *town, si32 buildingID)
{
CGTownInstance * t = const_cast<CGTownInstance *>(town);
//CGTownInstance * t = const_cast<CGTownInstance *>(town);
if(town->tempOwner!=player)
return false;
const CBuilding *b = CGI->buildh->buildings[t->subID][buildingID];
for(int i=0;i<b->resources.size();i++)
if(b->resources[i] > gs->players[player].resources[i])
return false; //lack of resources
if(!canBuildStructure(town, buildingID))
return false;
// const CBuilding *b = CGI->buildh->buildings[t->subID][buildingID];
// for(int i=0;i<b->resources.size();i++)
// if(b->resources[i] > gs->players[player].resources[i])
// return false; //lack of resources
BuildStructure pack(town->id,buildingID);
sendRequest(&pack);