Răsfoiți Sursa

* partial handling r-clicks on adv map
* minor fixes

Michał W. Urbańczyk 17 ani în urmă
părinte
comite
a37ce5df9e
3 a modificat fișierele cu 44 adăugiri și 2 ștergeri
  1. 41 0
      CAdvmapInterface.cpp
  2. 1 0
      ChangeLog
  3. 2 2
      mapHandler.cpp

+ 41 - 0
CAdvmapInterface.cpp

@@ -435,6 +435,47 @@ endchkpt:
 }
 void CTerrainRect::clickRight(tribool down)
 {
+	int3 mp = whichTileIsIt();
+	if ((mp.x<0) 
+		|| (mp.y<0) 
+		|| down != true
+	  )
+	{
+		LOCPLINT->adventureInt->handleRightClick("",down,this);
+		return;
+	}
+
+	std::vector < const CGObjectInstance * > objs = LOCPLINT->cb->getBlockingObjs(mp);
+	if(!objs.size())
+		return;
+
+	const CGObjectInstance * obj = objs[objs.size()-1];
+	switch(obj->ID)
+	{
+	case 34:
+		{
+			CInfoPopup * ip = new CInfoPopup(graphics->heroWins[obj->subID],
+				LOCPLINT->current->motion.x-graphics->heroWins[obj->subID]->w,
+				LOCPLINT->current->motion.y-graphics->heroWins[obj->subID]->h,false
+				);
+			ip->activate();
+			break;
+		}
+	case 98:
+		{
+			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
+				);
+			ip->activate();
+			break;
+		}
+	default:
+		{
+			LOCPLINT->adventureInt->handleRightClick(obj->getHoverText(),down,this);
+			break;
+		}
+	}
 }
 void CTerrainRect::mouseMoved (const SDL_MouseMotionEvent & sEvent)
 {

+ 1 - 0
ChangeLog

@@ -10,6 +10,7 @@ ADVENTURE INTERFACE:
 * smooth map scrolling on hero movement
 * added water animation
 * speed of scrolling map and hero movement can be adjusted in the System Options Window
+* partial handling r-clicks on adventure map
 
 TOWN INTERFACE:
 * the scroll tab won't remain hanged to our mouse position if we move the mouse away from the scroll bar

+ 2 - 2
mapHandler.cpp

@@ -1552,10 +1552,10 @@ CMapHandler::~CMapHandler()
 		delete map->defy[i];
 
 	for(int i=0; i < roadDefs.size(); i++)
-		delete delete roadDefs[i];
+		delete roadDefs[i];
 
 	for(int i=0; i < staticRiverDefs.size(); i++)
-		delete delete staticRiverDefs[i];
+		delete staticRiverDefs[i];
 
 	//TODO: delete border graphics
 }