1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

* given hero is placed in the town entrance

Wspólne zmiany
* some objects such as river delta won't be blitted "on" hero
* tiles under FoW are inaccessible
* giving random hero on RoE maps
* improved protection against hero duplication
* fixed starting values of primary abilities of random heroes on RoE/AB maps
This commit is contained in:
mateuszb
2008-02-23 19:20:41 +00:00
parent dbf3b8d08e
commit 0c2cf02ca6
9 changed files with 54 additions and 37 deletions

View File

@@ -786,21 +786,21 @@ void CMapHandler::init()
borderAndTerrainBitmapInit();
std::cout<<"\tPreparing FoW, roads, rivers,borders: "<<th.getDif()<<std::endl;
//giving starting hero
for(int i=0;i<PLAYER_LIMIT;i++)
{
if(reader->map.players[i].generateHeroAtMainTown && reader->map.players[i].hasMainTown)
if((reader->map.players[i].generateHeroAtMainTown && reader->map.players[i].hasMainTown) || (reader->map.players[i].hasMainTown && reader->map.version==RoE))
{
int3 hpos = reader->map.players[i].posOfMainTown;
hpos.x+=1; hpos.y+=1;
hpos.x+=1;// hpos.y+=1;
int j;
for(j=0;j<CGI->scenarioOps.playerInfos.size();j++)
if(CGI->scenarioOps.playerInfos[j].color==i)
break;
if(j==CGI->scenarioOps.playerInfos.size())
continue;
int h = CGI->scenarioOps.playerInfos[j].hero;
if(h<0)
int h; //= CGI->scenarioOps.playerInfos[j].hero;
//if(h<0)
h=pickHero(i);
CGHeroInstance * nnn = (CGHeroInstance*)createObject(34,h,hpos,i);
nnn->defInfo->handler = CGI->heroh->flags1[0];
@@ -808,6 +808,7 @@ void CMapHandler::init()
CGI->objh->objInstances.push_back(nnn);
}
}
std::cout<<"\tGiving starting heroes: "<<th.getDif()<<std::endl;
initObjectRects();
std::cout<<"\tMaking object rects: "<<th.getDif()<<std::endl;
@@ -1371,6 +1372,7 @@ CGObjectInstance * CMapHandler::createObject(int id, int subid, int3 pos, int ow
nobj->defInfo = new CGDefInfo();
nobj->defInfo->id = 34;
nobj->defInfo->subid = subid;
nobj->defInfo->printPriority = 0;
nobj->type = CGI->heroh->heroes[subid];
for(int i=0;i<6;i++)
{