1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

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.
This commit is contained in:
DjWarmonger 2011-05-13 14:33:48 +00:00
parent b02527566c
commit db386915d1
4 changed files with 11 additions and 36 deletions

View File

@ -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);

View File

@ -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)

View File

@ -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

View File

@ -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
}