Fix bug in r3395 which made droids on the move explode when savegame was
loaded. Also check movement parameters for droids stricter in debug mode. git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3502 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
ecc82d493e
commit
aa31d39054
|
@ -520,6 +520,7 @@ do { \
|
|||
assert(droid->numWeaps <= DROID_MAXWEAPS); \
|
||||
assert(droid->listSize <= ORDER_LIST_MAX); \
|
||||
assert(droid->player < MAX_PLAYERS); \
|
||||
assert(worldOnMap(droid->sMove.fx, droid->sMove.fy)); \
|
||||
\
|
||||
for (i = 0; i < DROID_MAXWEAPS; ++i) \
|
||||
assert(droid->turretRotation[i] <= 360); \
|
||||
|
|
21
src/game.c
21
src/game.c
|
@ -5674,11 +5674,11 @@ static void SaveDroidMoveControl(SAVE_DROID * const psSaveDroid, DROID const * c
|
|||
psSaveDroid->sMove.targetY = PHYSFS_swapSLE32(psDroid->sMove.targetY);
|
||||
|
||||
// Little endian floats
|
||||
psSaveDroid->sMove.fx = PHYSFS_swapSLE32(*(uint32_t*)(void*)&psDroid->sMove.fx);
|
||||
psSaveDroid->sMove.fy = PHYSFS_swapSLE32(*(uint32_t*)(void*)&psDroid->sMove.fy);
|
||||
psSaveDroid->sMove.speed = PHYSFS_swapSLE32(*(uint32_t*)(void*)&psDroid->sMove.speed);
|
||||
psSaveDroid->sMove.moveDir = PHYSFS_swapSLE32(*(uint32_t*)(void*)&psDroid->sMove.moveDir);
|
||||
psSaveDroid->sMove.fz = PHYSFS_swapSLE32(*(uint32_t*)(void*)&psDroid->sMove.fz);
|
||||
psSaveDroid->sMove.fx = PHYSFS_swapSLE32(psDroid->sMove.fx);
|
||||
psSaveDroid->sMove.fy = PHYSFS_swapSLE32(psDroid->sMove.fy);
|
||||
psSaveDroid->sMove.speed = PHYSFS_swapSLE32(psDroid->sMove.speed);
|
||||
psSaveDroid->sMove.moveDir = PHYSFS_swapSLE32(psDroid->sMove.moveDir);
|
||||
psSaveDroid->sMove.fz = PHYSFS_swapSLE32(psDroid->sMove.fz);
|
||||
|
||||
// Little endian SWORDs
|
||||
psSaveDroid->sMove.boundX = PHYSFS_swapSLE16(psDroid->sMove.boundX);
|
||||
|
@ -5742,11 +5742,12 @@ static void LoadDroidMoveControl(DROID * const psDroid, SAVE_DROID const * const
|
|||
psDroid->sMove.targetY = PHYSFS_swapSLE32(psSaveDroid->sMove.targetY);
|
||||
|
||||
// Little endian floats
|
||||
psDroid->sMove.fx = PHYSFS_swapSLE32(*(uint32_t*)(void*)&psSaveDroid->sMove.fx);
|
||||
psDroid->sMove.fy = PHYSFS_swapSLE32(*(uint32_t*)(void*)&psSaveDroid->sMove.fy);
|
||||
psDroid->sMove.speed = PHYSFS_swapSLE32(*(uint32_t*)(void*)&psSaveDroid->sMove.speed);
|
||||
psDroid->sMove.moveDir = PHYSFS_swapSLE32(*(uint32_t*)(void*)&psSaveDroid->sMove.moveDir);
|
||||
psDroid->sMove.fz = PHYSFS_swapSLE32(*(uint32_t*)(void*)&psSaveDroid->sMove.fz);
|
||||
psDroid->sMove.fx = PHYSFS_swapSLE32(psSaveDroid->sMove.fx);
|
||||
psDroid->sMove.fy = PHYSFS_swapSLE32(psSaveDroid->sMove.fy);
|
||||
psDroid->sMove.speed = PHYSFS_swapSLE32(psSaveDroid->sMove.speed);
|
||||
psDroid->sMove.moveDir = PHYSFS_swapSLE32(psSaveDroid->sMove.moveDir);
|
||||
psDroid->sMove.fz = PHYSFS_swapSLE32(psSaveDroid->sMove.fz);
|
||||
assert(worldOnMap(psDroid->sMove.fx, psDroid->sMove.fy));
|
||||
|
||||
// Little endian SWORDs
|
||||
psDroid->sMove.boundX = PHYSFS_swapSLE16(psSaveDroid->sMove.boundX);
|
||||
|
|
10
src/move.c
10
src/move.c
|
@ -2332,15 +2332,11 @@ static void moveUpdateDroidPos( DROID *psDroid, float dx, float dy )
|
|||
/* impact if about to go off map else update coordinates */
|
||||
if ( worldOnMap( iX, iY ) == FALSE )
|
||||
{
|
||||
if ( psDroid->droidType == DROID_TRANSPORTER )
|
||||
{
|
||||
/* transporter going off-world - trigger next map */
|
||||
|
||||
}
|
||||
else
|
||||
/* transporter going off-world will trigger next map, and is ok */
|
||||
ASSERT(psDroid->droidType == DROID_TRANSPORTER, "droid trying to move off the map!")
|
||||
if (psDroid->droidType != DROID_TRANSPORTER)
|
||||
{
|
||||
/* dreadful last-ditch crash-avoiding hack - sort this! - GJ */
|
||||
debug(LOG_ERROR, "**** droid about to go off map - destroying it ****");
|
||||
destroyDroid( psDroid );
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue