浏览代码

* reading of creature banks' names

mateuszb 16 年之前
父节点
当前提交
1a08772bc8
共有 3 个文件被更改,包括 8 次插入3 次删除
  1. 1 1
      AI/GeniusAI/BattleLogic.cpp
  2. 5 1
      hch/CObjectHandler.cpp
  3. 2 1
      hch/CObjectHandler.h

+ 1 - 1
AI/GeniusAI/BattleLogic.cpp

@@ -695,7 +695,7 @@ list<int> CBattleLogic::PerformDefaultAction(int stackID, int &additionalInfo)
 
 	for (std::map<int, int>::iterator it = votes.begin(); it != votes.end(); ++it)
 	{
-		if (m_cb->battleGetStackByID(it->first)->attackerOwned == m_side  //it's hostile stack
+		if (bool(m_cb->battleGetStackByID(it->first)->attackerOwned) == m_side  //it's hostile stack
 			&& it->second > max_vote)
 		{
 			max_vote = it->second;

+ 5 - 1
hch/CObjectHandler.cpp

@@ -154,8 +154,12 @@ void CObjectHandler::loadObjects()
 	
 	for(int g=0; g<21; ++g) //TODO: remove hardcoded value
 	{
-		//reading name - TODO: use it if necessary
+		//reading name
 		istr.getline(buffer, MAX_BUF, '\t');
+		creBanksNames[g] = std::string(buffer);
+		//remove trailing new line characters
+		while(creBanksNames[g][0] == 10 || creBanksNames[g][0] == 13)
+			creBanksNames[g].erase(creBanksNames[g].begin());
 
 		for(int i=0; i<4; ++i) //reading levels
 		{

+ 2 - 1
hch/CObjectHandler.h

@@ -951,7 +951,8 @@ class DLL_EXPORT CObjectHandler
 {
 public:
 	std::vector<si32> cregens; //type 17. dwelling subid -> creature ID
-	std::map <ui32, std::vector <BankConfig> > banksInfo; //[index][preset], TODO: load it
+	std::map <ui32, std::vector <BankConfig> > banksInfo; //[index][preset]
+	std::map <ui32, std::string> creBanksNames; //[crebank index] -> name of this creature bank
 
 	void loadObjects();