浏览代码

More fixes.

Michał W. Urbańczyk 16 年之前
父节点
当前提交
1f0a1bd771
共有 4 个文件被更改,包括 7 次插入2 次删除
  1. 1 0
      AI/GeniusAI/BattleHelper.cpp
  2. 1 0
      AI/GeniusAI/CGeniusAI.cpp
  3. 4 2
      client/CPreGame.cpp
  4. 1 0
      server/CGameHandler.cpp

+ 1 - 0
AI/GeniusAI/BattleHelper.cpp

@@ -5,6 +5,7 @@
 #include <boost/algorithm/string/split.hpp>
 #include <boost/algorithm/string/classification.hpp>
 #include <boost/algorithm/string.hpp>
+#include <boost/lexical_cast.hpp>
 
 using namespace GeniusAI::BattleAI;
 using namespace std;

+ 1 - 0
AI/GeniusAI/CGeniusAI.cpp

@@ -5,6 +5,7 @@
 #include "../../hch/CHeroHandler.h"
 #include "../../lib/VCMI_Lib.h"
 #include "../../lib/NetPacks.h"
+#include <boost/lexical_cast.hpp>
 
 using namespace std;
 using namespace GeniusAI;

+ 4 - 2
client/CPreGame.cpp

@@ -27,6 +27,7 @@
 #include "../hch/CCreatureHandler.h"
 #include "CPlayerInterface.h"
 #include "../CCallback.h"
+#include <boost/lexical_cast.hpp>
 /*
  * CPreGame.cpp, part of VCMI engine
  *
@@ -366,7 +367,7 @@ void CSelectionScreen::startGame()
 		if(!(sel && sel->txt && sel->txt->text.size()))
 			return;
 
-		selectedName = sel->txt->text;
+		selectedName = "Games/" + sel->txt->text + ".vlgm1";
 		LOCPLINT->cb->save(sel->txt->text);
 		GH.popIntTotally(this);
 	}
@@ -555,7 +556,7 @@ SelectionTab::SelectionTab(EState Type, const boost::function<void(CMapInfo *)>
 			if(selectedName[0] == 'M')
 				txt->setText("NEWGAME");
 			else
-				selectFName("Games/" + selectedName + ".vlgm1");
+				selectFName(selectedName);
 		}
 	}
 }
@@ -1642,6 +1643,7 @@ void CTextInput::clickLeft( tribool down, bool previousState )
 
 void CTextInput::keyPressed( const SDL_KeyboardEvent & key )
 {
+	if(key.state != SDL_PRESSED) return;
 	switch(key.keysym.sym)
 	{
 	case SDLK_BACKSPACE:

+ 1 - 0
server/CGameHandler.cpp

@@ -327,6 +327,7 @@ void CGameHandler::startBattle(const CArmedInstance *army1, const CArmedInstance
 	BattleInfo *curB = new BattleInfo;
 	curB->side1 = army1->tempOwner;
 	curB->side2 = army2->tempOwner;
+	if(curB->side2 == 254) curB->side2 = 255;
 	setupBattle(curB, tile, army1->army, army2->army, hero1, hero2, creatureBank, town); //initializes stacks, places creatures on battlefield, blocks and informs player interfaces
 	NEW_ROUND;
 	//TODO: pre-tactic stuff, call scripts etc.