Browse Source

* Movement cursor shown for unguarded enemy towns.
* Battle cursor shown for guarded enemy garrisons.

OnionKnight 16 years ago
parent
commit
7f5f939f4f
1 changed files with 30 additions and 3 deletions
  1. 30 3
      client/CAdvmapInterface.cpp

+ 30 - 3
client/CAdvmapInterface.cpp

@@ -740,10 +740,18 @@ 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);
-					else
+					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
 				{
@@ -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)