From aea09336724abed18f32a00d5578f3bf2a6d715c Mon Sep 17 00:00:00 2001 From: Cyp Date: Sat, 23 Oct 2010 22:15:21 +0200 Subject: [PATCH] Don't desynch on embarking nor crash on disembarking. --- src/order.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/order.c b/src/order.c index 744397187..e4f578e7b 100644 --- a/src/order.c +++ b/src/order.c @@ -851,26 +851,24 @@ void orderUpdateDroid(DROID *psDroid) else if (abs((SDWORD)psDroid->pos.x - (SDWORD)psDroid->psTarget->pos.x) < TILE_UNITS && abs((SDWORD)psDroid->pos.y - (SDWORD)psDroid->psTarget->pos.y) < TILE_UNITS) { - // if in multiPlayer, only want to process if this player's droid - if (!bMultiPlayer || psDroid->player == selectedPlayer) - { - // save the target of current droid (the transporter) - DROID * transporter = (DROID *)psDroid->psTarget; + // save the target of current droid (the transporter) + DROID * transporter = (DROID *)psDroid->psTarget; - // Make sure that it really is a valid droid - CHECK_DROID(transporter); + // Make sure that it really is a valid droid + CHECK_DROID(transporter); - // order the droid to stop so moveUpdateDroid does not process this unit - orderDroid(psDroid, DORDER_STOP); - setDroidTarget(psDroid, NULL); - psDroid->psTarStats = NULL; - secondarySetState(psDroid, DSO_RETURN_TO_LOC, DSS_NONE); + // order the droid to stop so moveUpdateDroid does not process this unit + turnOffMultiMsg(true); // Do this now, since synchronised. If sending later, it's too late. + orderDroid(psDroid, DORDER_STOP); + turnOffMultiMsg(false); + setDroidTarget(psDroid, NULL); + psDroid->psTarStats = NULL; + secondarySetState(psDroid, DSO_RETURN_TO_LOC, DSS_NONE); - /* We must add the droid to the transporter only *after* - * processing changing its orders (see above). - */ - transporterAddDroid(transporter, psDroid); - } + /* We must add the droid to the transporter only *after* + * processing changing its orders (see above). + */ + transporterAddDroid(transporter, psDroid); } else if (psDroid->action == DACTION_NONE) {