1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-01 23:12:49 +02:00
Minor changes.
This commit is contained in:
Michał W. Urbańczyk
2010-07-13 05:25:40 +00:00
parent 70bfd7ceb7
commit 88e1636250
15 changed files with 249 additions and 221 deletions

View File

@@ -1804,17 +1804,20 @@ void CAdvMapInt::tileLClicked(const int3 &mp)
if(currentHero == topBlocking) //clicked selected hero
{
LOCPLINT->openHeroWindow(currentHero);
return;
}
else if(topBlocking && (topBlocking->ID == HEROI_TYPE || topBlocking->ID == TOWNI_TYPE) //clicked our town or hero
&& pn->turns == 255 && topBlocking->tempOwner == LOCPLINT->playerID) //at inaccessible tile
{
select(static_cast<const CArmedInstance*>(topBlocking), false);
return;
}
else //still here? we need to move hero if we clicked end of already selected path or calculate a new path otherwise
{
if (terrain.currentPath && terrain.currentPath->endPos() == mp)//we'll be moving
{
LOCPLINT->moveHero(currentHero,*terrain.currentPath);
return;
}
else if(mp.z == currentHero->pos.z) //remove old path and find a new one if we clicked on the map level on which hero is present
{
@@ -1822,6 +1825,8 @@ void CAdvMapInt::tileLClicked(const int3 &mp)
terrain.currentPath = &path;
if(!LOCPLINT->cb->getPath2(mp, path)) //try getting path, erase if failed
LOCPLINT->eraseCurrentPathOf(currentHero);
else
return;
}
}
} //end of hero is selected "case"
@@ -1829,6 +1834,11 @@ void CAdvMapInt::tileLClicked(const int3 &mp)
{
throw std::string("Nothing is selected...");
}
if(const IShipyard *shipyard = ourInaccessibleShipyard(topBlocking))
{
LOCPLINT->showShipyardDialogOrProblemPopup(shipyard);
}
}
void CAdvMapInt::tileHovered(const int3 &tile)
@@ -2006,6 +2016,11 @@ void CAdvMapInt::tileHovered(const int3 &tile)
CGI->curh->changeGraphic(0, 0);
}
}
if(const IShipyard *shipyard = ourInaccessibleShipyard(objAtTile))
{
CGI->curh->changeGraphic(0, 6);
}
}
void CAdvMapInt::tileRClicked(const int3 &mp)
@@ -2075,6 +2090,16 @@ const CGTownInstance * CAdvMapInt::curTown() const
return NULL;
}
const IShipyard * CAdvMapInt::ourInaccessibleShipyard(const CGObjectInstance *obj) const
{
const IShipyard *ret = IShipyard::castFrom(obj);
if(!ret || obj->tempOwner != player || CGI->curh->mode || (CGI->curh->number != 6 && CGI->curh->number != 0))
return NULL;
return ret;
}
CAdventureOptions::CAdventureOptions()
{
OBJ_CONSTRUCTION_CAPTURING_ALL;