1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-05 00:49:09 +02:00

Fix for printing the line number. Fixed #753.

This commit is contained in:
Michał W. Urbańczyk
2011-06-27 16:03:03 +00:00
parent 2efcdae80f
commit e6409e8ddd
3 changed files with 5 additions and 5 deletions

View File

@ -1469,7 +1469,7 @@ struct LineExec : boost::static_visitor<>
void ERMInterpreter::executeLine( const LinePointer & lp ) void ERMInterpreter::executeLine( const LinePointer & lp )
{ {
tlog0 << "Executing line nr " << getRealLine(lp.lineNum) << " (internal " << lp.lineNum << ") from " << lp.file->filename << std::endl; tlog0 << "Executing line nr " << getRealLine(lp) << " (internal " << lp.lineNum << ") from " << lp.file->filename << std::endl;
executeLine(scripts[lp]); executeLine(scripts[lp]);
} }
@ -1968,10 +1968,10 @@ void ERMInterpreter::executeInstructions()
//TODO implement me //TODO implement me
} }
int ERMInterpreter::getRealLine(int lineNum) int ERMInterpreter::getRealLine(const LinePointer &lp)
{ {
for(std::map<VERMInterpreter::LinePointer, ERM::TLine>::const_iterator i = scripts.begin(); i != scripts.end(); i++) for(std::map<VERMInterpreter::LinePointer, ERM::TLine>::const_iterator i = scripts.begin(); i != scripts.end(); i++)
if(i->first.lineNum == lineNum) if(i->first.lineNum == lp.lineNum && i->first.file->filename == lp.file->filename)
return i->first.realLineNum; return i->first.realLineNum;
return -1; return -1;

View File

@ -835,7 +835,7 @@ public:
ERMInterpreter(); ERMInterpreter();
bool checkCondition( ERM::Tcondition cond ); bool checkCondition( ERM::Tcondition cond );
int getRealLine(int lineNum); int getRealLine(const VERMInterpreter::LinePointer &lp);
//overload CScriptingModule //overload CScriptingModule
virtual void heroVisit(const CGHeroInstance *visitor, const CGObjectInstance *visitedObj, bool start) OVERRIDE; virtual void heroVisit(const CGHeroInstance *visitor, const CGObjectInstance *visitedObj, bool start) OVERRIDE;

View File

@ -4557,7 +4557,7 @@ bool CGameHandler::castSpell(const CGHeroInstance *h, int spellID, const int3 &p
COMPLAIN_RET("This hero can only teleport to nearest town!") COMPLAIN_RET("This hero can only teleport to nearest town!")
} }
if (h->visitedTown) if (h->visitedTown)
stopHeroVisitCastle(town->id, h->id); stopHeroVisitCastle(h->visitedTown->id, h->id);
if (moveHero(h->id, town->visitablePos() + h->getVisitableOffset() ,1)); if (moveHero(h->id, town->visitablePos() + h->getVisitableOffset() ,1));
heroVisitCastle(town->id, h->id); heroVisitCastle(town->id, h->id);
} }