1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-07 23:33:15 +02:00

Infowindows for enemy towns.

This commit is contained in:
Michał W. Urbańczyk
2009-07-20 02:56:35 +00:00
parent c9cac18482
commit fbd496b756
5 changed files with 142 additions and 30 deletions

View File

@@ -546,16 +546,29 @@ void CTerrainRect::clickRight(tribool down)
}
case TOWNI_TYPE:
{
if(!vstd::contains(graphics->townWins,obj->id))
if(!vstd::contains(graphics->townWins,obj->id) || obj->tempOwner != LOCPLINT->playerID)
{
tlog3 << "Warning - no infowin for town " << obj->id << std::endl;
break;
InfoAboutTown iah;
if(LOCPLINT->cb->getTownInfo(obj, iah))
{
SDL_Surface *iwin = graphics->drawTownInfoWin(iah);
CInfoPopup * ip = new CInfoPopup(iwin, LOCPLINT->current->motion.x-iwin->w,
LOCPLINT->current->motion.y-iwin->h, true);
LOCPLINT->pushInt(ip);
}
else
{
tlog3 << "Warning - no infowin for town " << obj->id << std::endl;
}
}
else
{
CInfoPopup * ip = new CInfoPopup(graphics->townWins[obj->id],
LOCPLINT->current->motion.x-graphics->townWins[obj->id]->w,
LOCPLINT->current->motion.y-graphics->townWins[obj->id]->h,false
);
LOCPLINT->pushInt(ip);
}
CInfoPopup * ip = new CInfoPopup(graphics->townWins[obj->id],
LOCPLINT->current->motion.x-graphics->townWins[obj->id]->w,
LOCPLINT->current->motion.y-graphics->townWins[obj->id]->h,false
);
LOCPLINT->pushInt(ip);
break;
}
default: