浏览代码

Spell_levels are not necessary in the end.

Fixes. Game won't crash when displaying info for war machines. However, they should be handled as regular stacks during battle.
DjWarmonger 14 年之前
父节点
当前提交
db386915d1
共有 4 个文件被更改,包括 11 次插入36 次删除
  1. 3 4
      client/CBattleInterface.cpp
  2. 8 1
      client/CCreatureWindow.cpp
  3. 0 12
      config/spell_levels.txt
  4. 0 19
      lib/CSpellHandler.cpp

+ 3 - 4
client/CBattleInterface.cpp

@@ -2935,9 +2935,8 @@ void CBattleInterface::spellCast( const BattleSpellCast * sc )
 					else
 						text = "";
 					break;
-				case 81:
-					break; //handled as hero spell - display damage
 				default:
+					text = CGI->generaltexth->allTexts[565]; //The %s casts %s	
 					boost::algorithm::replace_first(text, "%s", CGI->creh->creatures[sc->attackerType]->namePl); //casting stack
 			}
 			if (plural)
@@ -2955,7 +2954,7 @@ void CBattleInterface::spellCast( const BattleSpellCast * sc )
 			}
 		}
 		if (!customSpell)
-			boost::algorithm::replace_first(text, "%s", CGI->spellh->spells[sc->id]->name);
+			boost::algorithm::replace_first(text, "%s", CGI->spellh->spells[sc->id]->name); //simple spell name
 		if (text.size())
 			console->addText(text);
 	}
@@ -2968,7 +2967,7 @@ void CBattleInterface::spellCast( const BattleSpellCast * sc )
 		}
 		else
 		{
-			boost::algorithm::replace_first(text, "%s", "Creature"); //TODO: better fix
+			boost::algorithm::replace_first(text, "%s", CGI->creh->creatures[sc->attackerType]->namePl); //creature caster
 		}
 		boost::algorithm::replace_first(text, "%s", CGI->spellh->spells[sc->id]->name);
 		console->addText(text);

+ 8 - 1
client/CCreatureWindow.cpp

@@ -41,8 +41,15 @@ CCreatureWindow::CCreatureWindow (const CStack &stack, int Type)
 	: type(Type)
 {
 	OBJ_CONSTRUCTION_CAPTURING_ALL;
+	if (stack.base)
+		init(stack.base, &stack, dynamic_cast<const CGHeroInstance*>(stack.base->armyObj));
+	else
+	{
+		CStackInstance * s = new CStackInstance(stack.type, 1); //TODO: war machines and summons should be regular stacks
+		init(s, stack.type, NULL);
+		delete s;
+	}
 
-	init(stack.base, &stack, dynamic_cast<const CGHeroInstance*>(stack.base->armyObj));
 }
 
 CCreatureWindow::CCreatureWindow (const CStackInstance &stack, int Type)

+ 0 - 12
config/spell_levels.txt

@@ -1,12 +0,0 @@
-70 3
-71 2	
-72 255
-73 2
-74 4
-75 5
-76 255
-77 2
-78 1
-79 255
-80 255
--1

+ 0 - 19
lib/CSpellHandler.cpp

@@ -322,24 +322,5 @@ void CSpellHandler::loadSpells()
 		}
 	}
 	ast.close();
-	//ast.open(DATA_DIR "/config/spell_levels.txt", std::ios::binary);
-	//if(!ast.is_open())
-	//{
-	//	tlog1<<"lack of config/spell_levels.txt file!"<<std::endl;
-	//}
-	//else
-	//{
-	//	//custom levels of spells. Level 0 seems to not be supported correctly, but we can replace it it something else
-	//	int spellID;
-	//	ast>>spellID;
-	//	int buf;
-	//	while(spellID != -1)
-	//	{
-	//		ast >> buf;
-	//		spells[spellID]->level = buf;
-	//		ast>>spellID;
-	//	}
-	//}
-	//ast.close();
 	spells.push_back(spells[80]); //clone Acid Breath attributes for Acid Breath damage effect
 }