فهرست منبع

Fixed creature bonus parser. Fixed several uninitialized variables. Updated data build script to v0.85.

Frank Zago 14 سال پیش
والد
کامیت
aca118b613
7فایلهای تغییر یافته به همراه15 افزوده شده و 6 حذف شده
  1. 3 3
      build_data.sh
  2. 1 0
      client/CAdvmapInterface.cpp
  3. 2 1
      client/Client.cpp
  4. 1 0
      client/GUIBase.cpp
  5. 2 1
      client/GUIClasses.cpp
  6. 5 1
      lib/CCreatureHandler.cpp
  7. 1 0
      lib/CHeroHandler.cpp

+ 3 - 3
build_data.sh

@@ -1,6 +1,6 @@
 #!/bin/sh
 #!/bin/sh
 
 
-# Copyright (c) 2009,2010 Frank Zago
+# Copyright (c) 2009,2010,2011 Frank Zago
 #
 #
 # This program is free software; you can redistribute it and/or modify
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # it under the terms of the GNU General Public License as published by
@@ -18,7 +18,7 @@
 # Data files needed:
 # Data files needed:
 #   data1.cab and data1.hdr from the original CDROM
 #   data1.cab and data1.hdr from the original CDROM
 #   the WoG release v3.58f: allinone_358f.zip
 #   the WoG release v3.58f: allinone_358f.zip
-#   the VCMI distribution: vcmi_084.zip
+#   the VCMI distribution: vcmi_085.zip
 
 
 # Usage: put this script and the 4 data files into the same directory
 # Usage: put this script and the 4 data files into the same directory
 # and run the script.
 # and run the script.
@@ -106,7 +106,7 @@ rm -rf temp
 mkdir temp
 mkdir temp
 cd temp
 cd temp
 
 
-unzip ../vcmi_084.zip
+unzip ../vcmi_085.zip
 
 
 find . -name "*.dll" | xargs rm -f
 find . -name "*.dll" | xargs rm -f
 find . -name "*.DLL" | xargs rm -f
 find . -name "*.DLL" | xargs rm -f

+ 1 - 0
client/CAdvmapInterface.cpp

@@ -976,6 +976,7 @@ endTurn(CGI->generaltexth->zelp[302].first,CGI->generaltexth->zelp[302].second,
 heroList(ADVOPT.hlistSize),
 heroList(ADVOPT.hlistSize),
 townList(ADVOPT.tlistSize,ADVOPT.tlistX,ADVOPT.tlistY,ADVOPT.tlistAU,ADVOPT.tlistAD)//(5,&genRect(192,48,747,196),747,196,747,372),
 townList(ADVOPT.tlistSize,ADVOPT.tlistX,ADVOPT.tlistY,ADVOPT.tlistAU,ADVOPT.tlistAD)//(5,&genRect(192,48,747,196),747,196,747,372),
 {
 {
+	state = NA;
 	spellBeingCasted = NULL;
 	spellBeingCasted = NULL;
 	pos.x = pos.y = 0;
 	pos.x = pos.y = 0;
 	pos.w = screen->w;
 	pos.w = screen->w;

+ 2 - 1
client/Client.cpp

@@ -605,7 +605,7 @@ void CServerHandler::startServer()
 {
 {
 	th.update();
 	th.update();
 	
 	
-	serverThread = new boost::thread(&CServerHandler::callServer, this); //runs server executable; 	//TODO: will it work on non-windows platforms?
+	serverThread = new boost::thread(&CServerHandler::callServer, this); //runs server executable;
 	if(verbose)
 	if(verbose)
 		tlog0 << "Setting up thread calling server: " << th.getDif() << std::endl;
 		tlog0 << "Setting up thread calling server: " << th.getDif() << std::endl;
 }
 }
@@ -644,6 +644,7 @@ CServerHandler::CServerHandler(bool runServer /*= false*/)
 	serverThread = NULL;
 	serverThread = NULL;
 	shared = NULL;
 	shared = NULL;
 	port = boost::lexical_cast<std::string>(conf.cc.port);
 	port = boost::lexical_cast<std::string>(conf.cc.port);
+	verbose = false;
 
 
 	boost::interprocess::shared_memory_object::remove("vcmi_memory"); //if the application has previously crashed, the memory may not have been removed. to avoid problems - try to destroy it
 	boost::interprocess::shared_memory_object::remove("vcmi_memory"); //if the application has previously crashed, the memory may not have been removed. to avoid problems - try to destroy it
 	try
 	try

+ 1 - 0
client/GUIBase.cpp

@@ -375,6 +375,7 @@ CGuiHandler::CGuiHandler()
 
 
 	// Creates the FPS manager and sets the framerate to 48 which is doubled the value of the original Heroes 3 FPS rate
 	// Creates the FPS manager and sets the framerate to 48 which is doubled the value of the original Heroes 3 FPS rate
 	mainFPSmng = new FPSManager(48);
 	mainFPSmng = new FPSManager(48);
+	mainFPSmng->init(); // resets internal clock, needed for FPS manager
 }
 }
 
 
 CGuiHandler::~CGuiHandler()
 CGuiHandler::~CGuiHandler()

+ 2 - 1
client/GUIClasses.cpp

@@ -6798,6 +6798,7 @@ CLabel::CLabel(int x, int y, EFonts Font /*= FONT_SMALL*/, EAlignment Align, con
 	pos.y += y;
 	pos.y += y;
 	pos.w = pos.h = 0;
 	pos.w = pos.h = 0;
 	bg = NULL;
 	bg = NULL;
+	ignoreLeadingWhitespace = false;
 }
 }
 
 
 void CLabel::setTxt(const std::string &Txt)
 void CLabel::setTxt(const std::string &Txt)
@@ -7198,4 +7199,4 @@ CIntObject * createCreWindow(const CStackInstance *s, int type, boost::function<
 		return new CCreInfoWindow(*s, type==3, Upg, Dsm, ui);
 		return new CCreInfoWindow(*s, type==3, Upg, Dsm, ui);
 	else
 	else
 		return  new CCreatureWindow(*s, type, Upg, Dsm, ui);
 		return  new CCreatureWindow(*s, type, Upg, Dsm, ui);
-}
+}

+ 5 - 1
lib/CCreatureHandler.cpp

@@ -612,11 +612,15 @@ void CCreatureHandler::loadCreatures()
 			getline(ifs, buf, '\t');
 			getline(ifs, buf, '\t');
 			getline(ifs, buf2, '\t');
 			getline(ifs, buf2, '\t');
 			getline(ifs, buf3);
 			getline(ifs, buf3);
+
+			if (ifs.eof() || ifs.fail())
+				break;
+
 			it = bonusNameMap.find(buf);
 			it = bonusNameMap.find(buf);
 			if (it != bonusNameMap.end())
 			if (it != bonusNameMap.end())
 				stackBonuses[it->second] = std::pair<std::string, std::string>(buf2,buf3);
 				stackBonuses[it->second] = std::pair<std::string, std::string>(buf2,buf3);
 			else
 			else
-				tlog2 << "Bonus " << buf << " not recognized, ingoring\n";
+				tlog2 << "Bonus " << buf << " not recognized, ignoring\n";
 		}
 		}
 	}
 	}
 	ifs.close();
 	ifs.close();

+ 1 - 0
lib/CHeroHandler.cpp

@@ -564,6 +564,7 @@ void CHeroHandler::loadNativeTerrains()
 CHero::CHero()
 CHero::CHero()
 {
 {
 	startingSpell = -1;
 	startingSpell = -1;
+	sex = 0xff;
 }
 }
 
 
 CHero::~CHero()
 CHero::~CHero()