macros MAPFIELD,MAPMOVE,IMMAP,INMAP,... removed

This commit is contained in:
johns 2000-04-28 20:36:33 +00:00
parent dc5edeeb24
commit 84582d1930
8 changed files with 282 additions and 161 deletions

View file

@ -72,8 +72,10 @@ typedef struct _map_field_ {
#endif
} MapField;
#ifndef NEW_FOW
#define MapFieldVisible 0x0001 /// Field visible
#define MapFieldExplored 0x0002 /// Field explored
#endif
#define MapFieldArray 0x0004 /// More than one unit on the field
@ -254,18 +256,17 @@ extern void MapSetWall(unsigned x,unsigned y,int humanwall);
-- Defines
----------------------------------------------------------------------------*/
/// Can an unit with 'mask' can enter the field.
#define CanMoveToMask(x,y,mask) \
!(TheMap.Fields[(x)+(y)*TheMap.Width].Flags&(mask))
#define MAPFIELD(xx,yy) TheMap.Fields[(xx)+(yy)*TheMap.Width]
#define MAPMOVE(xx,yy) TheMap.MovementMap[(xx)+(yy)*TheMap.Width]
#define INMAP(xx,yy) ((xx)>=0&&(yy)>=0&&(xx)<TheMap.Width&&(yy)<TheMap.Height)
#define MAPVISIBLE(xx,yy) (INMAP(xx,yy) ? !!(TheMap.Fields[(yy)*TheMap.Width+(xx)].Flags&MapFieldVisible ) : 1)
#define MAPEXPLORED(xx,yy) (INMAP(xx,yy) ? !!(TheMap.Fields[(yy)*TheMap.Width+(xx)].Flags&MapFieldExplored) : 1)
/// Check if a field for the user is explored
#define IsMapFieldExplored(x,y) \
(TheMap.Fields[(y)*TheMap.Width+(x)].Flags&MapFieldExplored)
#define MAPTILE(xx,yy) (MAPFIELD(xx,yy).Tile)
#define MAPSEENTILE(xx,yy) (MAPFIELD(xx,yy).SeenTile)
#define TILETYPE(tile) (TheMap.Tileset->TileTypeTable[tile])
/// Check if a field for the user is visibile
#define IsMapFieldVisible(x,y) \
(TheMap.Fields[(y)*TheMap.Width+(x)].Flags&MapFieldVisible)
#define UNEXPLORED_TILE 0

View file

@ -143,54 +143,63 @@ global void SaveMap(FILE* file)
}
/*----------------------------------------------------------------------------
--
-- Visibile and explored handling
----------------------------------------------------------------------------*/
/**
** Marks seen tile -- used mainly for the Fog Of War
**
** @param x Map X position.
** @param y Map Y position.
*/
global void MapMarkSeenTile( int x, int y )
{
int t, st; // tile, seentile
int t, st; // tile, seentile
MapField* mf;
if (MAPFIELD(x,y).SeenTile == MAPFIELD(x,y).Tile) return;
t = MAPFIELD(x,y).Tile;
st = MAPFIELD(x,y).SeenTile;
MAPFIELD(x,y).SeenTile = MAPFIELD(x,y).Tile;
if( !TheMap.Tileset ) return; // FIXME: this is needed, because tileset
// is loaded after this function is needed
// LoadPud, PlaceUnit, ... MapMarkSeenTile
// handle WOODs
if ( st != TheMap.Tileset->NoWoodTile && t == TheMap.Tileset->NoWoodTile )
MapFixWood( x, y );
else
if ( st == TheMap.Tileset->NoWoodTile && t != TheMap.Tileset->NoWoodTile )
FixWood( x, y );
else
if ( MapWoodChk( x, y ) && t != st )
{
FixWood( x, y );
MapFixWood( x, y );
mf=TheMap.Fields+x+y*TheMap.Width;
t = mf->Tile;
st = mf->SeenTile;
if ( st == t ) { // Nothing changed.
return;
}
// handle WALLs
#define ISTILEWALL(t) (TILETYPE(t) == TileTypeHWall || TILETYPE(t) == TileTypeOWall)
if ( ISTILEWALL(st) && !ISTILEWALL(st) )
MapFixWall( x, y );
else
if ( !ISTILEWALL(st) && ISTILEWALL(st) )
FixWall( x, y );
else
if ( MapWallChk( x, y, -1 ) && t != st )
{
FixWall( x, y );
MapFixWall( x, y );
mf->SeenTile=t;
// FIXME: this is needed, because tileset is loaded after this function
// is needed LoadPud, PlaceUnit, ... MapMarkSeenTile
if( !TheMap.Tileset ) {
return;
}
};
// handle WOODs
if ( st != TheMap.Tileset->NoWoodTile
&& t == TheMap.Tileset->NoWoodTile ) {
MapFixWood( x, y );
} else if ( st == TheMap.Tileset->NoWoodTile
&& t != TheMap.Tileset->NoWoodTile ) {
FixWood( x, y );
} else if ( MapWoodChk( x, y ) ) {
FixWood( x, y );
MapFixWood( x, y );
}
// handle WALLs
#define ISTILEWALL(tile) \
(TheMap.Tileset->TileTypeTable[(tile)] == TileTypeHWall \
|| TheMap.Tileset->TileTypeTable[(tile)] == TileTypeOWall)
if ( ISTILEWALL(st) && !ISTILEWALL(st) )
MapFixWall( x, y );
else if ( !ISTILEWALL(st) && ISTILEWALL(st) )
FixWall( x, y );
else if ( MapWallChk( x, y, -1 ) ) {
FixWall( x, y );
MapFixWall( x, y );
}
}
/**
** Reveal the entire map.
@ -201,10 +210,9 @@ global void RevealMap(void)
for ( ix = 0; ix < TheMap.Width; ix++ ) {
for ( iy = 0; iy < TheMap.Height; iy++ ) {
MAPFIELD(ix,iy).Flags |= MapFieldExplored;
if (TheMap.NoFogOfWar) {
MAPFIELD(ix,iy).Flags |= MapFieldVisible;
}
TheMap.Fields[ix+iy*TheMap.Width].Flags
|= MapFieldExplored
| TheMap.NoFogOfWar ? MapFieldVisible : 0;
MapMarkSeenTile(ix,iy);
}
}
@ -255,6 +263,7 @@ global void MapCenter(int x,int y)
**
** @param x X map tile position.
** @param y Y map tile position.
**
** @return True if water, false otherwise.
*/
global int WaterOnMap(int tx,int ty)
@ -314,6 +323,11 @@ global int OrcWallOnMap(int tx,int ty)
/**
** Forest on map tile. Checking version.
**
** @param x X map tile position.
** @param y Y map tile position.
**
** @return True if forest, false otherwise.
*/
global int CheckedForestOnMap(int tx,int ty)
{
@ -325,6 +339,11 @@ global int CheckedForestOnMap(int tx,int ty)
/**
** Forest on map tile.
**
** @param x X map tile position.
** @param y Y map tile position.
**
** @return True if forest, false otherwise.
*/
global int ForestOnMap(int tx,int ty)
{
@ -342,6 +361,12 @@ global int ForestOnMap(int tx,int ty)
/**
** Can move to this point, applying mask.
**
** @param x X map tile position.
** @param y Y map tile position.
** @param mask Mask for movement to apply.
**
** @return True if could be entered, false otherwise.
*/
global int CheckedCanMoveToMask(int x,int y,int mask)
{
@ -355,6 +380,12 @@ global int CheckedCanMoveToMask(int x,int y,int mask)
#ifndef CanMoveToMask
/**
** Can move to this point, applying mask.
**
** @param x X map tile position.
** @param y Y map tile position.
** @param mask Mask for movement to apply.
**
** @return True if could be entered, false otherwise.
*/
global int CanMoveToMask(int x,int y,int mask)
{
@ -376,6 +407,7 @@ global int CanMoveToMask(int x,int y,int mask)
** This flags are used to mark the field for this unit.
**
** @param unit Pointer to unit.
**
** @return Field flags to be set.
*/
global unsigned UnitFieldFlags(const Unit* unit)
@ -418,7 +450,7 @@ global int TypeMovementMask(const UnitType* type)
case UnitTypeFly: // in air
return MapFieldAirUnit; // already occuppied
case UnitTypeNaval: // on water
if( type->Transporter ) {
if( type->Transporter ) {
return MapFieldLandUnit
| MapFieldSeaUnit
| MapFieldBuilding // already occuppied
@ -448,35 +480,76 @@ global int UnitMovementMask(const Unit* unit)
return TypeMovementMask(unit->Type);
}
/*----------------------------------------------------------------------------
*/
/**
** Fixes initially the wood and seen tiles.
*/
global void PreprocessMap(void)
{
unsigned ix, iy;
unsigned ix, iy;
MapField* mf;
for ( ix = 0; ix < TheMap.Width; ix++ )
for ( iy = 0; iy < TheMap.Height; iy++ )
{
MAPFIELD( ix, iy ).SeenTile = MAPFIELD( ix, iy ).Tile;
}
for ( ix = 0; ix < TheMap.Width; ix++ ) {
for ( iy = 0; iy < TheMap.Height; iy++ ) {
mf=TheMap.Fields+ix+iy*TheMap.Width;
mf->SeenTile=mf->Tile;
}
}
// it is required for fixing the wood that all tiles are marked as seen!
for ( ix = 0; ix < TheMap.Width; ix++ )
for ( iy = 0; iy < TheMap.Height; iy++ )
{
FixWood( ix, iy );
FixWall( ix, iy );
}
};
for ( ix = 0; ix < TheMap.Width; ix++ ) {
for ( iy = 0; iy < TheMap.Height; iy++ ) {
FixWood( ix, iy );
FixWall( ix, iy );
}
}
}
/**
** Convert a screen coordinate to map tile.
**
** @param x X screen coordinate.
**
** @returns X tile number.
*/
global int Screen2MapX(int x)
{
return (((x)-TheUI.MapX)/TileSizeX+MapX);
}
global int Screen2MapX(int x) { return (((x)-TheUI.MapX)/TileSizeX+MapX); }
global int Screen2MapY(int x) { return (((x)-TheUI.MapY)/TileSizeY+MapY); }
global int Map2ScreenX(int x) { return (TheUI.MapX+((x)-MapX)*TileSizeX); }
global int Map2ScreenY(int x) { return (TheUI.MapY+((x)-MapY)*TileSizeY); }
/**
** Convert a screen coordinate to map tile.
**
** @param y Y screen coordinate.
**
** @returns Y tile number.
*/
global int Screen2MapY(int y)
{
return (((y)-TheUI.MapY)/TileSizeY+MapY);
}
/**
** Convert a map tile into screen coordinate.
**
** @param x X tile number.
**
** @returns X screen coordinate.
*/
global int Map2ScreenX(int x)
{
return (TheUI.MapX+((x)-MapX)*TileSizeX);
}
/**
** Convert a map tile into screen coordinate.
**
** @param y Y tile number.
**
** @returns Y screen coordinate.
*/
global int Map2ScreenY(int y)
{
return (TheUI.MapY+((y)-MapY)*TileSizeY);
}
//@}

View file

@ -191,7 +191,7 @@ global void MapUpdateVisible(void)
if (TheMap.NoFogOfWar) {
for( x=0; x<TheMap.Width; ++x ) {
for( y=0; y<TheMap.Height; y++ ) {
if ( MAPVISIBLE(x,y) ) {
if ( IsMapFieldVisible(x,y) ) {
MapMarkSeenTile( x,y );
}
}

View file

@ -31,7 +31,7 @@
-- Declarations
----------------------------------------------------------------------------*/
// -1 is hack should be fixed later
// FIXME: -1 is hack should be fixed later
#define FIRST_ROCK_TILE (TheMap.Tileset->FirstRockTile-1)
/*----------------------------------------------------------------------------
@ -47,50 +47,71 @@ local const int RockTable[16] = {
-- Functions
----------------------------------------------------------------------------*/
local int RockChk(int x,int y) // used by FixRock and PreprocessMap
/**
** Check if the tile type is rock.
**
** Used by @see FixRock and @see PreprocessMap
*/
local int MapRockChk(int x,int y)
{
if( !INMAP(x,y) ) return 1; // outside considered rock
return (TILETYPE(MAPSEENTILE(x,y)) == TileTypeRock);
if( x<0 || y<0 || x>=TheMap.Width || y>=TheMap.Height ) {
return 1; // outside considered rock
}
return TheMap.Tileset->TileTypeTable[
TheMap.Fields[(x)+(y)*TheMap.Width].SeenTile
] == TileTypeRock;
}
// FIXME: docu
local int FixRock(int x,int y) // used by MapRemoveRock and PreprocessMap
{
int tile = 0;
int tile;
MapField* mf;
if ( !INMAP(x,y) ) return 0;
if ( RockChk(x,y) == 0 ) return 0;
#define ROCK(xx,yy) (RockChk(xx,yy) != 0)
if (ROCK(x ,y-1)) tile |= 1<<0;
if (ROCK(x+1,y )) tile |= 1<<1;
if (ROCK(x ,y+1)) tile |= 1<<2;
if (ROCK(x-1,y )) tile |= 1<<3;
tile = RockTable[tile];
if (tile == -1)
MapRemoveRock(x,y);
else
{
if (tile == RockTable[15])
{
// Vladi: still to filter tiles w. corner empties -- note: the original
// tiles and order are not perfect either. It's a hack but is enough and
// looks almost fine.
if (RockChk(x+1,y-1) == 0) tile = 7; else
if (RockChk(x+1,y+1) == 0) tile = 10; else
if (RockChk(x-1,y+1) == 0) tile = 11; else
if (RockChk(x-1,y-1) == 0) tile = 4; else
tile = RockTable[15]; // not required really
}
tile += FIRST_ROCK_TILE;
if (MAPFIELD(x,y).SeenTile == tile) return 0;
MAPFIELD(x,y).SeenTile = tile;
// Outside map or no rock.
if( x<0 || y<0 || x>=TheMap.Width || y>=TheMap.Height ) {
return 0;
}
UpdateMinimapXY(x,y);
return 1;
if ( !MapRockChk(x,y) ) {
return 0;
}
#define ROCK(xx,yy) (MapRockChk(xx,yy) != 0)
tile = 0;
if (ROCK(x ,y-1)) tile |= 1<<0;
if (ROCK(x+1,y )) tile |= 1<<1;
if (ROCK(x ,y+1)) tile |= 1<<2;
if (ROCK(x-1,y )) tile |= 1<<3;
tile = RockTable[tile];
if (tile == -1) {
MapRemoveRock(x,y);
} else {
if (tile == RockTable[15]) {
// Vladi: still to filter tiles w. corner empties -- note: the original
// tiles and order are not perfect either. It's a hack but is enough and
// looks almost fine.
if (MapRockChk(x+1,y-1) == 0) tile = 7; else
if (MapRockChk(x+1,y+1) == 0) tile = 10; else
if (MapRockChk(x-1,y+1) == 0) tile = 11; else
if (MapRockChk(x-1,y-1) == 0) tile = 4; else
tile = RockTable[15]; // not required really
}
tile += FIRST_ROCK_TILE;
mf=TheMap.Fields+x+y*TheMap.Width;
if ( mf->SeenTile == tile) {
return 0;
}
mf->SeenTile = tile;
}
UpdateMinimapXY(x,y);
return 1;
}
// FIXME: docu
global void MapFixRock(int x,int y)
{
// side neighbors
@ -115,8 +136,12 @@ global void MapRemoveRock(unsigned x,unsigned y)
mf->Tile=TheMap.Tileset->NoRockTile;
mf->Flags &= ~(MapFieldRocks|MapFieldUnpassable);
UpdateMinimapXY(x,y);
MustRedraw|=RedrawMaps;
UpdateMinimapXY(x,y); // FIXME: should be done if visible?
// Must redraw map only if field is visibile
if( mf->Flags&MapFieldVisible ) {
MustRedraw|=RedrawMaps;
}
}
//@}

View file

@ -67,22 +67,30 @@ local int WallTable[16] = {
global int MapWallChk(int x,int y,int walltype) // used by FixWall, walltype==-1 for auto
{
if( !INMAP(x,y) ) return 1; // outside considered wall
// return !!(MAPFIELD(x,y).Flags & MapFieldForest);
if (walltype == -1)
return (TILETYPE(MAPSEENTILE(x,y)) == TileTypeHWall ||
TILETYPE(MAPSEENTILE(x,y)) == TileTypeOWall );
else
return (TILETYPE(MAPSEENTILE(x,y)) == walltype);
int t;
if( x<0 || y<0 || x>=TheMap.Width || y>=TheMap.Height ) {
return 1; // Outside considered wall
}
t=TheMap.Tileset->TileTypeTable[
TheMap.Fields[(x)+(y)*TheMap.Width].SeenTile];
if (walltype == -1) {
return t == TileTypeHWall || t == TileTypeOWall ;
}
return t == walltype;
}
global int FixWall(int x,int y) // used by MapRemoveWall and PreprocessMap
{
int tile;
int walltype;
MapField* mf;
if ( !INMAP(x,y) ) return 0;
walltype = TILETYPE(MAPSEENTILE(x,y));
if( x<0 || y<0 || x>=TheMap.Width || y>=TheMap.Height ) {
return 0;
}
mf=TheMap.Fields+(x)+(y)*TheMap.Width;
walltype = TheMap.Tileset->TileTypeTable[mf->SeenTile];
if ( walltype != TileTypeHWall && walltype != TileTypeOWall ) return 0;
#define WALL(xx,yy) (MapWallChk(xx,yy,walltype) != 0)
@ -96,23 +104,23 @@ global int FixWall(int x,int y) // used by MapRemoveWall and PreprocessMap
if (walltype == TileTypeHWall)
{
if (MAPFIELD(x,y).Value < WALL_50HP)
if (mf->Value < WALL_50HP)
tile += TheMap.Tileset->HumanWall50Tile;
else
tile += TheMap.Tileset->HumanWall100Tile;
}
else
{
if (MAPFIELD(x,y).Value < WALL_50HP)
if (mf->Value < WALL_50HP)
tile += TheMap.Tileset->OrcWall50Tile;
else
tile += TheMap.Tileset->OrcWall100Tile;
}
// FIXME: Johns, Is this correct? Could this function be called under fog of war
if (MAPFIELD(x,y).SeenTile == tile)
if (mf->SeenTile == tile)
return 0;
MAPFIELD(x,y).SeenTile = tile;
mf->SeenTile = tile;
UpdateMinimapXY(x,y);
return 1;

View file

@ -45,42 +45,62 @@ local int WoodTable[16] = {
-- Functions
----------------------------------------------------------------------------*/
global int MapWoodChk(int x,int y) // used by FixWood
/**
** Check if the tile type is wood.
**
** Used by @see MapFixWood and @see PreprocessMap
*/
local int MapWoodChk(int x,int y)
{
if( !INMAP(x,y) ) return 1; // outside considered wood
// return !!(MAPFIELD(x,y).Flags & MapFieldForest);
return (TILETYPE(MAPSEENTILE(x,y)) == TileTypeWood);
if( x<0 || y<0 || x>=TheMap.Width || y>=TheMap.Height ) {
return 1; // outside considered wood
}
return TheMap.Tileset->TileTypeTable[
TheMap.Fields[(x)+(y)*TheMap.Width].SeenTile
] == TileTypeWood;
}
// FIXME: this function is called to often.
// FIXME: docu
global int FixWood(int x,int y) // used by MapRemoveWood2 and PreprocessMap
{
int tile = 0;
int tile;
MapField* mf;
if ( !INMAP(x,y) ) return 0;
if ( MapWoodChk(x,y) == 0 ) return 0;
#define WOOD(xx,yy) (MapWoodChk(xx,yy) != 0)
if (WOOD(x ,y-1)) tile |= 1<<0;
if (WOOD(x+1,y )) tile |= 1<<1;
if (WOOD(x ,y+1)) tile |= 1<<2;
if (WOOD(x-1,y )) tile |= 1<<3;
tile = WoodTable[tile];
if (tile == -1)
MapRemoveWood(x,y);
else
{
// DON'T work EGCC failure tile += TheMap.Tileset->FirstWoodTile;
tile += 0x65;
DebugLevel3(__FUNCTION__":%x\n", TheMap.Tileset->FirstWoodTile);
if (MAPFIELD(x,y).SeenTile == tile) return 0;
MAPFIELD(x,y).SeenTile = tile;
// Outside map or no wood.
if( x<0 || y<0 || x>=TheMap.Width || y>=TheMap.Height ) {
return 0;
}
UpdateMinimapXY(x,y);
return 1;
if ( !MapWoodChk(x,y) ) {
return 0;
}
tile = 0;
#define WOOD(xx,yy) (MapWoodChk(xx,yy) != 0)
if (WOOD(x ,y-1)) tile |= 1<<0;
if (WOOD(x+1,y )) tile |= 1<<1;
if (WOOD(x ,y+1)) tile |= 1<<2;
if (WOOD(x-1,y )) tile |= 1<<3;
tile = WoodTable[tile];
if (tile == -1) {
MapRemoveWood(x,y);
} else {
// DON'T work EGCC failure tile += TheMap.Tileset->FirstWoodTile;
tile += 0x65;
DebugLevel3(__FUNCTION__":%x\n", TheMap.Tileset->FirstWoodTile);
mf=TheMap.Fields+x+y*TheMap.Width;
if ( mf->SeenTile == tile) {
return 0;
}
mf->SeenTile = tile;
}
UpdateMinimapXY(x,y);
return 1;
}
// FIXME: docu
global void MapFixWood(int x,int y)
{
// side neighbors

View file

@ -521,7 +521,7 @@ global void UIHandleMouseMove(int x,int y)
//cade: this is forbidden for unexplored and not visible space
// FIXME: This must done new, moving units, scrolling...
if( CursorOn==CursorOnMap ) {
if( MAPVISIBLE(Screen2MapX(x),Screen2MapY(y)) ) {
if( IsMapFieldVisible(Screen2MapX(x),Screen2MapY(y)) ) {
DebugLevel3(__FUNCTION__": %d,%d\n"
,x-TheUI.MapX+MapX*TileSizeX
,y-TheUI.MapY+MapY*TileSizeY);
@ -530,7 +530,7 @@ global void UIHandleMouseMove(int x,int y)
,y-TheUI.MapY+MapY*TileSizeY);
}
} else if( CursorOn==CursorOnMinimap ) {
if( MAPVISIBLE(Minimap2MapX(x),Minimap2MapY(y)) ) {
if( IsMapFieldVisible(Minimap2MapX(x),Minimap2MapY(y)) ) {
UnitUnderCursor=UnitOnMapTile(Minimap2MapX(x),Minimap2MapY(y));
}
}
@ -897,7 +897,7 @@ global void UIHandleButtonDown(int b)
if( CanBuildUnitType(Selected[0],CursorBuilding,x,y)
// FIXME: vladi: should check all building footprint
// but not just MAPEXPLORED(x,y)
&& MAPEXPLORED(x,y) ) {
&& IsMapFieldExplored(x,y) ) {
PlayGameSound(GameSounds.PlacementSuccess.Sound
,MaxSampleVolume);
SendCommandBuildBuilding(Selected[0],x,y,CursorBuilding
@ -1057,7 +1057,7 @@ global void UIHandleButtonUp(int b)
}
//cade: cannot select unit on invisible space
// FIXME: johns: only complete invisibile units
if( MAPVISIBLE(Screen2MapX(CursorX),Screen2MapY(CursorY)) ) {
if( IsMapFieldVisible(Screen2MapX(CursorX),Screen2MapY(CursorY)) ) {
unit=UnitOnScreen(unit
,CursorX-TheUI.MapX+MapX*TileSizeX
,CursorY-TheUI.MapY+MapY*TileSizeY);

View file

@ -522,11 +522,11 @@ local void DrawBuilding(Unit* unit)
// FIXME: johns: under the fog are shown partly.
// FIXME: There is already a check in the main loop UnitVisibile!
if ( !MAPEXPLORED( x, y ) ) {
if ( !IsMapFieldExplored( x, y ) ) {
return;
}
if ( !TheMap.NoFogOfWar && !MAPVISIBLE( x, y ) ) {
if ( !TheMap.NoFogOfWar && !IsMapFieldVisible( x, y ) ) {
frame = unit->SeenFrame;
if (frame == 255) {
return;
@ -535,12 +535,6 @@ local void DrawBuilding(Unit* unit)
frame = unit->SeenFrame = unit->Frame;
}
#if 0
if( type->Type==UnitOilPlatformHuman || type->Type==UnitOilPlatformOrc ) {
DebugLevel0("%d -> %d\n",unit->Frame,frame);
}
#endif
n_frame = 0;
if ((frame & 128) == 0 && unit->Rs > 50) {
n_frame = 128; // fancy buildings
@ -579,7 +573,7 @@ local void DrawBuilding(Unit* unit)
DrawUnitType(type,frame+n_frame,x,y);
}
// FIXME: johns: ugly check here should be removed! vanish could be used
// FIXME: johns: ugly check here should be removed! vanish could be used?
if( unit->Command.Action!=UnitActionDie ) {
DrawDecoration(unit,type,x,y);
DrawSelectionRectangle(unit,type,x,y);