1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

- game won't crash on missing dwellings (instead random one will generated)

- added disabled code that can be used to fix buildings blit order
- minor fixes
This commit is contained in:
Ivan Savenko 2012-10-07 14:58:48 +00:00
parent b3f317c1ed
commit db10f512d5
4 changed files with 38 additions and 3 deletions

View File

@ -1141,6 +1141,35 @@ void CCastleInterface::keyPressed( const SDL_KeyboardEvent & key )
switch(key.keysym.sym)
{
#if 0 // code that can be used to fix blit order in towns using +/- keys. Quite ugly but works
case SDLK_KP_PLUS :
if (builds->selectedBuilding)
{
OBJ_CONSTRUCTION_CAPTURING_ALL;
CStructure * str = const_cast<CStructure *>(builds->selectedBuilding->str);
str->pos.z++;
delete builds;
builds = new CCastleBuildings(town);
BOOST_FOREACH(const CStructure * str, town->town->clientInfo.structures)
tlog1 << int(str->building->bid) << " -> " << int(str->pos.z) << "\n";
}
break;
case SDLK_KP_MINUS:
if (builds->selectedBuilding)
{
OBJ_CONSTRUCTION_CAPTURING_ALL;
CStructure * str = const_cast<CStructure *>(builds->selectedBuilding->str);
str->pos.z--;
delete builds;
builds = new CCastleBuildings(town);
BOOST_FOREACH(const CStructure * str, town->town->clientInfo.structures)
tlog1 << int(str->building->bid) << " -> " << int(str->pos.z) << "\n";
}
break;
#endif
case SDLK_UP:
townlist->selectPrev();
break;

View File

@ -1386,6 +1386,7 @@ void CRecruitmentWindow::select(CCreatureCard *card)
totalCostValue->createItems(card->creature->cost);
costPerTroopValue->set(card->creature->cost);
totalCostValue->set(card->creature->cost * maxAmount);
//Recruit %s
title->setTxt(boost::str(boost::format(CGI->generaltexth->tcommands[21]) % card->creature->namePl));

View File

@ -636,7 +636,12 @@ std::pair<int,int> CGameState::pickObject (CGObjectInstance *obj)
result = std::pair<int,int>(17, iter.first);
if (result.first == -1)
{
tlog0 << "Error: failed to find creature for dwelling of "<< int(faction) << " of level " << int(level) << "\n";
auto iter = VLC->objh->cregens.begin();
std::advance(iter, ran() % VLC->objh->cregens.size() );
result = std::pair<int, int>(17, iter->first);
}
return result;
}

View File

@ -2506,7 +2506,7 @@ bool CGameHandler::buildStructure( si32 tid, si32 bid, bool force /*=false*/ )
FoWChange fw;
fw.player = t->tempOwner;
fw.mode = 1;
getTilesInRange(fw.tiles,t->pos,t->getSightRadious(),t->tempOwner,1);
t->getSightTiles(fw.tiles);
sendAndApply(&fw);
if (!force)
@ -3815,9 +3815,9 @@ void CGameHandler::playerMessage( ui8 player, const std::string &message )
SetResources sr;
sr.player = player;
sr.res = gs->getPlayer(player)->resources;
for(int i=0;i<7;i++)
for(int i=0;i<Res::GOLD;i++)
sr.res[i] += 100;
sr.res[6] += 19900;
sr.res[Res::GOLD] += 100000; //100k
sendAndApply(&sr);
}
else if(message == "vcmieagles") //reveal FoW