#1901: VTOL moving off the map and crashing the game with ASSERT
-----------------------------------------------------------+----------------
Reporter: freakyd <iamabigwiener...@…> | Type: bug
Status: new | Priority:
major
Milestone: 3.0 | Component:
Campaign
Version: svn/trunk | Keywords:
Operating_system: All/Non-Specific | Blockedby:
Blocking: |
-----------------------------------------------------------+----------------
the code in move.c 1930 used to say:
{{{
/* 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 */
destroyDroid( psDroid );
return;
}
}}}
instead I inserted the world clipping code to prevent any occurance of the
"hack" code that destroys the droid or the ASSERT which halts execution.
{{{if (psDroid->droidType != DROID_TRANSPORTER)
{
printf("droid trying to move off the map!\n");
psDroid->pos.x = MAX(1, psDroid->pos.x);
psDroid->pos.x = MIN(world_coord(GetWidthOfMap()) - 1,
psDroid->pos.x);
psDroid->pos.y = MAX(1,psDroid->pos.y);
psDroid->pos.y = MIN(world_coord(GetHeightOfMap()) - 1,
psDroid->pos.y);
printf("returning to map.\n");
}
}}}
--
Ticket URL: <http://developer.wz2100.net/ticket/1901>
Warzone 2100 Trac <http://developer.wz2100.net/>
The Warzone 2100 Project
_______________________________________________
Warzone-dev mailing list
[email protected]
https://mail.gna.org/listinfo/warzone-dev