Skip to content

Commit

Permalink
Fix more visibility asserts in campaign
Browse files Browse the repository at this point in the history
Should not have visibility data in droids on
board a transporter, but these were created when
a game was loaded with droids already boarded.

Should not try to check for visibility toward the
campaign transporter, since it can be off-map and
off-map coordinates are crashy.

See ticket:4743
  • Loading branch information
perim committed Feb 12, 2018
1 parent 0ea2dbe commit 530d67a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/game.cpp
Expand Up @@ -4637,12 +4637,12 @@ static bool loadSaveDroid(const char *pFileName, DROID **ppsCurrentDroidLists)
if (psGroup->type == GT_TRANSPORTER)
{
psDroid->selected = false; // Droid should be visible in the transporter interface.
visRemoveVisibility(psDroid); // should not have visibility data when in a transporter
}
}
else
{
if (isTransporter(psDroid)
|| psDroid->droidType == DROID_COMMAND)
if (isTransporter(psDroid) || psDroid->droidType == DROID_COMMAND)
{
DROID_GROUP *psGroup = grpCreate();
psGroup->add(psDroid);
Expand Down
6 changes: 6 additions & 0 deletions src/visibility.cpp
Expand Up @@ -432,6 +432,12 @@ int visibleObject(const BASE_OBJECT *psViewer, const BASE_OBJECT *psTarget, bool

int range = objSensorRange(psViewer);

// transporter in campaign ignores normal rules, can eg be off map
if (game.type == CAMPAIGN && psTarget->type == OBJ_DROID && isTransporter(castDroid(psTarget)))
{
return 0;
}

/* Get the sensor range */
switch (psViewer->type)
{
Expand Down

0 comments on commit 530d67a

Please sign in to comment.