Browse Source

Fixed #110.
Some minor changes / fixes.

Michał W. Urbańczyk 16 years ago
parent
commit
f99c4d3c66

+ 1 - 0
client/CBattleInterface.cpp

@@ -26,6 +26,7 @@
 #include "../hch/CTownHandler.h"
 #include <boost/assign/list_of.hpp>
 #include <boost/lexical_cast.hpp>
+#include <boost/algorithm/string/replace.hpp>
 #ifndef __GNUC__
 const double M_PI = 3.14159265358979323846;
 #else

+ 3 - 4
client/CCastleInterface.cpp

@@ -575,7 +575,7 @@ void CCastleInterface::buildingClicked(int building)
 				{
 					if(LOCPLINT->cb->getResourceAmount(6) < 500) //not enough gold to buy spellbook
 					{
-						LOCPLINT->showInfoDialog(CGI->generaltexth->allTexts[213],std::vector<SComponent*>(), soundBase::sound_todo);
+						LOCPLINT->showInfoDialog(CGI->generaltexth->allTexts[213]);
 					}
 					else
 					{
@@ -594,7 +594,6 @@ void CCastleInterface::buildingClicked(int building)
 		case 5: //tavern
 			{
 				enterTavern();
-
 				break;
 			}
 		case 6: //shipyard
@@ -645,7 +644,7 @@ void CCastleInterface::buildingClicked(int building)
 		//TODO: case 18: //basic horde 1
 		//TODO: case 19: //upg horde 1
 		case 20: //ship at shipyard
-			//Do nothing.
+			LOCPLINT->showInfoDialog(CGI->generaltexth->allTexts[51]); //Cannot build another boat
 			break;
 		//TODO: case 21: //special 2
 		case 22: //special 3
@@ -916,7 +915,7 @@ void CCastleInterface::recreateBuildings()
 	if(vstd::contains(town->builtBuildings,6))
 	{
 		std::vector <const CGObjectInstance *> vobjs = LOCPLINT->cb->getVisitableObjs(town->bestLocation());
-		if(vobjs.size() && vobjs.front()->ID == 8) //there is visitable obj at shipyard output tile and it's a boat
+		if(vobjs.size() && (vobjs.front()->ID == 8 || vobjs.front()->ID == HEROI_TYPE)) //there is visitable obj at shipyard output tile and it's a boat or hero (on boat)
 		{
 			Structure * st = CGI->townh->structures[town->subID][20];
 			buildings.push_back(new CBuildingRect(st));

+ 1 - 0
client/CHeroWindow.cpp

@@ -23,6 +23,7 @@
 #include <boost/assign/std/vector.hpp>
 #include <cstdlib>
 #include <sstream>
+#include <boost/lexical_cast.hpp>
 
 /*
  * CHeroWindow.cpp, part of VCMI engine

+ 2 - 0
client/CSpellWindow.cpp

@@ -14,6 +14,8 @@
 #include "../CCallback.h"
 #include <boost/bind.hpp>
 #include <sstream>
+#include <boost/algorithm/string/replace.hpp>
+#include <boost/lexical_cast.hpp>
 
 /*
  * CSpellWindow.cpp, part of VCMI engine

+ 6 - 5
client/GUIClasses.cpp

@@ -4148,16 +4148,17 @@ CExchangeWindow::CExchangeWindow(si32 hero1, si32 hero2) : bg(NULL)
 		//secondary skill's clickable areas
 		for(int g=0; g<heroInst[b]->secSkills.size(); ++g)
 		{
+			int skill = heroInst[b]->secSkills[g].first,
+				level = heroInst[b]->secSkills[g].second; // <1, 3>
 			secSkillAreas[b].push_back(new LRClickableAreaWTextComp());
 			secSkillAreas[b][g]->pos = genRect(32, 32, pos.x + 32 + g*36 + b*454 , pos.y + 88);
 			secSkillAreas[b][g]->baseType = 1;
 
-			secSkillAreas[b][g]->type = heroInst[b]->secSkills[g].first;
-			secSkillAreas[b][g]->bonus = heroInst[b]->secSkills[g].second;
-			std::string hlp = CGI->generaltexth->skillInfoTexts[ heroInst[b]->secSkills[g].first ][heroInst[b]->secSkills[g].second-1];
-			secSkillAreas[b][g]->text = hlp.substr(1, hlp.size()-2);
+			secSkillAreas[b][g]->type = skill;
+			secSkillAreas[b][g]->bonus = level;
+			secSkillAreas[b][g]->text = CGI->generaltexth->skillInfoTexts[skill][level-1];
 
-			sprintf(bufor, CGI->generaltexth->heroscrn[21].c_str(), CGI->generaltexth->levels[heroInst[b]->secSkills[g].second-1].c_str(), CGI->generaltexth->skillName[heroInst[b]->secSkills[g].first].c_str());
+			sprintf(bufor, CGI->generaltexth->heroscrn[21].c_str(), CGI->generaltexth->levels[level - 1].c_str(), CGI->generaltexth->skillName[skill].c_str());
 			secSkillAreas[b][g]->hoverText = std::string(bufor);
 		}
 

+ 2 - 1
client/NetPacksClient.cpp

@@ -143,7 +143,8 @@ void RemoveObject::applyFirstCl( CClient *cl )
 
 void RemoveObject::applyCl( CClient *cl )
 {
-	GS(cl)->calculatePaths(cl->pathInfo->hero, *cl->pathInfo);
+	if(cl->pathInfo->hero)
+		GS(cl)->calculatePaths(cl->pathInfo->hero, *cl->pathInfo);
 }
 
 void TryMoveHero::applyFirstCl( CClient *cl )

+ 1 - 1
client/VCMI_client.vcproj

@@ -39,7 +39,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions="/MP2"
+				AdditionalOptions="/MP4"
 				Optimization="0"
 				AdditionalIncludeDirectories="..\..\include"
 				GeneratePreprocessedFile="0"

+ 2 - 1
lib/CGameState.cpp

@@ -1067,7 +1067,7 @@ std::pair<int,int> CGameState::pickObject (CGObjectInstance *obj)
 			for(unsigned int i=0;i<VLC->objh->cregens.size();i++)
 				if(VLC->objh->cregens[i]==cid)
 					return std::pair<int,int>(17,i); 
-			tlog3 << "Cannot find a dwelling for creature "<<cid <<std::endl;
+			tlog3 << "Cannot find a dwelling for creature "<< cid << std::endl;
 			return std::pair<int,int>(17,0); 
 		}
 	case 217:
@@ -3067,6 +3067,7 @@ bool CPathsInfo::getPath( const int3 &dst, CGPath &out )
 CPathsInfo::CPathsInfo( const int3 &Sizes )
 :sizes(Sizes)
 {
+	hero = NULL;
 	nodes = new CGPathNode**[sizes.x];
 	for(int i = 0; i < sizes.x; i++)
 	{

+ 4 - 2
lib/VCMIDirs.h

@@ -8,9 +8,11 @@
  *
  */
 
-#include <boost/filesystem.hpp>
+#ifndef _WIN32 //we need boost here only on non-win platforms
+	#include <boost/filesystem.hpp> 
+	using namespace boost::filesystem;
+#endif
 
-using namespace boost::filesystem;
 
 /* Where to find the various VCMI files. This is mostly usefull for linux. */
 class VCMIDirs {

+ 5 - 1
lib/VCMI_lib.vcproj

@@ -39,7 +39,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions="/MP2"
+				AdditionalOptions="/MP4"
 				Optimization="0"
 				AdditionalIncludeDirectories="..\..\include"
 				MinimalRebuild="false"
@@ -436,6 +436,10 @@
 				RelativePath=".\VCMI_Lib.h"
 				>
 			</File>
+			<File
+				RelativePath=".\VCMIDirs.h"
+				>
+			</File>
 		</Filter>
 	</Files>
 	<Globals>

+ 1 - 1
server/VCMI_server.vcproj

@@ -39,7 +39,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions="/MP2"
+				AdditionalOptions="/MP4"
 				Optimization="0"
 				AdditionalIncludeDirectories="..\..\include"
 				MinimalRebuild="false"