Fix shooting at cloacked units.

Fix vision bug when killing detectors.
This commit is contained in:
nobody_ 2004-01-30 09:48:01 +00:00
parent 9ceddd25b8
commit 78407a7a75
5 changed files with 8 additions and 5 deletions

View file

@ -82,10 +82,12 @@ global void HandleActionDie(Unit* unit)
DebugCheck(unit->Type->TileWidth != unit->Type->CorpseType->TileWidth ||
unit->Type->TileHeight != unit->Type->CorpseType->TileHeight);
unit->Type = unit->Type->CorpseType;
// Update sight for new corpse
// We have to unmark BEFORE changing the type.
// Always do that, since types can have different vision properties.
MapUnmarkUnitSight(unit);
unit->Type = unit->Type->CorpseType;
unit->CurrentSightRange = unit->Type->Stats[unit->Player->Player].SightRange;
MapMarkUnitSight(unit);

View file

@ -521,6 +521,7 @@ extern void MapSetWall(unsigned x, unsigned y, int humanwall);
MapSight((unit)->Player, (unit)->X,(unit)->Y, (unit)->Type->TileWidth,\
(unit)->Type->TileHeight, (unit)->CurrentSightRange, MapMarkTileSight); \
if (unit->Type->DetectCloak) { \
DebugLevel0Fn("P%d Mark detect cloak at %d, %d\n" _C_ (unit)->Player->Player _C_ (unit)->X _C_ (unit)->Y);\
MapSight((unit)->Player, (unit)->X,(unit)->Y, (unit)->Type->TileWidth,\
(unit)->Type->TileHeight, (unit)->CurrentSightRange, MapMarkTileDetectCloak); \
}\
@ -531,6 +532,7 @@ extern void MapSetWall(unsigned x, unsigned y, int humanwall);
MapSight((unit)->Player,(unit)->X,(unit)->Y, (unit)->Type->TileWidth,\
(unit)->Type->TileHeight,(unit)->CurrentSightRange,MapUnmarkTileSight); \
if (unit->Type->DetectCloak) { \
DebugLevel0Fn("P%d Unmark detect cloak at %d, %d\n" _C_ (unit)->Player->Player _C_ (unit)->X _C_ (unit)->Y);\
MapSight((unit)->Player, (unit)->X,(unit)->Y, (unit)->Type->TileWidth,\
(unit)->Type->TileHeight, (unit)->CurrentSightRange, MapUnmarkTileDetectCloak); \
}\

View file

@ -2892,6 +2892,7 @@ global void LetUnitDie(Unit* unit)
} else {
unit->CurrentSightRange = 0;
}
DebugLevel0Fn("%s\n" _C_ unit->Type->Name);
MapMarkUnitSight(unit);
}

View file

@ -1635,7 +1635,7 @@ local void DrawInformations(const Unit* unit, const UnitType* type, int x, int y
const UnitStats* stats;
int r;
#if 0 // This is for showing vis counts and refs.
#if 1 // This is for showing vis counts and refs.
char buf[10];
sprintf(buf, "%d%c%c%d", unit->VisCount[ThisPlayer->Player],
unit->Seen.ByPlayer & (1 << ThisPlayer->Player) ? 'Y' : 'N',

View file

@ -781,9 +781,7 @@ global Unit* AttackUnitsInDistance(Unit* unit, int range)
for (i = 0; i < n; ++i) {
dest = table[i];
// Do NOT check vision.
if (dest->Removed || dest->Invisible || !unit->HP
|| dest->Orders[0].Action == UnitActionDie) {
if (!UnitVisibleOnMap(dest, unit->Player)) {
continue;
}