1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-23 00:28:08 +02:00

Moved all battle-related functionality of server into a new class

This commit is contained in:
Ivan Savenko
2023-07-24 00:00:37 +03:00
parent 4edee00a97
commit e8e6c02a4a
8 changed files with 2945 additions and 2826 deletions

View File

@ -11,6 +11,7 @@
#include "ServerNetPackVisitors.h"
#include "CGameHandler.h"
#include "BattleProcessor.h"
#include "HeroPoolProcessor.h"
#include "PlayerMessageProcessor.h"
@ -280,8 +281,6 @@ void ApplyGhNetPackVisitor::visitQueryReply(QueryReply & pack)
void ApplyGhNetPackVisitor::visitMakeAction(MakeAction & pack)
{
boost::unique_lock lock(gh.battleActionMutex);
const BattleInfo * b = gs.curB;
if(!b)
gh.throwAndComplain(&pack, "Can not make action - there is no battle ongoing!");
@ -304,13 +303,11 @@ void ApplyGhNetPackVisitor::visitMakeAction(MakeAction & pack)
gh.throwAndComplain(&pack, "Can not make actions in battles you are not part of!");
}
result = gh.makeBattleAction(pack.ba);
result = gh.battles->makeBattleAction(pack.ba);
}
void ApplyGhNetPackVisitor::visitMakeCustomAction(MakeCustomAction & pack)
{
boost::unique_lock lock(gh.battleActionMutex);
const BattleInfo * b = gs.curB;
if(!b)
gh.throwNotAllowedAction(&pack);
@ -325,7 +322,7 @@ void ApplyGhNetPackVisitor::visitMakeCustomAction(MakeCustomAction & pack)
if(pack.ba.actionType != EActionType::HERO_SPELL)
gh.throwNotAllowedAction(&pack);
result = gh.makeCustomAction(pack.ba);
result = gh.battles->makeCustomAction(pack.ba);
}
void ApplyGhNetPackVisitor::visitDigWithHero(DigWithHero & pack)