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