Michał W. Urbańczyk 13 年之前
父节点
当前提交
ee6e9fcc7f
共有 3 个文件被更改,包括 7 次插入4 次删除
  1. 1 1
      client/CMT.cpp
  2. 5 2
      lib/IGameCallback.cpp
  3. 1 1
      lib/IGameCallback.h

+ 1 - 1
client/CMT.cpp

@@ -732,7 +732,7 @@ static void listenForEvents()
 				break;
 				break;
 			case RESTART_GAME:
 			case RESTART_GAME:
 				{
 				{
-					StartInfo si = *client->getStartInfo();
+					StartInfo si = *client->getStartInfo(true);
 					endGame();
 					endGame();
 					startGame(&si);
 					startGame(&si);
 				}
 				}

+ 5 - 2
lib/IGameCallback.cpp

@@ -712,10 +712,13 @@ void CGameInfoCallback::getUpgradeInfo(const CArmedInstance *obj, int stackPos,
 	//return gs->getUpgradeInfo(obj->getStack(stackPos));
 	//return gs->getUpgradeInfo(obj->getStack(stackPos));
 }
 }
 
 
-const StartInfo * CGameInfoCallback::getStartInfo() const
+const StartInfo * CGameInfoCallback::getStartInfo(bool beforeRandomization /*= false*/) const
 {
 {
 	//boost::shared_lock<boost::shared_mutex> lock(*gs->mx);
 	//boost::shared_lock<boost::shared_mutex> lock(*gs->mx);
-	return gs->scenarioOps;
+	if(beforeRandomization)
+		return gs->initialOpts;
+	else
+		return gs->scenarioOps;
 }
 }
 
 
 int CGameInfoCallback::getSpellCost(const CSpell * sp, const CGHeroInstance * caster) const
 int CGameInfoCallback::getSpellCost(const CSpell * sp, const CGHeroInstance * caster) const

+ 1 - 1
lib/IGameCallback.h

@@ -155,7 +155,7 @@ protected:
 public:
 public:
 	//various
 	//various
 	int getDate(int mode=0)const; //mode=0 - total days in game, mode=1 - day of week, mode=2 - current week, mode=3 - current month
 	int getDate(int mode=0)const; //mode=0 - total days in game, mode=1 - day of week, mode=2 - current week, mode=3 - current month
-	const StartInfo * getStartInfo()const;
+	const StartInfo * getStartInfo(bool beforeRandomization = false)const;
 	bool isAllowed(int type, int id); //type: 0 - spell; 1- artifact; 2 - secondary skill
 	bool isAllowed(int type, int id); //type: 0 - spell; 1- artifact; 2 - secondary skill
 
 
 	//player
 	//player