diff options
author | tron <tron@openttd.org> | 2005-02-22 12:48:03 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-02-22 12:48:03 +0000 |
commit | 51eef8c5b7b54a64802fc3b833898f0fd75b6a51 (patch) | |
tree | b51c88c837ee8419763f34a5fbfd2ff8969ecaa3 | |
parent | f22eab55442cc77096ec1cd713c358c0208f2c62 (diff) | |
download | openttd-51eef8c5b7b54a64802fc3b833898f0fd75b6a51.tar.xz |
(svn r1898) Remove some unused macros from macros.h and move some others to more appropriate headers
-rw-r--r-- | economy.c | 6 | ||||
-rw-r--r-- | macros.h | 19 | ||||
-rw-r--r-- | map.h | 1 | ||||
-rw-r--r-- | tile.h | 8 | ||||
-rw-r--r-- | train_cmd.c | 2 | ||||
-rw-r--r-- | vehicle.c | 2 |
6 files changed, 13 insertions, 25 deletions
@@ -123,7 +123,7 @@ int UpdateCompanyRatingAndValue(Player *p, bool update) /* Count vehicles */ { Vehicle *v; - int32 min_profit = MAX_INT; + int32 min_profit = 0; uint num = 0; FOR_ALL_VEHICLES(v) { @@ -142,9 +142,7 @@ int UpdateCompanyRatingAndValue(Player *p, bool update) } _score_part[owner][SCORE_VEHICLES] = num; - - if (min_profit != MAX_INT && min_profit > 0) - _score_part[owner][SCORE_MIN_PROFIT] = min_profit; + _score_part[owner][SCORE_MIN_PROFIT] = min_profit; } /* Count stations */ @@ -3,8 +3,6 @@ #include "map.h" -#define MAX_INT 0x7FFFFFFF - #ifdef min #undef min #endif @@ -48,21 +46,6 @@ static inline int64 BIGMULS(int32 a, int32 b) { #define IS_INSIDE_1D(x, base, size) ( (uint)((x) - (base)) < ((uint)(size)) ) -enum { - CORRECT_Z_BITS = 1 << 1 | 1 << 2 | 1 << 3 | 1 << 4 | 1 << 5 | 1 << 6 | 1 << 7 -}; -#define CORRECT_Z(tileh) (CORRECT_Z_BITS & (1 << tileh)) - -#define TILE_ASSERT(x) assert( TILE_MASK(x) == (x) ); - -//#define REMADP_COORDS(x,y,z) { int t = x; x = (y-t)*2; y+=t-z; } - -#define PACK_POINT(x,y) ((x) | ((y) << 16)) -#define UNPACK_POINT_X(p) ((uint16)(p)) -#define UNPACK_POINT_Y(p) ((uint16)(p>>16)) - -#define PACK_PPOINT(p) PACK_POINT((p).x, (p).y) - #define HASBIT(x,y) ((x) & (1 << (y))) #define SETBIT(x,y) ((x) |= (1 << (y))) #define CLRBIT(x,y) ((x) &= ~(1 << (y))) @@ -178,6 +161,4 @@ static inline void WRITE_LE_UINT16(void *b, uint16 x) { ((byte*)b)[1] = (byte)(x >> 8); } -#define MAX_DETOUR 6 - #endif /* MACROS_H */ @@ -7,6 +7,7 @@ #define TILE_XY(x,y) (((y) << MapLogX()) + (x)) #define TILE_MASK(x) ((x) & ((1 << (MapLogX() + MapLogY())) - 1)) +#define TILE_ASSERT(x) assert(TILE_MASK(x) == (x)); extern byte *_map_type_and_height; extern byte *_map_owner; @@ -1,6 +1,7 @@ #ifndef TILE_H #define TILE_H +#include "macros.h" #include "map.h" typedef enum TileType { @@ -23,6 +24,13 @@ uint GetMapExtraBits(TileIndex tile); uint GetTileSlope(TileIndex tile, uint *h); uint GetTileZ(TileIndex tile); +static inline bool CorrectZ(uint tileh) +{ + /* tile height must be corrected if the north corner is not raised, but + * any other corner is. These are the cases 1 till 7 */ + return IS_INT_INSIDE(tileh, 1, 8); +} + static inline uint TileHeight(TileIndex tile) { assert(tile < MapSize()); diff --git a/train_cmd.c b/train_cmd.c index d59fd30e9..d90594377 100644 --- a/train_cmd.c +++ b/train_cmd.c @@ -2189,7 +2189,7 @@ static bool CheckCompatibleRail(const Vehicle *v, TileIndex tile) uint tileh = GetTileSlope(tile, &height); // correct Z position of a train going under a bridge on slopes - if (CORRECT_Z(tileh)) height += 8; + if (CorrectZ(tileh)) height += 8; if (v->z_pos != height) return true; // train is going over bridge } @@ -98,7 +98,7 @@ static inline uint Correct_Z(uint tileh) { // needs z correction for slope-type graphics that have the NORTHERN tile lowered // 1, 2, 3, 4, 5, 6 and 7 - return (CORRECT_Z(tileh)) ? 8 : 0; + return CorrectZ(tileh) ? 8 : 0; } uint GetCorrectTileHeight(TileIndex tile) |