Fix a bug in whosResponsible() which caused execution of AI scripts on a client instead of the host in some cases.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4540 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
72240c1958
commit
674db841fa
|
@ -97,9 +97,6 @@ typedef struct
|
||||||
unsigned int bytes;
|
unsigned int bytes;
|
||||||
} NETBUFSOCKET;
|
} NETBUFSOCKET;
|
||||||
|
|
||||||
/// This is the hardcoded dpid (player ID) value for the hosting player.
|
|
||||||
#define HOST_DPID 1
|
|
||||||
|
|
||||||
#define PLAYER_HOST 1
|
#define PLAYER_HOST 1
|
||||||
|
|
||||||
// ////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -157,6 +157,9 @@ typedef struct {
|
||||||
uint32_t bHost; // true if we are hosting the session
|
uint32_t bHost; // true if we are hosting the session
|
||||||
} NETPLAY;
|
} NETPLAY;
|
||||||
|
|
||||||
|
/// This is the hardcoded dpid (player ID) value for the hosting player.
|
||||||
|
#define HOST_DPID 1
|
||||||
|
|
||||||
// ////////////////////////////////////////////////////////////////////////
|
// ////////////////////////////////////////////////////////////////////////
|
||||||
// variables
|
// variables
|
||||||
|
|
||||||
|
|
|
@ -487,7 +487,6 @@ BOOL isHumanPlayer(UDWORD player)
|
||||||
UDWORD whosResponsible(UDWORD player)
|
UDWORD whosResponsible(UDWORD player)
|
||||||
{
|
{
|
||||||
UDWORD c;
|
UDWORD c;
|
||||||
SDWORD i;
|
|
||||||
|
|
||||||
c = ANYPLAYER;
|
c = ANYPLAYER;
|
||||||
if (isHumanPlayer(player))
|
if (isHumanPlayer(player))
|
||||||
|
@ -502,26 +501,16 @@ UDWORD whosResponsible(UDWORD player)
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// crawl down array to find a responsible fellow,
|
SDWORD player;
|
||||||
for(i=player; i>=0; i--)
|
|
||||||
{
|
|
||||||
if(isHumanPlayer(i))
|
|
||||||
{
|
|
||||||
c = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// else crawl up to find a responsible fellow
|
|
||||||
if(c == ANYPLAYER)
|
|
||||||
{
|
|
||||||
for(i=player; i<MAX_PLAYERS; i++)
|
|
||||||
{
|
|
||||||
if(isHumanPlayer(i))
|
|
||||||
{
|
|
||||||
c = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// find the host using HOST_DPID
|
||||||
|
for(player=0;player <= MAX_PLAYERS && c == ANYPLAYER;player++)
|
||||||
|
{
|
||||||
|
if(player2dpid[player] == HOST_DPID)
|
||||||
|
{
|
||||||
|
c = player;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(c == ANYPLAYER)
|
if(c == ANYPLAYER)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue