1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

* Movement cursor shown for unguarded enemy towns.

* Battle cursor shown for guarded enemy garrisons.
This commit is contained in:
OnionKnight
2009-10-02 15:50:22 +00:00
parent 4c458a7e47
commit 7f5f939f4f

View File

@@ -740,11 +740,19 @@ void CTerrainRect::mouseMoved (const SDL_MouseMotionEvent & sEvent)
{
if(obj->tempOwner != LOCPLINT->playerID) //enemy town TODO: allies
{
if(accessible)
CGI->curh->changeGraphic(0, 5 + turns*6);
if(accessible) {
const CGTownInstance* townObj = dynamic_cast<const CGTownInstance*>(obj);
// Show movement cursor for unguarded enemy towns, otherwise attack cursor.
if (townObj && townObj->army.slots.empty())
CGI->curh->changeGraphic(0, 9 + turns*6);
else
CGI->curh->changeGraphic(0, 5 + turns*6);
} else {
CGI->curh->changeGraphic(0, 0);
}
}
else //our town
{
if(accessible)
@@ -767,6 +775,25 @@ void CTerrainRect::mouseMoved (const SDL_MouseMotionEvent & sEvent)
else
CGI->curh->changeGraphic(0, 0);
}
else if (obj->ID == 33 || obj->ID == 219) // Garrison
{
if (accessible) {
const CGGarrison* garrObj = dynamic_cast<const CGGarrison*>(obj);
// Show battle cursor for guarded enemy garrisons, otherwise movement cursor.
if (garrObj && garrObj->tempOwner != LOCPLINT->playerID
&& !garrObj->army.slots.empty())
{
CGI->curh->changeGraphic(0, 5 + turns*6);
}
else
{
CGI->curh->changeGraphic(0, 9 + turns*6);
}
} else {
CGI->curh->changeGraphic(0, 0);
}
}
else
{
if(accessible)