mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-21 21:17:49 +02:00
Fixed battles for network MP.
This commit is contained in:
parent
0f36095dc7
commit
e83b9fa8fa
@ -1102,6 +1102,8 @@ CBattleInterface::CBattleInterface(const CCreatureSet * army1, const CCreatureSe
|
|||||||
{
|
{
|
||||||
ObjectConstruction h__l__p(this);
|
ObjectConstruction h__l__p(this);
|
||||||
|
|
||||||
|
if(!curInt) curInt = LOCPLINT; //may happen when we are defending during network MP game
|
||||||
|
|
||||||
animsAreDisplayed.setn(false);
|
animsAreDisplayed.setn(false);
|
||||||
pos = myRect;
|
pos = myRect;
|
||||||
strongInterest = true;
|
strongInterest = true;
|
||||||
@ -2916,6 +2918,7 @@ void CBattleInterface::activateStack()
|
|||||||
stackToActivate = -1;
|
stackToActivate = -1;
|
||||||
|
|
||||||
myTurn = true;
|
myTurn = true;
|
||||||
|
if(attackerInt && defenderInt) //hotseat -> need to pick which interface "takes over" as active
|
||||||
curInt = attackerInt->playerID == LOCPLINT->cb->battleGetStackByID(activeStack)->owner ? attackerInt : defenderInt;
|
curInt = attackerInt->playerID == LOCPLINT->cb->battleGetStackByID(activeStack)->owner ? attackerInt : defenderInt;
|
||||||
|
|
||||||
queue->update();
|
queue->update();
|
||||||
|
@ -6,11 +6,11 @@
|
|||||||
|
|
||||||
|
|
||||||
#define PLAYER_OWNS(id) (gh->getPlayerAt(c)==gh->getOwner(id))
|
#define PLAYER_OWNS(id) (gh->getPlayerAt(c)==gh->getOwner(id))
|
||||||
#define ERROR_AND_RETURN {if(c) *c << &SystemMessage("You are not allowed to perform this action!"); \
|
#define ERROR_AND_RETURN do {if(c) *c << &SystemMessage("You are not allowed to perform this action!"); \
|
||||||
tlog1<<"Player is not allowed to perform this action!\n"; \
|
tlog1<<"Player is not allowed to perform this action!\n"; \
|
||||||
return false;}
|
return false;} while(0)
|
||||||
#define ERROR_IF_NOT_OWNS(id) if(!PLAYER_OWNS(id)) ERROR_AND_RETURN
|
#define ERROR_IF_NOT_OWNS(id) if(!PLAYER_OWNS(id)) ERROR_AND_RETURN
|
||||||
#define COMPLAIN_AND_RETURN(txt) { gh->complain(txt); ERROR_AND_RETURN }
|
#define COMPLAIN_AND_RETURN(txt) { gh->complain(txt); ERROR_AND_RETURN; }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NetPacksServer.cpp, part of VCMI engine
|
* NetPacksServer.cpp, part of VCMI engine
|
||||||
@ -43,6 +43,8 @@ bool CloseServer::applyGh( CGameHandler *gh )
|
|||||||
|
|
||||||
bool EndTurn::applyGh( CGameHandler *gh )
|
bool EndTurn::applyGh( CGameHandler *gh )
|
||||||
{
|
{
|
||||||
|
if(gh->getPlayerAt(c) != GS(gh)->currentPlayer)
|
||||||
|
ERROR_AND_RETURN;
|
||||||
gh->states.setFlag(GS(gh)->currentPlayer,&PlayerStatus::makingTurn,false);
|
gh->states.setFlag(GS(gh)->currentPlayer,&PlayerStatus::makingTurn,false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user