1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-03 00:46:55 +02:00

More AI changes. Minor associated fixes.

This commit is contained in:
Trevor Standley
2009-08-05 09:46:55 +00:00
parent ebb964a7ab
commit 48581962ab
6 changed files with 249 additions and 104 deletions

View File

@ -1581,7 +1581,10 @@ int CGameState::canBuildStructure( const CGTownInstance *t, int ID )
int ret = 7; //allowed by default
//checking resources
CBuilding * pom = VLC->buildh->buildings[t->subID][ID];
if(!pom)return 8;
if(pom->Name().size()==0||pom->resources.size()==0)return 2;//TODO: why does this happen?
for(int res=0;res<pom->resources.size();res++) //TODO: support custom amount of resources
{
if(pom->resources[res] > getPlayer(t->tempOwner)->resources[res])