@@ -123,7 +123,7 @@ int UpdateCompanyRatingAndValue(Player *
/* 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 *
}
_score_part[owner][SCORE_VEHICLES] = num;
if (min_profit != MAX_INT && min_profit > 0)
_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, int
#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
((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;
#ifndef TILE_H
#define TILE_H
#include "macros.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());
@@ -2189,7 +2189,7 @@ static bool CheckCompatibleRail(const Ve
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)
Status change: