Browse Source

Changes to compile under gcc

Vadim Glazunov 17 năm trước cách đây
mục cha
commit
c94fbbf228
5 tập tin đã thay đổi với 20 bổ sung11 xóa
  1. 2 1
      CCastleInterface.cpp
  2. 5 3
      CPlayerInterface.cpp
  3. 8 3
      client/Client.cpp
  4. 1 1
      global.h
  5. 4 3
      server/CGameHandler.cpp

+ 2 - 1
CCastleInterface.cpp

@@ -19,6 +19,7 @@
 #include <boost/algorithm/string.hpp>
 #include <boost/algorithm/string/replace.hpp>
 #include <boost/assign/std/vector.hpp> 
+#include <cmath>
 using namespace boost::assign;
 using namespace CSDL_Ext;
 
@@ -1337,4 +1338,4 @@ void CFortScreen::RecArea::activate()
 void CFortScreen::RecArea::deactivate()
 {
 	ClickableL::deactivate();
-}
+}

+ 5 - 3
CPlayerInterface.cpp

@@ -3170,7 +3170,8 @@ CCreInfoWindow::CCreInfoWindow(int Cid, int Type, int creatureCount, StackState
 				fs[1] += boost::bind(&CCastleInterface::showAll,pom,screen,true);
 			}
 			fs[1] += boost::bind(&CCreInfoWindow::activate,this);
-			CFunctionList<void()> cfl = boost::bind(&CCreInfoWindow::deactivate,this);
+			CFunctionList<void()> cfl;
+			cfl = boost::bind(&CCreInfoWindow::deactivate,this);
 			cfl += boost::bind(&CPlayerInterface::showYesNoDialog,LOCPLINT,CGI->generaltexth->allTexts[207],boost::ref(upgResCost),fs[0],fs[1],false,false);
 			upgrade = new AdventureMapButton("",CGI->preth->zelp[446].second,cfl,pos.x+76,pos.y+237,"IVIEWCR.DEF");
 		}
@@ -3187,7 +3188,8 @@ CCreInfoWindow::CCreInfoWindow(int Cid, int Type, int creatureCount, StackState
 				fs[1] += boost::bind(&CCastleInterface::showAll,pom,screen,true);
 			}
 			fs[1] += boost::bind(&CCreInfoWindow::activate,this);
-			CFunctionList<void()> cfl = boost::bind(&CCreInfoWindow::deactivate,this);
+			CFunctionList<void()> cfl;
+		        cfl = boost::bind(&CCreInfoWindow::deactivate,this);
 			cfl += boost::bind(&CPlayerInterface::showYesNoDialog,LOCPLINT,CGI->generaltexth->allTexts[12],std::vector<SComponent*>(),fs[0],fs[1],false,false);
 			dismiss = new AdventureMapButton("",CGI->preth->zelp[445].second,cfl,pos.x+21,pos.y+237,"IVIEWCR2.DEF");
 		}
@@ -3408,4 +3410,4 @@ CMinorResDataBar::CMinorResDataBar()
 CMinorResDataBar::~CMinorResDataBar()
 {
 	SDL_FreeSurface(bg);
-}
+}

+ 8 - 3
client/Client.cpp

@@ -199,7 +199,8 @@ void CClient::process(int what)
 			std::vector<Component*> comps;
 			for(int i=0;i<iw.components.size();i++)
 				comps.push_back(&iw.components[i]);
-			playerint[iw.player]->showInfoDialog(toString(iw.text),comps);
+			std::string str = toString(iw.text);
+			playerint[iw.player]->showInfoDialog(str,comps);
 			break;
 		}
 	case 104:
@@ -374,7 +375,10 @@ void CClient::process(int what)
 			gs->apply(&bs);
 			CGHeroInstance *h = gs->getHero(bs.heroid);
 			if(vstd::contains(playerint,h->tempOwner))
-				playerint[h->tempOwner]->heroGotLevel(h,bs.primskill,bs.skills,boost::function<void(ui32)>(boost::bind(&CCallback::selectionMade,cb,_1,bs.id)));
+			{
+				boost::function<void(ui32)> callback = boost::function<void(ui32)>(boost::bind(&CCallback::selectionMade,cb,_1,bs.id));
+				playerint[h->tempOwner]->heroGotLevel((const CGHeroInstance *)h,(int)bs.primskill,bs.skills, callback);
+			}
 			break;
 		}
 	case 2001:
@@ -385,7 +389,8 @@ void CClient::process(int what)
 			std::vector<Component*> comps;
 			for(int i=0;i<sd.components.size();i++)
 				comps.push_back(&sd.components[i]);
-			playerint[sd.player]->showSelDialog(toString(sd.text),comps,sd.id);
+			std::string str = toString(sd.text);
+			playerint[sd.player]->showSelDialog(str,comps,sd.id);
 			break;
 		}
 	case 3000:

+ 1 - 1
global.h

@@ -115,7 +115,7 @@ namespace vstd
 	template <typename Container, typename Item>
 	bool operator-=(Container &c, const Item &i)
 	{
-		Container::iterator itr = find(c,i);
+		typename Container::iterator itr = find(c,i);
 		if(itr == c.end())
 			return false;
 		c.erase(itr);

+ 4 - 3
server/CGameHandler.cpp

@@ -234,7 +234,8 @@ void CGameHandler::changePrimSkill(int ID, int which, int val, bool abs)
 			{
 				hlu.skills.push_back(hero->type->heroClass->chooseSecSkill(none)); //new skill
 			}
-			applyAndAsk(&hlu,hero->tempOwner,boost::function<void(ui32)>(boost::bind(callWith<ui16>,hlu.skills,boost::function<void(ui16)>(boost::bind(&CGameHandler::changeSecSkill,this,ID,_1,1,0)),_1))); //call changeSecSkill with appropriate args when client responds
+			boost::function<void(ui32)> callback = boost::function<void(ui32)>(boost::bind(callWith<ui16>,hlu.skills,boost::function<void(ui16)>(boost::bind(&CGameHandler::changeSecSkill,this,ID,_1,1,0)),_1));
+			applyAndAsk(&hlu,hero->tempOwner,callback); //call changeSecSkill with appropriate args when client responds
 		}
 	}
 }
@@ -1054,7 +1055,7 @@ void CGameHandler::run()
 #else
 				boost::xtime time={0,0};
 				time.sec = static_cast<boost::xtime::xtime_sec_t>(p.total_seconds());
-				cTurn.timed_wait(lock,time);
+				states.cv.timed_wait(lock,time);
 #endif
 			}
 		}
@@ -1205,4 +1206,4 @@ void CGameHandler::setupBattle( BattleInfo * curB, int3 tile, CCreatureSet &army
 	BattleStart bs;
 	bs.info = curB;
 	sendAndApply(&bs);
-}
+}