소스 검색

Added more informative error messages for battle action errors

Ivan Savenko 2 년 전
부모
커밋
ed927de12e
1개의 변경된 파일5개의 추가작업 그리고 5개의 파일을 삭제
  1. 5 5
      server/NetPacksServer.cpp

+ 5 - 5
server/NetPacksServer.cpp

@@ -282,24 +282,24 @@ void ApplyGhNetPackVisitor::visitMakeAction(MakeAction & pack)
 {
 	const BattleInfo * b = gs.curB;
 	if(!b)
-		gh.throwNotAllowedAction(&pack);
+		gh.throwAndComplain(&pack, "Can not make action - there is no battle ongoing!");
 
 	if(b->tacticDistance)
 	{
 		if(pack.ba.actionType != EActionType::WALK && pack.ba.actionType != EActionType::END_TACTIC_PHASE
 			&& 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))
-			gh.throwNotAllowedAction(&pack);
+			gh.throwAndComplain(&pack, "Can not make actions in battles you are not part of!");
 	}
 	else
 	{
 		auto active = b->battleActiveUnit();
 		if(!active)
-			gh.throwNotAllowedAction(&pack);
+			gh.throwAndComplain(&pack, "No active unit in battle!");
 		auto unitOwner = b->battleGetOwner(active);
 		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);