Replace const + #define hackery with an enum.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2753 4a71c877-e1ca-e34f-864e-861f7616d084
master
Dennis Schridde 2007-11-07 22:54:19 +00:00
parent 7b0a6d7686
commit 9a06997527
3 changed files with 16 additions and 17 deletions

View File

@ -235,9 +235,8 @@ UDWORD terrainMidY;
UDWORD terrainMaxX;
UDWORD terrainMaxY;
/* Initialise from macro instead of const variable */
static unsigned int underwaterTile = _WATER_TILE_ID;
static unsigned int rubbleTile = _NO_DRIVE_OVER_RUBBLE_TILE_ID;
static unsigned int underwaterTile = WATER_TILE;
static unsigned int rubbleTile = BLOCKING_RUBBLE_TILE;
UDWORD geoOffset;
static int averageCentreTerrainHeight;
@ -712,7 +711,7 @@ static void drawTiles(iView *camera, iView *player)
}
// If it's the main water tile (has water texture) then..
if ( TileNumber_tile(psTile->texture) == WATER_TILE_ID && !bEdgeTile )
if ( TileNumber_tile(psTile->texture) == WATER_TILE && !bEdgeTile )
{
// Push the terrain down for the river bed.
PushedDown = TRUE;
@ -815,7 +814,7 @@ static void drawTiles(iView *camera, iView *player)
// check if we need to draw a water edge
if (tileScreenInfo[i][j].bWater
&& TileNumber_tile(mapTile(playerXTile + j, playerZTile + i)->texture) != WATER_TILE_ID)
&& TileNumber_tile(mapTile(playerXTile + j, playerZTile + i)->texture) != WATER_TILE)
{
// the edge is in front of the water (which is drawn at z-index -1)
pie_SetDepthOffset(-2.0);
@ -4130,7 +4129,7 @@ static void drawTerrainTile(UDWORD i, UDWORD j, BOOL onWaterEdge)
else
{
// If it's a water tile then force it to be the river bed texture.
tileNumber = RIVERBED_TILE_ID;
tileNumber = RIVERBED_TILE;
}
#if defined(SHOW_ZONES)

View File

@ -29,16 +29,16 @@
#include "message.h"
/*
* Needed for initialisation of global variables,
* which can't be initialised from other variables
/*!
* Special tile types
*/
#define _WATER_TILE_ID 17
#define _NO_DRIVE_OVER_RUBBLE_TILE_ID 67
static const unsigned int WATER_TILE_ID = _WATER_TILE_ID;
static const unsigned int RIVERBED_TILE_ID = 5;
static const unsigned int DRIVE_OVER_RUBBLE_TILE_ID = 54;
static const unsigned int NO_DRIVE_OVER_RUBBLE_TILE_ID = _NO_DRIVE_OVER_RUBBLE_TILE_ID;
typedef enum
{
RIVERBED_TILE = 5, //! Underwater ground
WATER_TILE = 17, //! Water surface
RUBBLE_TILE = 54, //! You can drive over these
BLOCKING_RUBBLE_TILE = 67 //! You cannot drive over these
} TILE_ID;
extern void setViewAngle(SDWORD angle);

View File

@ -714,14 +714,14 @@ void destroyFeature(FEATURE *psDel)
{
/* Clear feature bits */
psTile->psObject = NULL;
texture = TileNumber_texture(psTile->texture) | DRIVE_OVER_RUBBLE_TILE_ID;
texture = TileNumber_texture(psTile->texture) | RUBBLE_TILE;
psTile->texture = (UWORD)texture;
}
else
{
/* This remains a blocking tile */
psTile->psObject = NULL;
texture = TileNumber_texture(psTile->texture) | NO_DRIVE_OVER_RUBBLE_TILE_ID;
texture = TileNumber_texture(psTile->texture) | BLOCKING_RUBBLE_TILE;
psTile->texture = (UWORD)texture;
}