Only Update Units that are seen by me

This commit is contained in:
mr-russ 2003-03-06 09:09:47 +00:00
parent 9aa8b9523d
commit 1bb6051260
2 changed files with 16 additions and 15 deletions
src

View file

@ -137,8 +137,6 @@ global void RevealMap(void)
for (i = 0; i < PlayerMax; ++i) {
if (!TheMap.Fields[ix+iy*TheMap.Width].Visible[i]) {
TheMap.Fields[ix+iy*TheMap.Width].Visible[i]=1;
if (IsMapFieldVisible(&Players[i],ix,iy)) {
UnitsMarkSeen(ix,iy);
}
}
}
@ -151,6 +149,7 @@ global void RevealMap(void)
}
#endif
MapMarkSeenTile(ix, iy);
UnitsMarkSeen(ix, iy);
}
}
}

View file

@ -1122,21 +1122,23 @@ global void UnitsMarkSeen(int x,int y)
int n;
Unit* units[UnitMax];
n = SelectUnitsOnTile(x,y,units);
// FIXME: need to handle Dead buldings
while( n ) {
units[n-1]->SeenIY=units[n-1]->IY;
units[n-1]->SeenIX=units[n-1]->IX;
units[n-1]->SeenFrame = units[n-1]->Frame;
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 ) {
if( IsMapFieldVisible(ThisPlayer, x, y) ) {
n = SelectUnitsOnTile(x,y,units);
// FIXME: need to handle Dead buldings
while( n ) {
units[n-1]->SeenIY=units[n-1]->IY;
units[n-1]->SeenIX=units[n-1]->IX;
units[n-1]->SeenFrame = units[n-1]->Frame;
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;
}
units[n-1]->SeenConstructed = units[n-1]->Constructed;
units[n-1]->SeenDestroyed = units[n-1]->Destroyed;
--n;
}
}