1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-29 00:41:38 +02:00

Obtaining town instance pointer via cb. Plz, don't access gamestate directly from player interface! Everything has to go via callback.

Commented out giving starting artifact - new artifact randomization make it crashing. Please fix it.

New control - CTextBox - for multi-line text with optional slider. Used it for map description and info windows. Related changes. Fixes #22 and #96.
This commit is contained in:
Michał W. Urbańczyk
2010-07-06 02:10:26 +00:00
parent e4fcfd7044
commit d0ff61807d
22 changed files with 568 additions and 390 deletions

View File

@ -1444,24 +1444,26 @@ void CGameState::init( StartInfo * si, ui32 checksum, int Seed )
}
case bartifact:
{
if(!k->second.heroes.size())
{
tlog5 << "Cannot give starting artifact - no heroes!" << std::endl;
break;
}
CArtifact *toGive;
do
{
toGive = VLC->arth->treasures[ran() % VLC->arth->treasures.size()];
} while (!map->allowedArtifact[toGive->id]);
CGHeroInstance *hero = k->second.heroes[0];
std::vector<ui16>::iterator slot = vstd::findFirstNot(hero->artifWorn,toGive->possibleSlots);
if(slot!=toGive->possibleSlots.end())
{
VLC->arth->equipArtifact(hero->artifWorn, *slot, toGive->id, &hero->bonuses);
}
else
hero->giveArtifact(toGive->id);
//TODO: FIX IT!
// if(!k->second.heroes.size())
// {
// tlog5 << "Cannot give starting artifact - no heroes!" << std::endl;
// break;
// }
// CArtifact *toGive;
// do
// {
// toGive = VLC->arth->treasures[ran() % VLC->arth->treasures.size()];
// } while (!map->allowedArtifact[toGive->id]);
// CGHeroInstance *hero = k->second.heroes[0];
// std::vector<ui16>::iterator slot = vstd::findFirstNot(hero->artifWorn,toGive->possibleSlots);
// if(slot!=toGive->possibleSlots.end())
// {
// VLC->arth->equipArtifact(hero->artifWorn, *slot, toGive->id, &hero->bonuses);
// }
// else
// hero->giveArtifact(toGive->id);
}
}
}