(svn r1898) Remove some unused macros from macros.h and move some others to more appropriate headers
--- a/economy.c Tue Feb 22 12:27:33 2005 +0000
+++ b/economy.c Tue Feb 22 12:48:03 2005 +0000
@@ -123,7 +123,7 @@
/* Count vehicles */
{
Vehicle *v;
- int32 min_profit = MAX_INT;
+ int32 min_profit = 0;
uint num = 0;
FOR_ALL_VEHICLES(v) {
@@ -142,9 +142,7 @@
}
_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 */
--- a/macros.h Tue Feb 22 12:27:33 2005 +0000
+++ b/macros.h Tue Feb 22 12:48:03 2005 +0000
@@ -3,8 +3,6 @@
#include "map.h"
-#define MAX_INT 0x7FFFFFFF
-
#ifdef min
#undef min
#endif
@@ -48,21 +46,6 @@
#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 @@
((byte*)b)[1] = (byte)(x >> 8);
}
-#define MAX_DETOUR 6
-
#endif /* MACROS_H */
--- a/map.h Tue Feb 22 12:27:33 2005 +0000
+++ b/map.h Tue Feb 22 12:48:03 2005 +0000
@@ -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;
--- a/tile.h Tue Feb 22 12:27:33 2005 +0000
+++ b/tile.h Tue Feb 22 12:48:03 2005 +0000
@@ -1,6 +1,7 @@
#ifndef TILE_H
#define TILE_H
+#include "macros.h"
#include "map.h"
typedef enum TileType {
@@ -23,6 +24,13 @@
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());
--- a/train_cmd.c Tue Feb 22 12:27:33 2005 +0000
+++ b/train_cmd.c Tue Feb 22 12:48:03 2005 +0000
@@ -2189,7 +2189,7 @@
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
}
--- a/vehicle.c Tue Feb 22 12:27:33 2005 +0000
+++ b/vehicle.c Tue Feb 22 12:48:03 2005 +0000
@@ -98,7 +98,7 @@
{
// 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)