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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user