mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
* New files for lib: CBattleCallback.cpp and CBattleCallback.h
* Updated MSVC project files * Filesystem: My version of .SND archive does not have \0 after WAV extension. Fixed (though hardcoded 3-char extension length). * New bonus types: BLOCK_MAGIC_ABOVE for blocking casting spells above given level and BLOCK_ALL_MAGIC for blocking all magic. * Heavy rewrite of battle callbacks. Fixed some minor bugs. Code reusage between lib/client/server (removed proxy calls). Better access control and support for various perspectives. * Fixed #1031 * Fixed Orb of Inhibition and Recanter's Cloak (they were incorrectly implemented). Fixed #97. * Fleeing hero won't lose artifacts. Spellbook won't be captured. Fixed #980. * Fixed crash when attacking stack dies before counterattack (ie. because of Fire Shield) * Server does some basic checks if action requests during battle are valid * Minor stuff.
This commit is contained in:
@@ -251,7 +251,7 @@ bool MakeAction::applyGh( CGameHandler *gh )
|
||||
if(gh->connections[b->sides[b->tacticsSide]] != c)
|
||||
ERROR_AND_RETURN;
|
||||
}
|
||||
else if(gh->connections[b->getStack(b->activeStack)->owner] != c)
|
||||
else if(gh->connections[b->battleGetStackByID(b->activeStack)->owner] != c)
|
||||
ERROR_AND_RETURN;
|
||||
|
||||
return gh->makeBattleAction(ba);
|
||||
@@ -262,9 +262,10 @@ bool MakeCustomAction::applyGh( CGameHandler *gh )
|
||||
const BattleInfo *b = GS(gh)->curB;
|
||||
if(!b) ERROR_AND_RETURN;
|
||||
if(b->tacticDistance) ERROR_AND_RETURN;
|
||||
const CStack *active = GS(gh)->curB->getStack(GS(gh)->curB->activeStack);
|
||||
const CStack *active = GS(gh)->curB->battleGetStackByID(GS(gh)->curB->activeStack);
|
||||
if(!active) ERROR_AND_RETURN;
|
||||
if(gh->connections[active->owner] != c) ERROR_AND_RETURN;
|
||||
if(ba.actionType != BattleAction::HERO_SPELL) ERROR_AND_RETURN;
|
||||
return gh->makeCustomAction(ba);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user