Fixes to DESTROYED_BUILDING code.

This commit is contained in:
mr-russ 2003-02-08 06:02:48 +00:00
parent 835688388a
commit 796b78aa95
4 changed files with 13 additions and 3 deletions

View file

@ -511,6 +511,7 @@ struct _unit_ {
unsigned Constructed : 1; /// Unit is in construction
unsigned SeenConstructed : 1; /// Unit seen construction
unsigned SeenState : 3; /// Unit seen build/upgrade state
unsigned SeenDestroyed : 1; /// Unit seen destroyed or not
unsigned Active : 1; /// Unit is active for AI
unsigned Rescued : 1; /// Unit is rescued

View file

@ -292,7 +292,8 @@ global void DrawMinimap(int vx __attribute__((unused)),
table = &DestroyedBuildings;
while( *table ) {
SysColors color;
if( !BuildingVisibleOnMap( *table ) ) {
if( !BuildingVisibleOnMap( *table ) && (*table)->SeenState != 3
&& !(*table)->SeenDestroyed ) {
type=(*table)->SeenType;
if( !type ) {
table=&(*table)->Next;

View file

@ -240,7 +240,7 @@ global void ReleaseUnit(Unit* unit)
IfDebug(
DebugLevel2Fn("%lu:No more references %d\n" _C_
GameCycle _C_ UnitNumber(unit));
unit->Type=NULL; // for debugging.
// unit->Type=NULL; // for debugging.
);
}
@ -1120,7 +1120,11 @@ global void UnitsMarkSeen(int x,int y)
units[n-1]->SeenType = units[n-1]->Type;
units[n-1]->SeenState = (units[n-1]->Orders[0].Action==UnitActionBuilded) |
((units[n-1]->Orders[0].Action==UnitActionUpgradeTo) << 1);
if( units[n-1]->Orders[0].Action==UnitActionDie ) {
units[n-1]->SeenState = 3;
}
units[n-1]->SeenConstructed = units[n-1]->Constructed;
units[n-1]->SeenDestroyed = units[n-1]->Destroyed;
--n;
}
}
@ -1148,7 +1152,11 @@ global void UnitMarkSeen(Unit* unit)
unit->SeenType = unit->Type;
unit->SeenState = (unit->Orders[0].Action==UnitActionBuilded) |
((unit->Orders[0].Action==UnitActionUpgradeTo) << 1);
if( unit->Orders[0].Action==UnitActionDie ) {
unit->SeenState = 3;
}
unit->SeenConstructed = unit->Constructed;
unit->SeenDestroyed = unit->Destroyed;
x=unit->Type->TileWidth;
y=unit->Type->TileHeight;
}

View file

@ -1912,7 +1912,7 @@ global void DrawUnits(const void* v)
//
corpses = &DestroyedBuildings;
while( *corpses ) {
if( UnitVisibleInViewport(vp,*corpses) ) {
if( UnitVisibleInViewport(vp,*corpses) && !(*corpses)->SeenDestroyed ) {
DrawBuilding(*corpses);
}
corpses=&(*corpses)->Next;