mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
* improved slider ( #58 )
* fixed problems with horde buildings (won't block original dwellings) * giving primary skill when hero get level (but there is still no dialog) * if an upgraded creature is available it'll be shown as the first in a recruitment window * creature levels not messed in Fortress * war machines are added to the hero's inventory, not to the garrison * support for H3-style PCX graphics in Data/ (not tested) * started doing support for ZSoft PCX graphics in Data/ * VCMI won't crash when is unable to initialize audio system * fixed displaying wrong town defs * minor fixes and improvements
This commit is contained in:
45
CMT.cpp
45
CMT.cpp
@@ -152,26 +152,33 @@ void initGameState(CGameInfo * cgi)
|
||||
vhi->portrait = vhi->type->ID;
|
||||
|
||||
//initial army
|
||||
if (!vhi->army.slots.size())
|
||||
if (!vhi->army.slots.size()) //standard army
|
||||
{
|
||||
int pom;
|
||||
vhi->army.slots[0].first = &(cgi->creh->creatures[(cgi->creh->nameToID[vhi->type->refType1stack])]);
|
||||
if((pom = (vhi->type->high1stack-vhi->type->low1stack)) > 0)
|
||||
vhi->army.slots[0].second = (rand()%pom)+vhi->type->low1stack;
|
||||
else
|
||||
vhi->army.slots[0].second = +vhi->type->low1stack;
|
||||
|
||||
vhi->army.slots[1].first = &(cgi->creh->creatures[(cgi->creh->nameToID[vhi->type->refType2stack])]);
|
||||
if((pom=(vhi->type->high2stack-vhi->type->low2stack))>0)
|
||||
vhi->army.slots[1].second = (rand()%pom)+vhi->type->low2stack;
|
||||
else
|
||||
vhi->army.slots[1].second = vhi->type->low2stack;
|
||||
|
||||
vhi->army.slots[2].first = &(cgi->creh->creatures[(cgi->creh->nameToID[vhi->type->refType3stack])]);
|
||||
if((pom=(vhi->type->high3stack-vhi->type->low3stack))>0)
|
||||
vhi->army.slots[2].second = (rand()%pom)+vhi->type->low3stack;
|
||||
else
|
||||
vhi->army.slots[2].second = vhi->type->low3stack;
|
||||
int pom, pom2=0;
|
||||
for(int x=0;x<3;x++)
|
||||
{
|
||||
pom = (cgi->creh->nameToID[vhi->type->refTypeStack[x]]);
|
||||
if(pom>=145 && pom<=149) //war machine
|
||||
{
|
||||
pom2++;
|
||||
switch (pom)
|
||||
{
|
||||
case 145: //catapult
|
||||
vhi->artifWorn[16] = &CGI->arth->artifacts[3];
|
||||
break;
|
||||
default:
|
||||
pom-=145;
|
||||
vhi->artifWorn[13+pom] = &CGI->arth->artifacts[4+pom];
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
vhi->army.slots[x-pom2].first = &(cgi->creh->creatures[pom]);
|
||||
if((pom = (vhi->type->highStack[x]-vhi->type->lowStack[x])) > 0)
|
||||
vhi->army.slots[x-pom2].second = (rand()%pom)+vhi->type->lowStack[x];
|
||||
else
|
||||
vhi->army.slots[x-pom2].second = +vhi->type->lowStack[x];
|
||||
}
|
||||
}
|
||||
|
||||
cgi->state->players[vhi->getOwner()].heroes.push_back(vhi);
|
||||
|
||||
Reference in New Issue
Block a user