newnet: Remove SendDroidMove call which was causing desynch. Remove entire SendDroidMove and recvDroidMove functions, and GAME_DROIDMOVE, which are all no longer used.
Was possible to actually play one side of a whole Sk-Rush full-bases game, without going out of synch. (The other side was inactive, so it was a short game.)master
parent
69435aa87e
commit
f7129d69ad
|
@ -254,9 +254,9 @@ extern LOBBY_ERROR_TYPES LobbyError; // from src/multiint.c
|
|||
** ie ("trunk", "2.1.3", ...)
|
||||
************************************************************************************
|
||||
**/
|
||||
char VersionString[VersionStringSize] = "trunk, netcode 4.0";
|
||||
char VersionString[VersionStringSize] = "trunk, netcode 4.1";
|
||||
static int NETCODE_VERSION_MAJOR = 4;
|
||||
static int NETCODE_VERSION_MINOR = 0;
|
||||
static int NETCODE_VERSION_MINOR = 1;
|
||||
static int NETCODE_HASH = 0; // unused for now
|
||||
|
||||
static int checkSockets(const SocketSet* set, unsigned int timeout);
|
||||
|
@ -4042,7 +4042,6 @@ const char *messageTypeToString(unsigned messageType_)
|
|||
case GAME_DROID: return "GAME_DROID";
|
||||
case GAME_DROIDINFO: return "GAME_DROIDINFO";
|
||||
case GAME_DROIDDEST: return "GAME_DROIDDEST";
|
||||
case GAME_DROIDMOVE: return "GAME_DROIDMOVE";
|
||||
case GAME_GROUPORDER: return "GAME_GROUPORDER";
|
||||
case GAME_TEMPLATE: return "GAME_TEMPLATE";
|
||||
case GAME_TEMPLATEDEST: return "GAME_TEMPLATEDEST";
|
||||
|
|
|
@ -88,7 +88,6 @@ typedef enum
|
|||
GAME_DROID, ///< a new droid
|
||||
GAME_DROIDINFO, ///< update a droid order.
|
||||
GAME_DROIDDEST, ///< issue a droid destruction
|
||||
GAME_DROIDMOVE, ///< move a droid, don't change anything else though..
|
||||
GAME_GROUPORDER, ///< order a group of droids.
|
||||
GAME_TEMPLATE, ///< a new template
|
||||
GAME_TEMPLATEDEST, ///< remove template
|
||||
|
|
|
@ -319,14 +319,6 @@ static BOOL moveDroidToBase(DROID *psDroid, UDWORD x, UDWORD y, BOOL bFormation)
|
|||
|
||||
CHECK_DROID(psDroid);
|
||||
|
||||
if(bMultiMessages && (psDroid->sMove.Status != MOVEWAITROUTE))
|
||||
{
|
||||
if(SendDroidMove(psDroid,x,y,bFormation) == false)
|
||||
{// dont make the move since we'll recv it anyway
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// in multiPlayer make Transporter move like the vtols
|
||||
if ( psDroid->droidType == DROID_TRANSPORTER && game.maxPlayers == 0)
|
||||
{
|
||||
|
|
|
@ -430,91 +430,6 @@ BOOL recvDroidDisEmbark(NETQUEUE queue)
|
|||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// Droids
|
||||
|
||||
// posibly Send an updated droid movement order.
|
||||
BOOL SendDroidMove(const DROID* psDroid, uint32_t x, uint32_t y, BOOL formation)
|
||||
{
|
||||
if (!bMultiMessages)
|
||||
return true;
|
||||
|
||||
ASSERT(x > 0 && y > 0, "SendDroidMove: Invalid move order");
|
||||
|
||||
// Don't allow a move to happen at all if it is not our responsibility
|
||||
if (!myResponsibility(psDroid->player))
|
||||
{
|
||||
return false; // Do not allow move
|
||||
}
|
||||
|
||||
// If the unit has no actions or orders, allow it to happen but do not send
|
||||
if (psDroid->action == DACTION_NONE || psDroid->order == DORDER_MOVE)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
NETbeginEncode(NETgameQueue(selectedPlayer), GAME_DROIDMOVE);
|
||||
{
|
||||
uint8_t player = psDroid->player;
|
||||
uint32_t droid = psDroid->id;
|
||||
|
||||
NETuint8_t(&player);
|
||||
NETuint32_t(&droid);
|
||||
NETuint32_t(&x);
|
||||
NETuint32_t(&y);
|
||||
NETbool(&formation);
|
||||
}
|
||||
NETend();
|
||||
|
||||
return false; // false means not to do the move (until we receive the order we just sent).
|
||||
}
|
||||
|
||||
// recv and updated droid position
|
||||
BOOL recvDroidMove(NETQUEUE queue)
|
||||
{
|
||||
DROID* psDroid;
|
||||
uint32_t x, y;
|
||||
BOOL formation;
|
||||
|
||||
NETbeginDecode(queue, GAME_DROIDMOVE);
|
||||
{
|
||||
uint8_t player;
|
||||
uint32_t droid;
|
||||
|
||||
NETuint8_t(&player);
|
||||
NETuint32_t(&droid);
|
||||
NETuint32_t(&x);
|
||||
NETuint32_t(&y);
|
||||
NETbool(&formation);
|
||||
|
||||
NETend();
|
||||
|
||||
if ((x == 0 && y == 0) || x > world_coord(mapWidth) || y > world_coord(mapHeight))
|
||||
{
|
||||
/* Probably an invalid droid position */
|
||||
debug(LOG_ERROR, "Received an invalid droid position from %d, [%s : p%d]", queue.index,
|
||||
isHumanPlayer(player) ? "Human" : "AI", player);
|
||||
return false;
|
||||
}
|
||||
if (!IdToDroid(droid, player, &psDroid))
|
||||
{
|
||||
debug(LOG_ERROR, "Packet from %d refers to non-existent droid %u, [%s : p%d]",
|
||||
queue.index, droid, isHumanPlayer(player) ? "Human" : "AI", player);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
turnOffMultiMsg(true);
|
||||
if (formation)
|
||||
{
|
||||
moveDroidTo(psDroid, x, y); // Do the move
|
||||
}
|
||||
else
|
||||
{
|
||||
moveDroidToNoFormation(psDroid, x, y); // Move, no form...
|
||||
}
|
||||
turnOffMultiMsg(false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// ////////////////////////////////////////////////////////////////////////////
|
||||
// Send a new Droid to the other players
|
||||
BOOL SendDroid(const DROID_TEMPLATE* pTemplate, uint32_t x, uint32_t y, uint8_t player, uint32_t id, const INITIAL_DROID_ORDERS *initialOrdersP)
|
||||
|
|
|
@ -591,7 +591,7 @@ BOOL recvMessage(void)
|
|||
//case GAME_DROID: //24 down, 18 to go.
|
||||
//case GAME_DROIDINFO: // 2 down, 41 to go.
|
||||
//case GAME_DROIDDEST: //25 down, 17 to go.
|
||||
//case GAME_DROIDMOVE: // 1 down, 42 to go.
|
||||
//case GAME_DROIDMOVE: // 1 down, 42 to go. <--- Doesn't even exist, now. Its only effect was breaking synch...
|
||||
//case GAME_GROUPORDER: // 3 down, 40 to go.
|
||||
//case GAME_CHECK_DROID: // 4 down, 39 to go.
|
||||
//case GAME_CHECK_STRUCT: // 5 down, 38 to go.
|
||||
|
@ -661,9 +661,6 @@ BOOL recvMessage(void)
|
|||
case GAME_DROIDDEST: // droid destroy
|
||||
recvDestroyDroid(queue);
|
||||
break;
|
||||
case GAME_DROIDMOVE: // move a droid to x,y command.
|
||||
recvDroidMove(queue);
|
||||
break;
|
||||
case GAME_GROUPORDER: // an order for more than 1 droid.
|
||||
recvGroupOrder(queue);
|
||||
break;
|
||||
|
|
|
@ -172,7 +172,6 @@ extern BOOL SendDroid (const DROID_TEMPLATE* pTemplate, uint32
|
|||
extern BOOL SendDestroyDroid (const DROID* psDroid);
|
||||
extern BOOL SendDemolishFinished(STRUCTURE *psS,DROID *psD);
|
||||
extern BOOL SendDroidInfo (const DROID* psDroid, DROID_ORDER order, uint32_t x, uint32_t y, const BASE_OBJECT* psObj, const BASE_STATS *psStats, uint32_t x2, uint32_t y2);
|
||||
extern BOOL SendDroidMove (const DROID* psDroid, uint32_t x, uint32_t y, BOOL formation);
|
||||
extern BOOL SendGroupOrderSelected(uint8_t player, uint32_t x, uint32_t y, const BASE_OBJECT* psObj, BOOL altOrder);
|
||||
extern BOOL SendCmdGroup (DROID_GROUP *psGroup, UWORD x, UWORD y, BASE_OBJECT *psObj);
|
||||
|
||||
|
|
Loading…
Reference in New Issue