Commits

sbl5007 committed 68d0e76

fix red waypoint bug by not counting townportals in cnt and ncount

  • Participants
  • Parent commits f82ef32

Comments (0)

Files changed (1)

File src/gui/worldmap.cpp

 	CEGUI::FrameWindow* worldmap = (CEGUI::FrameWindow*) win_mgr.getWindow("WorldmapWindow");
 	
 	static int ncount =0;
+	static bool tpset = false;
 	
 	std::map<short,WaypointInfo>& winfos = World::getWorld()->getWaypointData();
 	std::map<short,WaypointInfo>::iterator it;
 		cnt++;
 	}
 	
+	
+	// restliche Label verstecken
+	for (; cnt <ncount; cnt++)
+	{
+		stream.str("");
+		stream << "WaypointImage";
+		stream << cnt;
+			
+		label = win_mgr.getWindow(stream.str());
+		label->setVisible(false);
+	}
 	RegionLocation& portal = player->getPortalPosition();
 	if (portal.first != "")
 	{
 		{
 		
 			stream.str("");
-			stream << "WaypointImage"<<cnt;
+			stream << "TownPortalImage";
 			
-			if (cnt >= ncount)
+			if (tpset==false)
 			{
 				label = win_mgr.createWindow("TaharezLook/StaticImage", stream.str());
 				worldmap->addChildWindow(label);
 				label->setAlwaysOnTop(true);
 				label->subscribeEvent(CEGUI::Window::EventMouseButtonDown, CEGUI::Event::Subscriber(&Worldmap::onWaypointClicked, this));
 				
-				ncount ++;
+				tpset = true;
 			}
 			else
 			{
 			stream << dgettext("sumwars","Town Portal") << "\n";
 			stream << dgettext("sumwars",it->second.m_name.c_str());
 			label->setTooltipText((CEGUI::utf8*) stream.str().c_str());
-			
-			cnt++;
 		}
 		else
 		{
 			ERRORMSG("region %s has no world position", portal.first.c_str());
 		}
 	}
-	
-	// restliche Label verstecken
-	for (; cnt <ncount; cnt++)
-	{
-		stream.str("");
-		stream << "WaypointImage";
-		stream << cnt;
-			
-		label = win_mgr.getWindow(stream.str());
-		label->setVisible(false);
+	else {
+		if(tpset == true) {
+			stream.str("");
+			stream << "TownPortalImage";
+			label = win_mgr.getWindow(stream.str());
+			label->setVisible(false);
+		}
+
 	}
 }