summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ai/default/default.cpp36
-rw-r--r--src/console.cpp2
-rw-r--r--src/console_cmds.cpp2
-rw-r--r--src/core/math_func.hpp29
-rw-r--r--src/economy.cpp2
-rw-r--r--src/graph_gui.cpp4
-rw-r--r--src/industry_gui.cpp8
-rw-r--r--src/main_gui.cpp2
-rw-r--r--src/misc_gui.cpp2
-rw-r--r--src/music_gui.cpp4
-rw-r--r--src/newgrf.cpp2
-rw-r--r--src/oldloader.cpp2
-rw-r--r--src/openttd.cpp16
-rw-r--r--src/player.h4
-rw-r--r--src/players.cpp2
-rw-r--r--src/road_cmd.cpp4
-rw-r--r--src/roadveh_cmd.cpp10
-rw-r--r--src/settings.cpp16
-rw-r--r--src/settings_gui.cpp12
-rw-r--r--src/slope.h8
-rw-r--r--src/smallmap_gui.cpp2
-rw-r--r--src/sound.cpp4
-rw-r--r--src/station_cmd.cpp2
-rw-r--r--src/strings.cpp10
-rw-r--r--src/town_gui.cpp2
-rw-r--r--src/tree_cmd.cpp8
-rw-r--r--src/unmovable_map.h4
-rw-r--r--src/video/dedicated_v.cpp2
-rw-r--r--src/video/sdl_v.cpp4
-rw-r--r--src/video/win32_v.cpp4
-rw-r--r--src/viewport.cpp18
-rw-r--r--src/water_cmd.cpp16
-rw-r--r--src/water_map.h6
-rw-r--r--src/window.cpp2
34 files changed, 118 insertions, 133 deletions
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp
index 61f816c1f..5655b375f 100644
--- a/src/ai/default/default.cpp
+++ b/src/ai/default/default.cpp
@@ -698,11 +698,11 @@ static void AiWantLongIndustryRoute(Player *p)
for (;;) {
// look for one from the subsidy list
AiFindSubsidyIndustryRoute(&fr);
- if (IS_INT_INSIDE(fr.distance, 60, 90 + 1)) break;
+ if (IsInsideMM(fr.distance, 60, 90 + 1)) break;
// try a random one
AiFindRandomIndustryRoute(&fr);
- if (IS_INT_INSIDE(fr.distance, 60, 90 + 1)) break;
+ if (IsInsideMM(fr.distance, 60, 90 + 1)) break;
// only test 60 times
if (--i == 0) return;
@@ -801,11 +801,11 @@ static void AiWantMediumIndustryRoute(Player *p)
for (;;) {
// look for one from the subsidy list
AiFindSubsidyIndustryRoute(&fr);
- if (IS_INT_INSIDE(fr.distance, 40, 60 + 1)) break;
+ if (IsInsideMM(fr.distance, 40, 60 + 1)) break;
// try a random one
AiFindRandomIndustryRoute(&fr);
- if (IS_INT_INSIDE(fr.distance, 40, 60 + 1)) break;
+ if (IsInsideMM(fr.distance, 40, 60 + 1)) break;
// only test 60 times
if (--i == 0) return;
@@ -869,11 +869,11 @@ static void AiWantShortIndustryRoute(Player *p)
for (;;) {
// look for one from the subsidy list
AiFindSubsidyIndustryRoute(&fr);
- if (IS_INT_INSIDE(fr.distance, 15, 40 + 1)) break;
+ if (IsInsideMM(fr.distance, 15, 40 + 1)) break;
// try a random one
AiFindRandomIndustryRoute(&fr);
- if (IS_INT_INSIDE(fr.distance, 15, 40 + 1)) break;
+ if (IsInsideMM(fr.distance, 15, 40 + 1)) break;
// only test 60 times
if (--i == 0) return;
@@ -937,11 +937,11 @@ static void AiWantMailRoute(Player *p)
for (;;) {
// look for one from the subsidy list
AiFindSubsidyPassengerRoute(&fr);
- if (IS_INT_INSIDE(fr.distance, 60, 110 + 1)) break;
+ if (IsInsideMM(fr.distance, 60, 110 + 1)) break;
// try a random one
AiFindRandomPassengerRoute(&fr);
- if (IS_INT_INSIDE(fr.distance, 60, 110 + 1)) break;
+ if (IsInsideMM(fr.distance, 60, 110 + 1)) break;
// only test 60 times
if (--i == 0) return;
@@ -1038,11 +1038,11 @@ static void AiWantPassengerRoute(Player *p)
for (;;) {
// look for one from the subsidy list
AiFindSubsidyPassengerRoute(&fr);
- if (IS_INT_INSIDE(fr.distance, 0, 55 + 1)) break;
+ if (IsInsideMM(fr.distance, 0, 55 + 1)) break;
// try a random one
AiFindRandomPassengerRoute(&fr);
- if (IS_INT_INSIDE(fr.distance, 0, 55 + 1)) break;
+ if (IsInsideMM(fr.distance, 0, 55 + 1)) break;
// only test 60 times
if (--i == 0) return;
@@ -1126,11 +1126,11 @@ static void AiWantLongRoadIndustryRoute(Player *p)
for (;;) {
// look for one from the subsidy list
AiFindSubsidyIndustryRoute(&fr);
- if (IS_INT_INSIDE(fr.distance, 35, 55 + 1)) break;
+ if (IsInsideMM(fr.distance, 35, 55 + 1)) break;
// try a random one
AiFindRandomIndustryRoute(&fr);
- if (IS_INT_INSIDE(fr.distance, 35, 55 + 1)) break;
+ if (IsInsideMM(fr.distance, 35, 55 + 1)) break;
// only test 60 times
if (--i == 0) return;
@@ -1182,11 +1182,11 @@ static void AiWantMediumRoadIndustryRoute(Player *p)
for (;;) {
// look for one from the subsidy list
AiFindSubsidyIndustryRoute(&fr);
- if (IS_INT_INSIDE(fr.distance, 15, 40 + 1)) break;
+ if (IsInsideMM(fr.distance, 15, 40 + 1)) break;
// try a random one
AiFindRandomIndustryRoute(&fr);
- if (IS_INT_INSIDE(fr.distance, 15, 40 + 1)) break;
+ if (IsInsideMM(fr.distance, 15, 40 + 1)) break;
// only test 60 times
if (--i == 0) return;
@@ -1238,11 +1238,11 @@ static void AiWantLongRoadPassengerRoute(Player *p)
for (;;) {
// look for one from the subsidy list
AiFindSubsidyPassengerRoute(&fr);
- if (IS_INT_INSIDE(fr.distance, 55, 180 + 1)) break;
+ if (IsInsideMM(fr.distance, 55, 180 + 1)) break;
// try a random one
AiFindRandomPassengerRoute(&fr);
- if (IS_INT_INSIDE(fr.distance, 55, 180 + 1)) break;
+ if (IsInsideMM(fr.distance, 55, 180 + 1)) break;
// only test 60 times
if (--i == 0) return;
@@ -1407,11 +1407,11 @@ static void AiWantPassengerAircraftRoute(Player *p)
// look for one from the subsidy list
AiFindSubsidyPassengerRoute(&fr);
- if (IS_INT_INSIDE(fr.distance, min_squares, max_squares + 1)) break;
+ if (IsInsideMM(fr.distance, min_squares, max_squares + 1)) break;
// try a random one
AiFindRandomPassengerRoute(&fr);
- if (IS_INT_INSIDE(fr.distance, min_squares, max_squares + 1)) break;
+ if (IsInsideMM(fr.distance, min_squares, max_squares + 1)) break;
// only test 60 times
if (--i == 0) return;
diff --git a/src/console.cpp b/src/console.cpp
index d4208e256..78f6f1143 100644
--- a/src/console.cpp
+++ b/src/console.cpp
@@ -356,7 +356,7 @@ static void IConsoleHistoryNavigate(int direction)
_iconsole_historypos = i;
IConsoleClearCommand();
/* copy history to 'command prompt / bash' */
- assert(_iconsole_history[i] != NULL && IS_INT_INSIDE(i, 0, ICON_HISTORY_SIZE));
+ assert(_iconsole_history[i] != NULL && IsInsideMM(i, 0, ICON_HISTORY_SIZE));
ttd_strlcpy(_iconsole_cmdline.buf, _iconsole_history[i], _iconsole_cmdline.maxlength);
UpdateTextBufferSize(&_iconsole_cmdline);
}
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp
index 764b7d6ae..af5feb4fb 100644
--- a/src/console_cmds.cpp
+++ b/src/console_cmds.cpp
@@ -233,7 +233,7 @@ static const FiosItem* GetFiosItem(const char* file)
if (file == endptr || *endptr != '\0') i = -1;
}
- return IS_INT_INSIDE(i, 0, _fios_num) ? &_fios_list[i] : NULL;
+ return IsInsideMM(i, 0, _fios_num) ? &_fios_list[i] : NULL;
}
diff --git a/src/core/math_func.hpp b/src/core/math_func.hpp
index b47b06482..a7f07d614 100644
--- a/src/core/math_func.hpp
+++ b/src/core/math_func.hpp
@@ -82,7 +82,7 @@ static inline uint minu(const uint a, const uint b)
* @param a The value we want to unsign
* @return The unsigned value
*/
-template <typename T> static inline T abs(T a)
+template <typename T> static inline T abs(const T a)
{
return (a < (T)0) ? -a : a;
}
@@ -191,37 +191,22 @@ template <typename T> static inline T delta(const T a, const T b) {
* @param size The size of the interval
* @return True if the value is in the interval, false else.
*/
-template<typename T> static inline bool IS_INSIDE_1D(const T x, const int base, const uint size)
+template<typename T> static inline bool IsInsideBS(const T x, const uint base, const uint size)
{
return (uint)(x - base) < size;
}
/**
- * Checks if a byte is in an interval.
+ * Checks if a value is in an interval.
*
- * Returns true if a byte value is in the interval of [min, max).
+ * Returns true if a value is in the interval of [min, max).
*
- * @param a The byte value to check
+ * @param a The value to check
* @param min The minimum of the interval
* @param max The maximum of the interval
- * @see IS_INSIDE_1D
+ * @see IsInsideBS()
*/
-template<typename T> static inline bool IS_BYTE_INSIDE(const T x, const byte min, const byte max)
-{
- return (byte)(x - min) < (max - min);
-}
-
-/**
- * Checks if an int is in an interval.
- *
- * Returns true if a integer value is in the interval of [min, max).
- *
- * @param a The integer value to check
- * @param min The minimum of the interval
- * @param max The maximum of the interval
- * @see IS_INSIDE_1D
- */
-template<typename T> static inline bool IS_INT_INSIDE(const T x, const int min, const uint max)
+template<typename T> static inline bool IsInsideMM(const T x, const uint min, const uint max)
{
return (uint)(x - min) < (max - min);
}
diff --git a/src/economy.cpp b/src/economy.cpp
index 022ba5e49..536c7e2c5 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -365,7 +365,7 @@ void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player)
}
FOR_ALL_VEHICLES(v) {
- if (v->owner == old_player && IS_BYTE_INSIDE(v->type, VEH_TRAIN, VEH_AIRCRAFT + 1)) {
+ if (v->owner == old_player && IsInsideMM(v->type, VEH_TRAIN, VEH_AIRCRAFT + 1)) {
if (new_player == PLAYER_SPECTATOR) {
DeleteWindowById(WC_VEHICLE_VIEW, v->index);
DeleteWindowById(WC_VEHICLE_DETAILS, v->index);
diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp
index f7e267056..ee97a5f7a 100644
--- a/src/graph_gui.cpp
+++ b/src/graph_gui.cpp
@@ -279,7 +279,7 @@ static void GraphLegendWndProc(Window *w, WindowEvent *e)
}
case WE_CLICK:
- if (!IS_INT_INSIDE(e->we.click.widget, 3, 11)) return;
+ if (!IsInsideMM(e->we.click.widget, 3, 11)) return;
ToggleBit(_legend_excluded_players, e->we.click.widget - 3);
ToggleWidgetLoweredState(w, e->we.click.widget);
@@ -1050,7 +1050,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
case WE_CLICK:
/* Check which button is clicked */
- if (IS_INT_INSIDE(e->we.click.widget, 13, 21)) {
+ if (IsInsideMM(e->we.click.widget, 13, 21)) {
/* Is it no on disable? */
if (!IsWindowWidgetDisabled(w, e->we.click.widget)) {
RaiseWindowWidget(w, _performance_rating_detail_player + 13);
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 171577c60..127d63090 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -539,8 +539,8 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
if (!IsProductionAlterable(i)) return;
x = e->we.click.pt.x;
line = (e->we.click.pt.y - WP(w, indview_d).production_offset_y) / 10;
- if (e->we.click.pt.y >= WP(w, indview_d).production_offset_y && IS_INT_INSIDE(line, 0, 2) && i->produced_cargo[line] != CT_INVALID) {
- if (IS_INT_INSIDE(x, 5, 25) ) {
+ if (e->we.click.pt.y >= WP(w, indview_d).production_offset_y && IsInsideMM(line, 0, 2) && i->produced_cargo[line] != CT_INVALID) {
+ if (IsInsideMM(x, 5, 25) ) {
/* Clicked buttons, decrease or increase production */
if (x < 15) {
if (isProductionMinimum(i, line)) return;
@@ -557,7 +557,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
w->flags4 |= 5 << WF_TIMEOUT_SHL;
WP(w, indview_d).clicked_line = line + 1;
WP(w, indview_d).clicked_button = (x < 15 ? 1 : 2);
- } else if (IS_INT_INSIDE(x, 34, 160)) {
+ } else if (IsInsideMM(x, 34, 160)) {
/* clicked the text */
WP(w, indview_d).editbox_line = line;
SetDParam(0, i->production_rate[line] * 8);
@@ -844,7 +844,7 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e)
int y = (e->we.click.pt.y - 28) / 10;
uint16 p;
- if (!IS_INT_INSIDE(y, 0, w->vscroll.cap)) return;
+ if (!IsInsideMM(y, 0, w->vscroll.cap)) return;
p = y + w->vscroll.pos;
if (p < _num_industry_sort) {
ScrollMainWindowToTile(_industry_sort[p]->xy);
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index 374548127..4dfbdd705 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -1336,7 +1336,7 @@ static void ScenEditLandGenWndProc(Window *w, WindowEvent *e)
HandleButtonClick(w, e->we.click.widget);
size += _terraform_size;
- if (!IS_INT_INSIDE(size, 1, 8 + 1)) return;
+ if (!IsInsideMM(size, 1, 8 + 1)) return;
_terraform_size = size;
SndPlayFx(SND_15_BEEP);
diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp
index 26b47bad3..e5f923cef 100644
--- a/src/misc_gui.cpp
+++ b/src/misc_gui.cpp
@@ -1917,7 +1917,7 @@ static void CheatsWndProc(Window *w, WindowEvent *e)
uint x = e->we.click.pt.x;
/* not clicking a button? */
- if (!IS_INT_INSIDE(x, 20, 40) || btn >= lengthof(_cheats_ui)) break;
+ if (!IsInsideMM(x, 20, 40) || btn >= lengthof(_cheats_ui)) break;
ce = &_cheats_ui[btn];
oldvalue = value = (int32)ReadValue(ce->variable, ce->type);
diff --git a/src/music_gui.cpp b/src/music_gui.cpp
index 2848844d2..ccc279b72 100644
--- a/src/music_gui.cpp
+++ b/src/music_gui.cpp
@@ -247,7 +247,7 @@ static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e)
byte *p;
if (msf.playlist < 4) return;
- if (!IS_INT_INSIDE(y, 0, NUM_SONGS_AVAILABLE)) return;
+ if (!IsInsideMM(y, 0, NUM_SONGS_AVAILABLE)) return;
p = _playlists[msf.playlist];
for (i = 0; i != NUM_SONGS_PLAYLIST - 1; i++) {
@@ -267,7 +267,7 @@ static void MusicTrackSelectionWndProc(Window *w, WindowEvent *e)
byte *p;
if (msf.playlist < 4) return;
- if (!IS_INT_INSIDE(y, 0, NUM_SONGS_AVAILABLE)) return;
+ if (!IsInsideMM(y, 0, NUM_SONGS_AVAILABLE)) return;
p = _playlists[msf.playlist];
for (i = y; i != NUM_SONGS_PLAYLIST - 1; i++) {
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 8279a7610..1a6ab3b6b 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -2465,7 +2465,7 @@ static void NewSpriteGroup(byte *buf, int len)
/* Link subroutine group */
adjust->subroutine = GetGroupFromGroupID(setid, type, grf_load_byte(&buf));
} else {
- adjust->parameter = IS_BYTE_INSIDE(adjust->variable, 0x60, 0x80) ? grf_load_byte(&buf) : 0;
+ adjust->parameter = IsInsideMM(adjust->variable, 0x60, 0x80) ? grf_load_byte(&buf) : 0;
}
varadjust = grf_load_byte(&buf);
diff --git a/src/oldloader.cpp b/src/oldloader.cpp
index 3944bc284..19130abf7 100644
--- a/src/oldloader.cpp
+++ b/src/oldloader.cpp
@@ -302,7 +302,7 @@ static void FixOldTowns()
/* Convert town-names if needed */
FOR_ALL_TOWNS(town) {
- if (IS_INT_INSIDE(town->townnametype, 0x20C1, 0x20C3)) {
+ if (IsInsideMM(town->townnametype, 0x20C1, 0x20C3)) {
town->townnametype = SPECSTR_TOWNNAME_ENGLISH + _opt.town_name;
town->townnameparts = GetOldTownName(town->townnameparts, _opt.town_name);
}
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 8f5da9934..156f563f3 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -1357,34 +1357,34 @@ bool AfterLoadGame()
if (HasBit(_m[t].m6, 3)) SetBit(_m[t].m6, 2);
StationGfx gfx = GetStationGfx(t);
StationType st;
- if ( IS_INT_INSIDE(gfx, 0, 8)) { // Railway station
+ if ( IsInsideMM(gfx, 0, 8)) { // Railway station
st = STATION_RAIL;
SetStationGfx(t, gfx - 0);
- } else if (IS_INT_INSIDE(gfx, 8, 67)) { // Airport
+ } else if (IsInsideMM(gfx, 8, 67)) { // Airport
st = STATION_AIRPORT;
SetStationGfx(t, gfx - 8);
- } else if (IS_INT_INSIDE(gfx, 67, 71)) { // Truck
+ } else if (IsInsideMM(gfx, 67, 71)) { // Truck
st = STATION_TRUCK;
SetStationGfx(t, gfx - 67);
- } else if (IS_INT_INSIDE(gfx, 71, 75)) { // Bus
+ } else if (IsInsideMM(gfx, 71, 75)) { // Bus
st = STATION_BUS;
SetStationGfx(t, gfx - 71);
} else if (gfx == 75) { // Oil rig
st = STATION_OILRIG;
SetStationGfx(t, gfx - 75);
- } else if (IS_INT_INSIDE(gfx, 76, 82)) { // Dock
+ } else if (IsInsideMM(gfx, 76, 82)) { // Dock
st = STATION_DOCK;
SetStationGfx(t, gfx - 76);
} else if (gfx == 82) { // Buoy
st = STATION_BUOY;
SetStationGfx(t, gfx - 82);
- } else if (IS_INT_INSIDE(gfx, 83, 168)) { // Extended airport
+ } else if (IsInsideMM(gfx, 83, 168)) { // Extended airport
st = STATION_AIRPORT;
SetStationGfx(t, gfx - 83 + 67 - 8);
- } else if (IS_INT_INSIDE(gfx, 168, 170)) { // Drive through truck
+ } else if (IsInsideMM(gfx, 168, 170)) { // Drive through truck
st = STATION_TRUCK;
SetStationGfx(t, gfx - 168 + GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET);
- } else if (IS_INT_INSIDE(gfx, 170, 172)) { // Drive through bus
+ } else if (IsInsideMM(gfx, 170, 172)) { // Drive through bus
st = STATION_BUS;
SetStationGfx(t, gfx - 170 + GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET);
} else {
diff --git a/src/player.h b/src/player.h
index 5216714e7..bd9356340 100644
--- a/src/player.h
+++ b/src/player.h
@@ -239,7 +239,7 @@ static inline byte ActivePlayerCount()
static inline Player *GetPlayer(PlayerID i)
{
- assert(IS_INSIDE_1D(i, PLAYER_FIRST, lengthof(_players)));
+ assert(IsInsideBS(i, PLAYER_FIRST, lengthof(_players)));
return &_players[i];
}
@@ -250,7 +250,7 @@ static inline bool IsLocalPlayer()
static inline bool IsValidPlayer(PlayerID pi)
{
- return IS_INSIDE_1D(pi, PLAYER_FIRST, MAX_PLAYERS);
+ return IsInsideBS(pi, PLAYER_FIRST, MAX_PLAYERS);
}
byte GetPlayerRailtypes(PlayerID p);
diff --git a/src/players.cpp b/src/players.cpp
index 13aff85bc..d1cb86fab 100644
--- a/src/players.cpp
+++ b/src/players.cpp
@@ -299,7 +299,7 @@ static void GenerateCompanyName(Player *p)
t = ClosestTownFromTile(tile, (uint)-1);
- if (IS_INT_INSIDE(t->townnametype, SPECSTR_TOWNNAME_START, SPECSTR_TOWNNAME_LAST+1)) {
+ if (IsInsideMM(t->townnametype, SPECSTR_TOWNNAME_START, SPECSTR_TOWNNAME_LAST+1)) {
str = t->townnametype - SPECSTR_TOWNNAME_START + SPECSTR_PLAYERNAME_START;
strp = t->townnameparts;
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index 60b2729c7..e0e90cfb2 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -647,7 +647,7 @@ CommandCost CmdBuildLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32
TileIndex t = start_tile;
start_tile = end_tile;
end_tile = t;
- p2 ^= IS_INT_INSIDE(p2 & 3, 1, 3) ? 3 : 0;
+ p2 ^= IsInsideMM(p2 & 3, 1, 3) ? 3 : 0;
drd = DRD_SOUTHBOUND;
}
@@ -730,7 +730,7 @@ CommandCost CmdRemoveLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint3
TileIndex t = start_tile;
start_tile = end_tile;
end_tile = t;
- p2 ^= IS_INT_INSIDE(p2 & 3, 1, 3) ? 3 : 0;
+ p2 ^= IsInsideMM(p2 & 3, 1, 3) ? 3 : 0;
}
money.AddCost(GetAvailableMoneyForCommand());
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index c153089e0..2a2aac58b 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -1643,8 +1643,8 @@ again:
goto again;
}
- if (IS_BYTE_INSIDE(v->u.road.state, RVSB_IN_ROAD_STOP, RVSB_IN_DT_ROAD_STOP_END) && IsTileType(v->tile, MP_STATION)) {
- if (IsReversingRoadTrackdir(dir) && IS_BYTE_INSIDE(v->u.road.state, RVSB_IN_ROAD_STOP, RVSB_IN_ROAD_STOP_END)) {
+ if (IsInsideMM(v->u.road.state, RVSB_IN_ROAD_STOP, RVSB_IN_DT_ROAD_STOP_END) && IsTileType(v->tile, MP_STATION)) {
+ if (IsReversingRoadTrackdir(dir) && IsInsideMM(v->u.road.state, RVSB_IN_ROAD_STOP, RVSB_IN_ROAD_STOP_END)) {
/* New direction is trying to turn vehicle around.
* We can't turn at the exit of a road stop so wait.*/
v->cur_speed = 0;
@@ -1766,7 +1766,7 @@ again:
new_dir = RoadVehGetSlidingDirection(v, x, y);
- if (IsRoadVehFront(v) && !IS_BYTE_INSIDE(v->u.road.state, RVSB_IN_ROAD_STOP, RVSB_IN_ROAD_STOP_END)) {
+ if (IsRoadVehFront(v) && !IsInsideMM(v->u.road.state, RVSB_IN_ROAD_STOP, RVSB_IN_ROAD_STOP_END)) {
/* Vehicle is not in a road stop.
* Check for another vehicle to overtake */
Vehicle* u = RoadVehFindCloseTo(v, x, y, new_dir);
@@ -1801,9 +1801,9 @@ again:
* and it's the correct type of stop (bus or truck) and the frame equals the stop frame...
* (the station test and stop type test ensure that other vehicles, using the road stop as
* a through route, do not stop) */
- if (IsRoadVehFront(v) && ((IS_BYTE_INSIDE(v->u.road.state, RVSB_IN_ROAD_STOP, RVSB_IN_ROAD_STOP_END) &&
+ if (IsRoadVehFront(v) && ((IsInsideMM(v->u.road.state, RVSB_IN_ROAD_STOP, RVSB_IN_ROAD_STOP_END) &&
_road_veh_data_1[v->u.road.state - RVSB_IN_ROAD_STOP + (_opt.road_side << RVS_DRIVE_SIDE)] == v->u.road.frame) ||
- (IS_BYTE_INSIDE(v->u.road.state, RVSB_IN_DT_ROAD_STOP, RVSB_IN_DT_ROAD_STOP_END) &&
+ (IsInsideMM(v->u.road.state, RVSB_IN_DT_ROAD_STOP, RVSB_IN_DT_ROAD_STOP_END) &&
v->current_order.dest == GetStationIndex(v->tile) &&
GetRoadStopType(v->tile) == (IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? RoadStop::BUS : RoadStop::TRUCK) &&
v->u.road.frame == RVC_DRIVE_THROUGH_STOP_FRAME))) {
diff --git a/src/settings.cpp b/src/settings.cpp
index 853719a71..962db0948 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1155,15 +1155,15 @@ static int32 CheckInterval(int32 p1)
const Patches *ptc = (_game_mode == GM_MENU) ? &_patches_newgame : &_patches;
if (p1) {
- warning = ( (IS_INT_INSIDE(ptc->servint_trains, 5, 90 + 1) || ptc->servint_trains == 0) &&
- (IS_INT_INSIDE(ptc->servint_roadveh, 5, 90 + 1) || ptc->servint_roadveh == 0) &&
- (IS_INT_INSIDE(ptc->servint_aircraft, 5, 90 + 1) || ptc->servint_aircraft == 0) &&
- (IS_INT_INSIDE(ptc->servint_ships, 5, 90 + 1) || ptc->servint_ships == 0) );
+ warning = ( (IsInsideMM(ptc->servint_trains, 5, 90 + 1) || ptc->servint_trains == 0) &&
+ (IsInsideMM(ptc->servint_roadveh, 5, 90 + 1) || ptc->servint_roadveh == 0) &&
+ (IsInsideMM(ptc->servint_aircraft, 5, 90 + 1) || ptc->servint_aircraft == 0) &&
+ (IsInsideMM(ptc->servint_ships, 5, 90 + 1) || ptc->servint_ships == 0) );
} else {
- warning = ( (IS_INT_INSIDE(ptc->servint_trains, 30, 800 + 1) || ptc->servint_trains == 0) &&
- (IS_INT_INSIDE(ptc->servint_roadveh, 30, 800 + 1) || ptc->servint_roadveh == 0) &&
- (IS_INT_INSIDE(ptc->servint_aircraft, 30, 800 + 1) || ptc->servint_aircraft == 0) &&
- (IS_INT_INSIDE(ptc->servint_ships, 30, 800 + 1) || ptc->servint_ships == 0) );
+ warning = ( (IsInsideMM(ptc->servint_trains, 30, 800 + 1) || ptc->servint_trains == 0) &&
+ (IsInsideMM(ptc->servint_roadveh, 30, 800 + 1) || ptc->servint_roadveh == 0) &&
+ (IsInsideMM(ptc->servint_aircraft, 30, 800 + 1) || ptc->servint_aircraft == 0) &&
+ (IsInsideMM(ptc->servint_ships, 30, 800 + 1) || ptc->servint_ships == 0) );
}
if (!warning)
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 40ec04426..a16b9cb40 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -511,7 +511,7 @@ static void GameDifficultyWndProc(Window *w, WindowEvent *e)
return;
x = e->we.click.pt.x - 5;
- if (!IS_INT_INSIDE(x, 0, 21)) // Button area
+ if (!IsInsideMM(x, 0, 21)) // Button area
return;
y = e->we.click.pt.y - GAMEDIFF_WND_TOP_OFFSET;
@@ -1101,7 +1101,7 @@ static void CustCurrencyWndProc(Window *w, WindowEvent *e)
switch (line) {
case 0: // rate
- if (IS_INT_INSIDE(x, 10, 30)) { // clicked buttons
+ if (IsInsideMM(x, 10, 30)) { // clicked buttons
if (x < 20) {
if (_custom_currency.rate > 1) _custom_currency.rate--;
WP(w,def_d).data_1 = 1 << (line * 2 + 0);
@@ -1118,7 +1118,7 @@ static void CustCurrencyWndProc(Window *w, WindowEvent *e)
break;
case 1: // separator
- if (IS_INT_INSIDE(x, 10, 30)) { // clicked button
+ if (IsInsideMM(x, 10, 30)) { // clicked button
WP(w,def_d).data_1 = 1 << (line * 2 + 1);
}
str = BindCString(_str_separator);
@@ -1126,7 +1126,7 @@ static void CustCurrencyWndProc(Window *w, WindowEvent *e)
break;
case 2: // prefix
- if (IS_INT_INSIDE(x, 10, 30)) { // clicked button
+ if (IsInsideMM(x, 10, 30)) { // clicked button
WP(w,def_d).data_1 = 1 << (line * 2 + 1);
}
str = BindCString(_custom_currency.prefix);
@@ -1134,7 +1134,7 @@ static void CustCurrencyWndProc(Window *w, WindowEvent *e)
break;
case 3: // suffix
- if (IS_INT_INSIDE(x, 10, 30)) { // clicked button
+ if (IsInsideMM(x, 10, 30)) { // clicked button
WP(w,def_d).data_1 = 1 << (line * 2 + 1);
}
str = BindCString(_custom_currency.suffix);
@@ -1142,7 +1142,7 @@ static void CustCurrencyWndProc(Window *w, WindowEvent *e)
break;
case 4: // to euro
- if (IS_INT_INSIDE(x, 10, 30)) { // clicked buttons
+ if (IsInsideMM(x, 10, 30)) { // clicked buttons
if (x < 20) {
_custom_currency.to_euro = (_custom_currency.to_euro <= 2000) ?
CF_NOEURO : _custom_currency.to_euro - 1;
diff --git a/src/slope.h b/src/slope.h
index 987bf6664..9f4985941 100644
--- a/src/slope.h
+++ b/src/slope.h
@@ -75,7 +75,7 @@ enum Slope {
*/
static inline bool IsValidCorner(Corner corner)
{
- return IS_INT_INSIDE(corner, 0, CORNER_END);
+ return IsInsideMM(corner, 0, CORNER_END);
}
/**
@@ -294,7 +294,7 @@ static inline bool IsInclinedFoundation(Foundation f)
*/
static inline bool IsNonContinuousFoundation(Foundation f)
{
- return IS_INT_INSIDE(f, FOUNDATION_STEEP_BOTH, FOUNDATION_HALFTILE_N + 1);
+ return IsInsideMM(f, FOUNDATION_STEEP_BOTH, FOUNDATION_HALFTILE_N + 1);
}
/**
@@ -307,7 +307,7 @@ static inline bool IsNonContinuousFoundation(Foundation f)
*/
static inline Corner GetHalftileFoundationCorner(Foundation f)
{
- assert(IS_INT_INSIDE(f, FOUNDATION_HALFTILE_W, FOUNDATION_HALFTILE_N + 1));
+ assert(IsInsideMM(f, FOUNDATION_HALFTILE_W, FOUNDATION_HALFTILE_N + 1));
return (Corner)(f - FOUNDATION_HALFTILE_W);
}
@@ -319,7 +319,7 @@ static inline Corner GetHalftileFoundationCorner(Foundation f)
*/
static inline bool IsSpecialRailFoundation(Foundation f)
{
- return IS_INT_INSIDE(f, FOUNDATION_RAIL_W, FOUNDATION_RAIL_N + 1);
+ return IsInsideMM(f, FOUNDATION_RAIL_W, FOUNDATION_RAIL_N + 1);
}
/**
diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp
index fc80e46a6..e4214ab92 100644
--- a/src/smallmap_gui.cpp
+++ b/src/smallmap_gui.cpp
@@ -697,7 +697,7 @@ skip_column:
/* Check if y is out of bounds? */
y -= dpi->top;
- if (!IS_INT_INSIDE(y, 0, dpi->height)) continue;
+ if (!IsInsideMM(y, 0, dpi->height)) continue;
/* Default is to draw both pixels. */
skip = false;
diff --git a/src/sound.cpp b/src/sound.cpp
index 2ef724cee..5a3cb7638 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -209,8 +209,8 @@ static void SndPlayScreenCoordFx(SoundFx sound, int x, int y)
const ViewPort *vp = (*wz)->viewport;
if (vp != NULL &&
- IS_INSIDE_1D(x, vp->virtual_left, vp->virtual_width) &&
- IS_INSIDE_1D(y, vp->virtual_top, vp->virtual_height)) {
+ IsInsideBS(x, vp->virtual_left, vp->virtual_width) &&
+ IsInsideBS(y, vp->virtual_top, vp->virtual_height)) {
int left = (x - vp->virtual_left);
StartSound(
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index c969ef459..21ecf3d0f 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -465,7 +465,7 @@ void GetProductionAroundTiles(AcceptedCargo produced, TileIndex tile,
for (int yc = y1; yc != y2; yc++) {
for (int xc = x1; xc != x2; xc++) {
- if (!(IS_INSIDE_1D(xc, x, w) && IS_INSIDE_1D(yc, y, h))) {
+ if (!(IsInsideBS(xc, x, w) && IsInsideBS(yc, y, h))) {
TileIndex tile = TileXY(xc, yc);
GetProducedCargoProc *gpc = _tile_type_procs[GetTileType(tile)]->get_produced_cargo_proc;
diff --git a/src/strings.cpp b/src/strings.cpp
index ed84ee6ca..d45a6a24e 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -1120,20 +1120,20 @@ static char *GetSpecialPlayerNameString(char *buff, int ind, const int64 *argv,
}
/* town name? */
- if (IS_INT_INSIDE(ind - 6, 0, SPECSTR_TOWNNAME_LAST-SPECSTR_TOWNNAME_START + 1)) {
+ if (IsInsideMM(ind - 6, 0, SPECSTR_TOWNNAME_LAST-SPECSTR_TOWNNAME_START + 1)) {
buff = GetSpecialTownNameString(buff, ind - 6, GetInt32(&argv), last);
return strecpy(buff, " Transport", last);
}
/* language name? */
- if (IS_INT_INSIDE(ind, (SPECSTR_LANGUAGE_START - 0x70E4), (SPECSTR_LANGUAGE_END - 0x70E4) + 1)) {
+ if (IsInsideMM(ind, (SPECSTR_LANGUAGE_START - 0x70E4), (SPECSTR_LANGUAGE_END - 0x70E4) + 1)) {
int i = ind - (SPECSTR_LANGUAGE_START - 0x70E4);
return strecpy(buff,
i == _dynlang.curr ? _langpack->own_name : _dynlang.ent[i].name, last);
}
/* resolution size? */
- if (IS_INT_INSIDE(ind, (SPECSTR_RESOLUTION_START - 0x70E4), (SPECSTR_RESOLUTION_END - 0x70E4) + 1)) {
+ if (IsInsideMM(ind, (SPECSTR_RESOLUTION_START - 0x70E4), (SPECSTR_RESOLUTION_END - 0x70E4) + 1)) {
int i = ind - (SPECSTR_RESOLUTION_START - 0x70E4);
buff += snprintf(
buff, last - buff + 1, "%dx%d", _resolutions[i][0], _resolutions[i][1]
@@ -1142,7 +1142,7 @@ static char *GetSpecialPlayerNameString(char *buff, int ind, const int64 *argv,
}
/* screenshot format name? */
- if (IS_INT_INSIDE(ind, (SPECSTR_SCREENSHOT_START - 0x70E4), (SPECSTR_SCREENSHOT_END - 0x70E4) + 1)) {
+ if (IsInsideMM(ind, (SPECSTR_SCREENSHOT_START - 0x70E4), (SPECSTR_SCREENSHOT_END - 0x70E4) + 1)) {
int i = ind - (SPECSTR_SCREENSHOT_START - 0x70E4);
return strecpy(buff, GetScreenshotFormatDesc(i), last);
}
@@ -1168,7 +1168,7 @@ StringID RemapOldStringID(StringID s)
case 0xA02F: return STR_SV_AIRCRAFT_NAME;
default:
- if (IS_INT_INSIDE(s, 0x300F, 0x3030)) {
+ if (IsInsideMM(s, 0x300F, 0x3030)) {
return s - 0x300F + STR_SV_STNAME;
} else {
return s;
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index 8bd7ff527..3aa49f2d1 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -216,7 +216,7 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e)
const Town *t = GetTown(w->window_number);
int y = (e->we.click.pt.y - 0x6B) / 10;
- if (!IS_INT_INSIDE(y, 0, 5)) return;
+ if (!IsInsideMM(y, 0, 5)) return;
y = GetNthSetBit(GetMaskOfTownActions(NULL, _local_player, t), y + w->vscroll.pos - 1);
if (y >= 0) {
diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp
index eba4403bd..6614bb304 100644
--- a/src/tree_cmd.cpp
+++ b/src/tree_cmd.cpp
@@ -354,7 +354,7 @@ CommandCost CmdPlantTree(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
MarkTileDirtyByTile(tile);
- if (_game_mode == GM_EDITOR && IS_INT_INSIDE(treetype, TREE_RAINFOREST, TREE_CACTUS))
+ if (_game_mode == GM_EDITOR && IsInsideMM(treetype, TREE_RAINFOREST, TREE_CACTUS))
SetTropicZone(tile, TROPICZONE_RAINFOREST);
}
cost.AddCost(_price.build_trees);
@@ -418,7 +418,7 @@ static void DrawTile_Trees(TileInfo *ti)
/* different tree styles above one of the grounds */
if (GetTreeGround(ti->tile) == TREE_GROUND_SNOW_DESERT &&
GetTreeDensity(ti->tile) >= 2 &&
- IS_INT_INSIDE(index, TREE_SUB_ARCTIC << 2, TREE_RAINFOREST << 2)) {
+ IsInsideMM(index, TREE_SUB_ARCTIC << 2, TREE_RAINFOREST << 2)) {
index += 164 - (TREE_SUB_ARCTIC << 2);
}
@@ -494,7 +494,7 @@ static CommandCost ClearTile_Trees(TileIndex tile, byte flags)
}
num = GetTreeCount(tile) + 1;
- if (IS_INT_INSIDE(GetTreeType(tile), TREE_RAINFOREST, TREE_CACTUS)) num *= 4;
+ if (IsInsideMM(GetTreeType(tile), TREE_RAINFOREST, TREE_CACTUS)) num *= 4;
if (flags & DC_EXEC) DoClearSquare(tile);
@@ -510,7 +510,7 @@ static void GetTileDesc_Trees(TileIndex tile, TileDesc *td)
{
TreeType tt = GetTreeType(tile);
- if (IS_INT_INSIDE(tt, TREE_RAINFOREST, TREE_CACTUS)) {
+ if (IsInsideMM(tt, TREE_RAINFOREST, TREE_CACTUS)) {
td->str = STR_280F_RAINFOREST;
} else {
td->str = tt == TREE_CACTUS ? STR_2810_CACTUS_PLANTS : STR_280E_TREES;
diff --git a/src/unmovable_map.h b/src/unmovable_map.h
index 0decbf94e..0b3132ce0 100644
--- a/src/unmovable_map.h
+++ b/src/unmovable_map.h
@@ -21,7 +21,7 @@ enum UnmovableType {
UNMOVABLE_HQ_EAST = 0x82, ///< Offset for the eastern HQ tile
UNMOVABLE_HQ_SOUTH = 0x83, ///< Offset for the southern HQ tile
- /** End of the HQ (rather end + 1 for IS_INT_INSIDE) */
+ /** End of the HQ (rather end + 1 for IsInside) */
UNMOVABLE_HQ_END = UNMOVABLE_HQ_NORTH + HQ_NUM_SIZE * HQ_NUM_TILE
};
@@ -80,7 +80,7 @@ static inline bool IsOwnedLandTile(TileIndex t)
static inline bool IsCompanyHQ(TileIndex t)
{
assert(IsTileType(t, MP_UNMOVABLE));
- return IS_INT_INSIDE(GetUnmovableType(t), UNMOVABLE_HQ_NORTH, UNMOVABLE_HQ_END);
+ return IsInsideMM(GetUnmovableType(t), UNMOVABLE_HQ_NORTH, UNMOVABLE_HQ_END);
}
/**
diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp
index 3d9490c59..e7b9302fe 100644
--- a/src/video/dedicated_v.cpp
+++ b/src/video/dedicated_v.cpp
@@ -235,7 +235,7 @@ static void DedicatedHandleKeyInput()
if (input_line[i] == '\0')
break;
- if (!IS_INT_INSIDE(input_line[i], ' ', 256))
+ if (!IsInsideMM(input_line[i], ' ', 256))
input_line[i] = ' ';
}
}
diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp
index aa1addc34..c0cd58ef6 100644
--- a/src/video/sdl_v.cpp
+++ b/src/video/sdl_v.cpp
@@ -128,8 +128,8 @@ static void GetVideoModes()
for (i = 0; modes[i]; i++) {
int w = modes[i]->w;
int h = modes[i]->h;
- if (IS_INT_INSIDE(w, 640, MAX_SCREEN_WIDTH + 1) &&
- IS_INT_INSIDE(h, 480, MAX_SCREEN_HEIGHT + 1)) {
+ if (IsInsideMM(w, 640, MAX_SCREEN_WIDTH + 1) &&
+ IsInsideMM(h, 480, MAX_SCREEN_HEIGHT + 1)) {
int j;
for (j = 0; j < n; j++) {
if (_resolutions[j][0] == w && _resolutions[j][1] == h) break;
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp
index 16677fb87..b742bbfd3 100644
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -737,8 +737,8 @@ static void FindResolutions()
* Doesn't really matter since we don't pass a string anyways, but still
* a letdown */
for (i = 0; EnumDisplaySettingsA(NULL, i, &dm) != 0; i++) {
- if (dm.dmBitsPerPel == BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() && IS_INT_INSIDE(dm.dmPelsWidth, 640, MAX_SCREEN_WIDTH + 1) &&
- IS_INT_INSIDE(dm.dmPelsHeight, 480, MAX_SCREEN_HEIGHT + 1)) {
+ if (dm.dmBitsPerPel == BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() && IsInsideMM(dm.dmPelsWidth, 640, MAX_SCREEN_WIDTH + 1) &&
+ IsInsideMM(dm.dmPelsHeight, 480, MAX_SCREEN_HEIGHT + 1)) {
uint j;
for (j = 0; j < n; j++) {
diff --git a/src/viewport.cpp b/src/viewport.cpp
index 26d2d7644..bd0f7a038 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -344,8 +344,8 @@ ViewPort *IsPtInWindowViewport(const Window *w, int x, int y)
ViewPort *vp = w->viewport;
if (vp != NULL &&
- IS_INT_INSIDE(x, vp->left, vp->left + vp->width) &&
- IS_INT_INSIDE(y, vp->top, vp->top + vp->height))
+ IsInsideMM(x, vp->left, vp->left + vp->width) &&
+ IsInsideMM(y, vp->top, vp->top + vp->height))
return vp;
return NULL;
@@ -501,7 +501,7 @@ void DrawGroundSpriteAt(SpriteID image, SpriteID pal, int32 x, int32 y, byte z,
static void AddChildSpriteToFoundation(SpriteID image, SpriteID pal, const SubSprite *sub, FoundationPart foundation_part, int extra_offs_x, int extra_offs_y)
{
ViewportDrawer *vd = _cur_vd;
- assert(IS_INT_INSIDE(foundation_part, 0, FOUNDATION_PART_END));
+ assert(IsInsideMM(foundation_part, 0, FOUNDATION_PART_END));
assert(vd->foundation[foundation_part] != NULL);
Point offs = vd->foundation_offset[foundation_part];
@@ -932,8 +932,8 @@ static void DrawTileSelection(const TileInfo *ti)
if (_thd.drawstyle == 0) return;
/* Inside the inner area? */
- if (IS_INSIDE_1D(ti->x, _thd.pos.x, _thd.size.x) &&
- IS_INSIDE_1D(ti->y, _thd.pos.y, _thd.size.y)) {
+ if (IsInsideBS(ti->x, _thd.pos.x, _thd.size.x) &&
+ IsInsideBS(ti->y, _thd.pos.y, _thd.size.y)) {
if (_thd.drawstyle & HT_RECT) {
DrawTileSelectionRect(ti, _thd.make_square_red ? PALETTE_SEL_TILE_RED : PAL_NONE);
} else if (_thd.drawstyle & HT_POINT) {
@@ -978,8 +978,8 @@ static void DrawTileSelection(const TileInfo *ti)
/* Check if it's inside the outer area? */
if (_thd.outersize.x &&
_thd.size.x < _thd.size.x + _thd.outersize.x &&
- IS_INSIDE_1D(ti->x, _thd.pos.x + _thd.offs.x, _thd.size.x + _thd.outersize.x) &&
- IS_INSIDE_1D(ti->y, _thd.pos.y + _thd.offs.y, _thd.size.y + _thd.outersize.y)) {
+ IsInsideBS(ti->x, _thd.pos.x + _thd.offs.x, _thd.size.x + _thd.outersize.x) &&
+ IsInsideBS(ti->y, _thd.pos.y + _thd.offs.y, _thd.size.y + _thd.outersize.y)) {
/* Draw a blue rect. */
DrawTileSelectionRect(ti, PALETTE_SEL_TILE_BLUE);
return;
@@ -1754,8 +1754,8 @@ void MarkTileDirty(int x, int y)
uint z = 0;
Point pt;
- if (IS_INT_INSIDE(x, 0, MapSizeX() * TILE_SIZE) &&
- IS_INT_INSIDE(y, 0, MapSizeY() * TILE_SIZE))
+ if (IsInsideMM(x, 0, MapSizeX() * TILE_SIZE) &&
+ IsInsideMM(y, 0, MapSizeY() * TILE_SIZE))
z = GetTileZ(TileVirtXY(x, y));
pt = RemapCoords(x, y, z);
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index 92b33a837..550b85c47 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -334,8 +334,8 @@ static CommandCost ClearTile_Water(TileIndex tile, byte flags)
if (flags & DC_NO_WATER) return_cmd_error(STR_3807_CAN_T_BUILD_ON_WATER);
/* Make sure it's not an edge tile. */
- if (!IS_INT_INSIDE(TileX(tile), 1, MapMaxX() - 1) ||
- !IS_INT_INSIDE(TileY(tile), 1, MapMaxY() - 1)) {
+ if (!IsInsideMM(TileX(tile), 1, MapMaxX() - 1) ||
+ !IsInsideMM(TileY(tile), 1, MapMaxY() - 1)) {
return_cmd_error(STR_0002_TOO_CLOSE_TO_EDGE_OF_MAP);
}
@@ -771,8 +771,8 @@ void TileLoop_Water(TileIndex tile)
if (IsTileType(tile, MP_WATER) && !(IsSea(tile) || IsCoast(tile))) return;
/* floods in all four diagonal directions with the exception of the edges */
- if (IS_INT_INSIDE(TileX(tile), 1, MapSizeX() - 3 + 1) &&
- IS_INT_INSIDE(TileY(tile), 1, MapSizeY() - 3 + 1)) {
+ if (IsInsideMM(TileX(tile), 1, MapSizeX() - 3 + 1) &&
+ IsInsideMM(TileY(tile), 1, MapSizeY() - 3 + 1)) {
uint i;
for (i = 0; i != lengthof(_tile_loop_offs_array); i++) {
@@ -784,19 +784,19 @@ void TileLoop_Water(TileIndex tile)
_current_player = OWNER_NONE;
/* edges */
- if (TileX(tile) == 0 && IS_INT_INSIDE(TileY(tile), 1, MapSizeY() - 3 + 1)) { //NE
+ if (TileX(tile) == 0 && IsInsideMM(TileY(tile), 1, MapSizeY() - 3 + 1)) { //NE
TileLoopWaterHelper(tile, _tile_loop_offs_array[2]);
}
- if (TileX(tile) == MapSizeX() - 2 && IS_INT_INSIDE(TileY(tile), 1, MapSizeY() - 3 + 1)) { //SW
+ if (TileX(tile) == MapSizeX() - 2 && IsInsideMM(TileY(tile), 1, MapSizeY() - 3 + 1)) { //SW
TileLoopWaterHelper(tile, _tile_loop_offs_array[0]);
}
- if (TileY(tile) == 0 && IS_INT_INSIDE(TileX(tile), 1, MapSizeX() - 3 + 1)) { //NW
+ if (TileY(tile) == 0 && IsInsideMM(TileX(tile), 1, MapSizeX() - 3 + 1)) { //NW
TileLoopWaterHelper(tile, _tile_loop_offs_array[1]);
}
- if (TileY(tile) == MapSizeY() - 2 && IS_INT_INSIDE(TileX(tile), 1, MapSizeX() - 3 + 1)) { //SE
+ if (TileY(tile) == MapSizeY() - 2 && IsInsideMM(TileX(tile), 1, MapSizeX() - 3 + 1)) { //SE
TileLoopWaterHelper(tile, _tile_loop_offs_array[3]);
}
}
diff --git a/src/water_map.h b/src/water_map.h
index fe1aab9e5..5d1a60c1d 100644
--- a/src/water_map.h
+++ b/src/water_map.h
@@ -31,9 +31,9 @@ static inline WaterTileType GetWaterTileType(TileIndex t)
if (_m[t].m5 == 0) return WATER_TILE_CLEAR;
if (_m[t].m5 == 1) return WATER_TILE_COAST;
- if (IS_INT_INSIDE(_m[t].m5, LOCK_MIDDLE, LOCK_END)) return WATER_TILE_LOCK;
+ if (IsInsideMM(_m[t].m5, LOCK_MIDDLE, LOCK_END)) return WATER_TILE_LOCK;
- assert(IS_INT_INSIDE(_m[t].m5, DEPOT_NORTH, DEPOT_END));
+ assert(IsInsideMM(_m[t].m5, DEPOT_NORTH, DEPOT_END));
return WATER_TILE_DEPOT;
}
@@ -72,7 +72,7 @@ static inline TileIndex GetOtherShipDepotTile(TileIndex t)
static inline TileIndex IsShipDepot(TileIndex t)
{
- return IS_INT_INSIDE(_m[t].m5, DEPOT_NORTH, DEPOT_END);
+ return IsInsideMM(_m[t].m5, DEPOT_NORTH, DEPOT_END);
}
static inline Axis GetShipDepotAxis(TileIndex t)
diff --git a/src/window.cpp b/src/window.cpp
index 3f6ac8471..789ef9603 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -953,7 +953,7 @@ Window *FindWindowFromPt(int x, int y)
for (wz = _last_z_window; wz != _z_windows;) {
Window *w = *--wz;
- if (IS_INSIDE_1D(x, w->left, w->width) && IS_INSIDE_1D(y, w->top, w->height)) {
+ if (IsInsideBS(x, w->left, w->width) && IsInsideBS(y, w->top, w->height)) {
return w;
}
}