mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r8055) -Codechange: Replace the different max, dmax, maxu whatever macros by a simple template function max(), that requires two arguments of the same type. While I'm at it change a variable called "max" to "maxval" in a function that calls max().
This commit is contained in:
parent
7996c9e560
commit
2ac0410767
|
@ -1066,7 +1066,7 @@ static bool AircraftController(Vehicle *v)
|
||||||
if (curz > z) {
|
if (curz > z) {
|
||||||
z++;
|
z++;
|
||||||
} else {
|
} else {
|
||||||
int t = max(1, dist - 4);
|
int t = max(1U, dist - 4);
|
||||||
|
|
||||||
z -= ((z - curz) + t - 1) / t;
|
z -= ((z - curz) + t - 1) / t;
|
||||||
if (z < curz) z = curz;
|
if (z < curz) z = curz;
|
||||||
|
|
|
@ -194,7 +194,8 @@ static void DrawDepotWindow(Window *w)
|
||||||
{
|
{
|
||||||
Vehicle **vl = WP(w, depot_d).vehicle_list;
|
Vehicle **vl = WP(w, depot_d).vehicle_list;
|
||||||
TileIndex tile = w->window_number;
|
TileIndex tile = w->window_number;
|
||||||
int x, y, i, hnum, max;
|
int x, y, i, maxval;
|
||||||
|
uint16 hnum;
|
||||||
uint16 num = WP(w, depot_d).engine_count;
|
uint16 num = WP(w, depot_d).engine_count;
|
||||||
|
|
||||||
/* Set the row and number of boxes in each row based on the number of boxes drawn in the matrix */
|
/* Set the row and number of boxes in each row based on the number of boxes drawn in the matrix */
|
||||||
|
@ -218,7 +219,7 @@ static void DrawDepotWindow(Window *w)
|
||||||
hnum = 8;
|
hnum = 8;
|
||||||
for (num = 0; num < WP(w, depot_d).engine_count; num++) {
|
for (num = 0; num < WP(w, depot_d).engine_count; num++) {
|
||||||
const Vehicle *v = vl[num];
|
const Vehicle *v = vl[num];
|
||||||
hnum = maxu(hnum, v->u.rail.cached_total_length);
|
hnum = max(hnum, v->u.rail.cached_total_length);
|
||||||
}
|
}
|
||||||
/* Always have 1 empty row, so people can change the setting of the train */
|
/* Always have 1 empty row, so people can change the setting of the train */
|
||||||
SetVScrollCount(w, WP(w, depot_d).engine_count + WP(w, depot_d).wagon_count + 1);
|
SetVScrollCount(w, WP(w, depot_d).engine_count + WP(w, depot_d).wagon_count + 1);
|
||||||
|
@ -240,22 +241,22 @@ static void DrawDepotWindow(Window *w)
|
||||||
DrawWindowWidgets(w);
|
DrawWindowWidgets(w);
|
||||||
|
|
||||||
num = w->vscroll.pos * boxes_in_each_row;
|
num = w->vscroll.pos * boxes_in_each_row;
|
||||||
max = min(WP(w, depot_d).engine_count, num + (rows_in_display * boxes_in_each_row));
|
maxval = min(WP(w, depot_d).engine_count, num + (rows_in_display * boxes_in_each_row));
|
||||||
|
|
||||||
for (x = 2, y = 15; num < max; y += w->resize.step_height, x = 2) { // Draw the rows
|
for (x = 2, y = 15; num < maxval; y += w->resize.step_height, x = 2) { // Draw the rows
|
||||||
byte i;
|
byte i;
|
||||||
|
|
||||||
for (i = 0; i < boxes_in_each_row && num < max; i++, num++, x += w->resize.step_width) {
|
for (i = 0; i < boxes_in_each_row && num < maxval; i++, num++, x += w->resize.step_width) {
|
||||||
/* Draw all vehicles in the current row */
|
/* Draw all vehicles in the current row */
|
||||||
const Vehicle *v = vl[num];
|
const Vehicle *v = vl[num];
|
||||||
DrawVehicleInDepot(w, v, x, y);
|
DrawVehicleInDepot(w, v, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
max = min(WP(w, depot_d).engine_count + WP(w, depot_d).wagon_count, (w->vscroll.pos * boxes_in_each_row) + (rows_in_display * boxes_in_each_row));
|
maxval = min(WP(w, depot_d).engine_count + WP(w, depot_d).wagon_count, (w->vscroll.pos * boxes_in_each_row) + (rows_in_display * boxes_in_each_row));
|
||||||
|
|
||||||
/* draw the train wagons, that do not have an engine in front */
|
/* draw the train wagons, that do not have an engine in front */
|
||||||
for (; num < max; num++, y += 14) {
|
for (; num < maxval; num++, y += 14) {
|
||||||
const Vehicle *v = WP(w, depot_d).wagon_list[num - WP(w, depot_d).engine_count];
|
const Vehicle *v = WP(w, depot_d).wagon_list[num - WP(w, depot_d).engine_count];
|
||||||
const Vehicle *u;
|
const Vehicle *u;
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ static void SetDisasterVehiclePos(Vehicle *v, int x, int y, byte z)
|
||||||
BeginVehicleMove(u);
|
BeginVehicleMove(u);
|
||||||
|
|
||||||
u->x_pos = x;
|
u->x_pos = x;
|
||||||
u->y_pos = y - 1 - (max(z - GetSlopeZ(safe_x, safe_y), 0) >> 3);
|
u->y_pos = y - 1 - (max(z - GetSlopeZ(safe_x, safe_y), 0U) >> 3);
|
||||||
safe_y = clamp(u->y_pos, 0, MapMaxY() * TILE_SIZE);
|
safe_y = clamp(u->y_pos, 0, MapMaxY() * TILE_SIZE);
|
||||||
u->z_pos = GetSlopeZ(safe_x, safe_y);
|
u->z_pos = GetSlopeZ(safe_x, safe_y);
|
||||||
u->direction = v->direction;
|
u->direction = v->direction;
|
||||||
|
|
|
@ -85,7 +85,7 @@ int64 CalculateCompanyValue(const Player* p)
|
||||||
|
|
||||||
value += p->money64 - p->current_loan; // add real money value
|
value += p->money64 - p->current_loan; // add real money value
|
||||||
|
|
||||||
return max64(value, 1);
|
return max(value, 1LL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if update is set to true, the economy is updated with this score
|
// if update is set to true, the economy is updated with this score
|
||||||
|
|
|
@ -119,7 +119,7 @@ static void DrawGraph(const GraphDrawer *gw)
|
||||||
col_ptr = row_ptr;
|
col_ptr = row_ptr;
|
||||||
do {
|
do {
|
||||||
if (*col_ptr != INVALID_VALUE) {
|
if (*col_ptr != INVALID_VALUE) {
|
||||||
mx = max64(mx, *col_ptr);
|
mx = max((uint64)mx, *col_ptr);
|
||||||
}
|
}
|
||||||
} while (col_ptr++, --num_x);
|
} while (col_ptr++, --num_x);
|
||||||
}
|
}
|
||||||
|
@ -306,7 +306,7 @@ static void SetupGraphDrawerForPlayers(GraphDrawer *gd)
|
||||||
{
|
{
|
||||||
const Player* p;
|
const Player* p;
|
||||||
uint excludebits = _legend_excludebits;
|
uint excludebits = _legend_excludebits;
|
||||||
int nums;
|
byte nums;
|
||||||
int mo,yr;
|
int mo,yr;
|
||||||
|
|
||||||
// Exclude the players which aren't valid
|
// Exclude the players which aren't valid
|
||||||
|
|
|
@ -366,7 +366,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
|
||||||
/* Clicked buttons, decrease or increase production */
|
/* Clicked buttons, decrease or increase production */
|
||||||
if (x < 15) {
|
if (x < 15) {
|
||||||
if (isProductionMinimum(i, line)) return;
|
if (isProductionMinimum(i, line)) return;
|
||||||
i->production_rate[line] = maxu(i->production_rate[line] / 2, 1);
|
i->production_rate[line] = max(i->production_rate[line] / 2, 1);
|
||||||
} else {
|
} else {
|
||||||
if (isProductionMaximum(i, line)) return;
|
if (isProductionMaximum(i, line)) return;
|
||||||
i->production_rate[line] = minu(i->production_rate[line] * 2, 255);
|
i->production_rate[line] = minu(i->production_rate[line] * 2, 255);
|
||||||
|
|
|
@ -20,13 +20,11 @@
|
||||||
#undef max
|
#undef max
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline int max(int a, int b) { if (a >= b) return a; return b; }
|
template <typename T> T max(T a, T b) { return a >= b ? a : b; }
|
||||||
static inline double dmax(double a, double b) { if (a >= b) return a; return b; }
|
|
||||||
static inline uint64 max64(uint64 a, uint64 b) { if (a >= b) return a; return b; }
|
|
||||||
static inline int min(int a, int b) { if (a <= b) return a; return b; }
|
static inline int min(int a, int b) { if (a <= b) return a; return b; }
|
||||||
|
|
||||||
static inline uint minu(uint a, uint b) { if (a <= b) return a; return b; }
|
static inline uint minu(uint a, uint b) { if (a <= b) return a; return b; }
|
||||||
static inline uint maxu(uint a, uint b) { if (a >= b) return a; return b; }
|
|
||||||
|
|
||||||
|
|
||||||
static inline int clamp(int a, int min, int max)
|
static inline int clamp(int a, int min, int max)
|
||||||
|
|
|
@ -1054,7 +1054,7 @@ void ZoomInOrOutToCursorWindow(bool in, Window *w)
|
||||||
static void CommonRaiseLowerBigLand(TileIndex tile, int mode)
|
static void CommonRaiseLowerBigLand(TileIndex tile, int mode)
|
||||||
{
|
{
|
||||||
int sizex, sizey;
|
int sizex, sizey;
|
||||||
byte h;
|
uint h;
|
||||||
|
|
||||||
_generating_world = true; // used to create green terraformed land
|
_generating_world = true; // used to create green terraformed land
|
||||||
|
|
||||||
|
|
|
@ -832,7 +832,7 @@ static const SpriteGroup *VehicleResolveReal(const ResolverObject *object, const
|
||||||
} else if (v->cargo_count == 0 || totalsets == 2) {
|
} else if (v->cargo_count == 0 || totalsets == 2) {
|
||||||
set = 0;
|
set = 0;
|
||||||
} else {
|
} else {
|
||||||
set = v->cargo_count * (totalsets - 2) / max(1, v->cargo_cap) + 1;
|
set = v->cargo_count * (totalsets - 2) / max((uint16)1, v->cargo_cap) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return in_motion ? group->g.real.loaded[set] : group->g.real.loading[set];
|
return in_motion ? group->g.real.loaded[set] : group->g.real.loading[set];
|
||||||
|
|
|
@ -114,8 +114,8 @@ static U EvalAdjustT(const DeterministicSpriteGroupAdjust *adjust, U last_value,
|
||||||
switch (adjust->operation) {
|
switch (adjust->operation) {
|
||||||
case DSGA_OP_ADD: return last_value + value;
|
case DSGA_OP_ADD: return last_value + value;
|
||||||
case DSGA_OP_SUB: return last_value - value;
|
case DSGA_OP_SUB: return last_value - value;
|
||||||
case DSGA_OP_SMIN: return min(last_value, value);
|
case DSGA_OP_SMIN: return min((S)last_value, (S)value);
|
||||||
case DSGA_OP_SMAX: return max(last_value, value);
|
case DSGA_OP_SMAX: return max((S)last_value, (S)value);
|
||||||
case DSGA_OP_UMIN: return min((U)last_value, (U)value);
|
case DSGA_OP_UMIN: return min((U)last_value, (U)value);
|
||||||
case DSGA_OP_UMAX: return max((U)last_value, (U)value);
|
case DSGA_OP_UMAX: return max((U)last_value, (U)value);
|
||||||
case DSGA_OP_SDIV: return last_value / value;
|
case DSGA_OP_SDIV: return last_value / value;
|
||||||
|
|
|
@ -234,7 +234,7 @@ static IniFile *ini_load(const char *filename)
|
||||||
uint pos;
|
uint pos;
|
||||||
// add to comment
|
// add to comment
|
||||||
if (ns > a) {
|
if (ns > a) {
|
||||||
a = max(a, 128);
|
a = max(a, 128U);
|
||||||
do a*=2; while (a < ns);
|
do a*=2; while (a < ns);
|
||||||
ReallocT(&comment, comment_alloc = a);
|
ReallocT(&comment, comment_alloc = a);
|
||||||
}
|
}
|
||||||
|
|
|
@ -437,7 +437,7 @@ static void GameDifficultyWndProc(Window *w, WindowEvent *e)
|
||||||
const GameSettingData *info;
|
const GameSettingData *info;
|
||||||
int x, y;
|
int x, y;
|
||||||
uint btn, dis;
|
uint btn, dis;
|
||||||
int val;
|
int16 val;
|
||||||
|
|
||||||
// Don't allow clients to make any changes
|
// Don't allow clients to make any changes
|
||||||
if (_networking && !_network_server)
|
if (_networking && !_network_server)
|
||||||
|
@ -473,7 +473,8 @@ static void GameDifficultyWndProc(Window *w, WindowEvent *e)
|
||||||
SETBIT(_difficulty_click_b, btn);
|
SETBIT(_difficulty_click_b, btn);
|
||||||
} else {
|
} else {
|
||||||
// Decrease button clicked
|
// Decrease button clicked
|
||||||
val = max(val - info->step, info->min);
|
val -= info->step;
|
||||||
|
val = max(val, info->min);
|
||||||
SETBIT(_difficulty_click_a, btn);
|
SETBIT(_difficulty_click_a, btn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,8 @@ enum {
|
||||||
HVOT_BUOY = 1 << 6
|
HVOT_BUOY = 1 << 6
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
typedef enum CatchmentAeras {
|
||||||
|
CA_NONE = 0,
|
||||||
CA_BUS = 3,
|
CA_BUS = 3,
|
||||||
CA_TRUCK = 3,
|
CA_TRUCK = 3,
|
||||||
CA_AIR_OILPAD = 3,
|
CA_AIR_OILPAD = 3,
|
||||||
|
@ -134,7 +135,7 @@ enum {
|
||||||
CA_AIR_HELIDEPOT = 4,
|
CA_AIR_HELIDEPOT = 4,
|
||||||
CA_AIR_INTERCON = 10,
|
CA_AIR_INTERCON = 10,
|
||||||
CA_AIR_HELISTATION = 4,
|
CA_AIR_HELISTATION = 4,
|
||||||
};
|
} CatchmentAera;
|
||||||
|
|
||||||
void ModifyStationRatingAround(TileIndex tile, PlayerID owner, int amount, uint radius);
|
void ModifyStationRatingAround(TileIndex tile, PlayerID owner, int amount, uint radius);
|
||||||
|
|
||||||
|
|
|
@ -200,7 +200,7 @@ RoadStop *AllocateRoadStop(void)
|
||||||
* radius that is available within the station */
|
* radius that is available within the station */
|
||||||
static uint FindCatchmentRadius(const Station* st)
|
static uint FindCatchmentRadius(const Station* st)
|
||||||
{
|
{
|
||||||
uint ret = 0;
|
CatchmentAera ret = CA_NONE;
|
||||||
|
|
||||||
if (st->bus_stops != NULL) ret = max(ret, CA_BUS);
|
if (st->bus_stops != NULL) ret = max(ret, CA_BUS);
|
||||||
if (st->truck_stops != NULL) ret = max(ret, CA_TRUCK);
|
if (st->truck_stops != NULL) ret = max(ret, CA_TRUCK);
|
||||||
|
@ -2525,7 +2525,7 @@ static void UpdateStationRating(Station *st)
|
||||||
if (rating <= 127 && waiting != 0) {
|
if (rating <= 127 && waiting != 0) {
|
||||||
uint32 r = Random();
|
uint32 r = Random();
|
||||||
if ( (uint)rating <= (r & 0x7F) ) {
|
if ( (uint)rating <= (r & 0x7F) ) {
|
||||||
waiting = max(waiting - ((r >> 8)&3) - 1, 0);
|
waiting = max(waiting - ((r >> 8)&3) - 1, 0U);
|
||||||
waiting_changed = true;
|
waiting_changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -536,7 +536,7 @@ static void HeightMapCoastLines(void)
|
||||||
for (y = 0; y <= _height_map.size_y; y++) {
|
for (y = 0; y <= _height_map.size_y; y++) {
|
||||||
/* Top right */
|
/* Top right */
|
||||||
max_x = myabs((perlin_coast_noise_2D(_height_map.size_y - y, y, 0.9, 53) + 0.25) * 5 + (perlin_coast_noise_2D(y, y, 0.35, 179) + 1) * 12);
|
max_x = myabs((perlin_coast_noise_2D(_height_map.size_y - y, y, 0.9, 53) + 0.25) * 5 + (perlin_coast_noise_2D(y, y, 0.35, 179) + 1) * 12);
|
||||||
max_x = dmax((smallest_size * smallest_size / 16) + max_x, (smallest_size * smallest_size / 16) + margin - max_x);
|
max_x = max((smallest_size * smallest_size / 16) + max_x, (smallest_size * smallest_size / 16) + margin - max_x);
|
||||||
if (smallest_size < 8 && max_x > 5) max_x /= 1.5;
|
if (smallest_size < 8 && max_x > 5) max_x /= 1.5;
|
||||||
for (x = 0; x < max_x; x++) {
|
for (x = 0; x < max_x; x++) {
|
||||||
HeightMapXY(x, y) = 0;
|
HeightMapXY(x, y) = 0;
|
||||||
|
@ -544,7 +544,7 @@ static void HeightMapCoastLines(void)
|
||||||
|
|
||||||
/* Bottom left */
|
/* Bottom left */
|
||||||
max_x = myabs((perlin_coast_noise_2D(_height_map.size_y - y, y, 0.85, 101) + 0.3) * 6 + (perlin_coast_noise_2D(y, y, 0.45, 67) + 0.75) * 8);
|
max_x = myabs((perlin_coast_noise_2D(_height_map.size_y - y, y, 0.85, 101) + 0.3) * 6 + (perlin_coast_noise_2D(y, y, 0.45, 67) + 0.75) * 8);
|
||||||
max_x = dmax((smallest_size * smallest_size / 16) + max_x, (smallest_size * smallest_size / 16) + margin - max_x);
|
max_x = max((smallest_size * smallest_size / 16) + max_x, (smallest_size * smallest_size / 16) + margin - max_x);
|
||||||
if (smallest_size < 8 && max_x > 5) max_x /= 1.5;
|
if (smallest_size < 8 && max_x > 5) max_x /= 1.5;
|
||||||
for (x = _height_map.size_x; x > (_height_map.size_x - 1 - max_x); x--) {
|
for (x = _height_map.size_x; x > (_height_map.size_x - 1 - max_x); x--) {
|
||||||
HeightMapXY(x, y) = 0;
|
HeightMapXY(x, y) = 0;
|
||||||
|
@ -555,7 +555,7 @@ static void HeightMapCoastLines(void)
|
||||||
for (x = 0; x <= _height_map.size_x; x++) {
|
for (x = 0; x <= _height_map.size_x; x++) {
|
||||||
/* Top left */
|
/* Top left */
|
||||||
max_y = myabs((perlin_coast_noise_2D(x, _height_map.size_y / 2, 0.9, 167) + 0.4) * 5 + (perlin_coast_noise_2D(x, _height_map.size_y / 3, 0.4, 211) + 0.7) * 9);
|
max_y = myabs((perlin_coast_noise_2D(x, _height_map.size_y / 2, 0.9, 167) + 0.4) * 5 + (perlin_coast_noise_2D(x, _height_map.size_y / 3, 0.4, 211) + 0.7) * 9);
|
||||||
max_y = dmax((smallest_size * smallest_size / 16) + max_y, (smallest_size * smallest_size / 16) + margin - max_y);
|
max_y = max((smallest_size * smallest_size / 16) + max_y, (smallest_size * smallest_size / 16) + margin - max_y);
|
||||||
if (smallest_size < 8 && max_y > 5) max_y /= 1.5;
|
if (smallest_size < 8 && max_y > 5) max_y /= 1.5;
|
||||||
for (y = 0; y < max_y; y++) {
|
for (y = 0; y < max_y; y++) {
|
||||||
HeightMapXY(x, y) = 0;
|
HeightMapXY(x, y) = 0;
|
||||||
|
@ -564,7 +564,7 @@ static void HeightMapCoastLines(void)
|
||||||
|
|
||||||
/* Bottom right */
|
/* Bottom right */
|
||||||
max_y = myabs((perlin_coast_noise_2D(x, _height_map.size_y / 3, 0.85, 71) + 0.25) * 6 + (perlin_coast_noise_2D(x, _height_map.size_y / 3, 0.35, 193) + 0.75) * 12);
|
max_y = myabs((perlin_coast_noise_2D(x, _height_map.size_y / 3, 0.85, 71) + 0.25) * 6 + (perlin_coast_noise_2D(x, _height_map.size_y / 3, 0.35, 193) + 0.75) * 12);
|
||||||
max_y = dmax((smallest_size * smallest_size / 16) + max_y, (smallest_size * smallest_size / 16) + margin - max_y);
|
max_y = max((smallest_size * smallest_size / 16) + max_y, (smallest_size * smallest_size / 16) + margin - max_y);
|
||||||
if (smallest_size < 8 && max_y > 5) max_y /= 1.5;
|
if (smallest_size < 8 && max_y > 5) max_y /= 1.5;
|
||||||
for (y = _height_map.size_y; y > (_height_map.size_y - 1 - max_y); y--) {
|
for (y = _height_map.size_y; y > (_height_map.size_y - 1 - max_y); y--) {
|
||||||
HeightMapXY(x, y) = 0;
|
HeightMapXY(x, y) = 0;
|
||||||
|
|
|
@ -365,7 +365,7 @@ static int GetTrainAcceleration(Vehicle *v, bool mode)
|
||||||
|
|
||||||
if (IsTileType(v->tile, MP_STATION) && IsFrontEngine(v)) {
|
if (IsTileType(v->tile, MP_STATION) && IsFrontEngine(v)) {
|
||||||
if (TrainShouldStop(v, v->tile)) {
|
if (TrainShouldStop(v, v->tile)) {
|
||||||
uint station_length = GetPlatformLength(v->tile, DirToDiagDir(v->direction));
|
int station_length = GetPlatformLength(v->tile, DirToDiagDir(v->direction));
|
||||||
int delta_v;
|
int delta_v;
|
||||||
|
|
||||||
max_speed = 120;
|
max_speed = 120;
|
||||||
|
|
|
@ -166,8 +166,8 @@ static int CDECL TrainEnginePowerVsRunningCostSorter(const void *a, const void *
|
||||||
* Because of this, the return value have to be reversed as well and we return b - a instead of a - b.
|
* Because of this, the return value have to be reversed as well and we return b - a instead of a - b.
|
||||||
* Another thing is that both power and running costs should be doubled for multiheaded engines.
|
* Another thing is that both power and running costs should be doubled for multiheaded engines.
|
||||||
* Since it would be multipling with 2 in both numerator and denumerator, it will even themselves out and we skip checking for multiheaded. */
|
* Since it would be multipling with 2 in both numerator and denumerator, it will even themselves out and we skip checking for multiheaded. */
|
||||||
int va = (rvi_a->running_cost_base * _price.running_rail[rvi_a->running_cost_class]) / max(1, rvi_a->power);
|
int va = (rvi_a->running_cost_base * _price.running_rail[rvi_a->running_cost_class]) / max((uint16)1, rvi_a->power);
|
||||||
int vb = (rvi_b->running_cost_base * _price.running_rail[rvi_b->running_cost_class]) / max(1, rvi_b->power);
|
int vb = (rvi_b->running_cost_base * _price.running_rail[rvi_b->running_cost_class]) / max((uint16)1, rvi_b->power);
|
||||||
int r = vb - va;
|
int r = vb - va;
|
||||||
|
|
||||||
return _internal_sort_order ? -r : r;
|
return _internal_sort_order ? -r : r;
|
||||||
|
|
|
@ -234,13 +234,13 @@ static void GetAcceptedCargo_Unmovable(TileIndex tile, AcceptedCargo ac)
|
||||||
|
|
||||||
// Top town building generates 10, so to make HQ interesting, the top
|
// Top town building generates 10, so to make HQ interesting, the top
|
||||||
// type makes 20.
|
// type makes 20.
|
||||||
ac[CT_PASSENGERS] = max(1, level);
|
ac[CT_PASSENGERS] = max(1U, level);
|
||||||
|
|
||||||
// Top town building generates 4, HQ can make up to 8. The
|
// Top town building generates 4, HQ can make up to 8. The
|
||||||
// proportion passengers:mail is different because such a huge
|
// proportion passengers:mail is different because such a huge
|
||||||
// commercial building generates unusually high amount of mail
|
// commercial building generates unusually high amount of mail
|
||||||
// correspondence per physical visitor.
|
// correspondence per physical visitor.
|
||||||
ac[CT_MAIL] = max(1, level / 2);
|
ac[CT_MAIL] = max(1U, level / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2091,7 +2091,7 @@ static int CalcHeightdiff(HighLightStyle style, uint distance, TileIndex start_t
|
||||||
assert(style_t < lengthof(heightdiff_line_by_dir) - 13);
|
assert(style_t < lengthof(heightdiff_line_by_dir) - 13);
|
||||||
h0 = TileHeight(TILE_ADD(start_tile, ToTileIndexDiff(heightdiff_line_by_dir[style_t])));
|
h0 = TileHeight(TILE_ADD(start_tile, ToTileIndexDiff(heightdiff_line_by_dir[style_t])));
|
||||||
ht = TileHeight(TILE_ADD(start_tile, ToTileIndexDiff(heightdiff_line_by_dir[style_t + 1])));
|
ht = TileHeight(TILE_ADD(start_tile, ToTileIndexDiff(heightdiff_line_by_dir[style_t + 1])));
|
||||||
h0 = maxu(h0, ht);
|
h0 = max(h0, ht);
|
||||||
|
|
||||||
/* Use lookup table for end-tile based on HighLightStyle direction
|
/* Use lookup table for end-tile based on HighLightStyle direction
|
||||||
* flip around side (lower/upper, left/right) based on distance */
|
* flip around side (lower/upper, left/right) based on distance */
|
||||||
|
@ -2099,7 +2099,7 @@ static int CalcHeightdiff(HighLightStyle style, uint distance, TileIndex start_t
|
||||||
assert(style_t < lengthof(heightdiff_line_by_dir) - 13);
|
assert(style_t < lengthof(heightdiff_line_by_dir) - 13);
|
||||||
h1 = TileHeight(TILE_ADD(end_tile, ToTileIndexDiff(heightdiff_line_by_dir[12 + style_t])));
|
h1 = TileHeight(TILE_ADD(end_tile, ToTileIndexDiff(heightdiff_line_by_dir[12 + style_t])));
|
||||||
ht = TileHeight(TILE_ADD(end_tile, ToTileIndexDiff(heightdiff_line_by_dir[12 + style_t + 1])));
|
ht = TileHeight(TILE_ADD(end_tile, ToTileIndexDiff(heightdiff_line_by_dir[12 + style_t + 1])));
|
||||||
h1 = maxu(h1, ht);
|
h1 = max(h1, ht);
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue