mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Added more informative error messages for battle action errors
This commit is contained in:
@@ -282,24 +282,24 @@ void ApplyGhNetPackVisitor::visitMakeAction(MakeAction & pack)
|
|||||||
{
|
{
|
||||||
const BattleInfo * b = gs.curB;
|
const BattleInfo * b = gs.curB;
|
||||||
if(!b)
|
if(!b)
|
||||||
gh.throwNotAllowedAction(&pack);
|
gh.throwAndComplain(&pack, "Can not make action - there is no battle ongoing!");
|
||||||
|
|
||||||
if(b->tacticDistance)
|
if(b->tacticDistance)
|
||||||
{
|
{
|
||||||
if(pack.ba.actionType != EActionType::WALK && pack.ba.actionType != EActionType::END_TACTIC_PHASE
|
if(pack.ba.actionType != EActionType::WALK && pack.ba.actionType != EActionType::END_TACTIC_PHASE
|
||||||
&& pack.ba.actionType != EActionType::RETREAT && pack.ba.actionType != EActionType::SURRENDER)
|
&& pack.ba.actionType != EActionType::RETREAT && pack.ba.actionType != EActionType::SURRENDER)
|
||||||
gh.throwNotAllowedAction(&pack);
|
gh.throwAndComplain(&pack, "Can not make actions while in tactics mode!");
|
||||||
if(!vstd::contains(gh.connections[b->sides[b->tacticsSide].color], pack.c))
|
if(!vstd::contains(gh.connections[b->sides[b->tacticsSide].color], pack.c))
|
||||||
gh.throwNotAllowedAction(&pack);
|
gh.throwAndComplain(&pack, "Can not make actions in battles you are not part of!");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto active = b->battleActiveUnit();
|
auto active = b->battleActiveUnit();
|
||||||
if(!active)
|
if(!active)
|
||||||
gh.throwNotAllowedAction(&pack);
|
gh.throwAndComplain(&pack, "No active unit in battle!");
|
||||||
auto unitOwner = b->battleGetOwner(active);
|
auto unitOwner = b->battleGetOwner(active);
|
||||||
if(!vstd::contains(gh.connections[unitOwner], pack.c))
|
if(!vstd::contains(gh.connections[unitOwner], pack.c))
|
||||||
gh.throwNotAllowedAction(&pack);
|
gh.throwAndComplain(&pack, "Can not make actions in battles you are not part of!");
|
||||||
}
|
}
|
||||||
|
|
||||||
result = gh.makeBattleAction(pack.ba);
|
result = gh.makeBattleAction(pack.ba);
|
||||||
|
Reference in New Issue
Block a user