Merge branch 'master' into jgrpp

# Conflicts:
#	src/group_cmd.cpp
#	src/lang/korean.txt
#	src/lang/simplified_chinese.txt
#	src/script/api/script_rail.cpp
#	src/tunnelbridge_cmd.cpp
This commit is contained in:
Jonathan G Rennison
2023-01-23 19:10:07 +00:00
79 changed files with 181 additions and 237 deletions

View File

@@ -276,11 +276,11 @@
if (tile - from == 1) {
if (to - tile == 1) return (GetRailTracks(tile) & RAILTRACK_NE_SW) != 0;
if (to - tile == ::MapSizeX()) return (GetRailTracks(tile) & RAILTRACK_NE_SE) != 0;
} else if (tile - from == ::MapSizeX()) {
if (to - tile == ScriptMap::GetMapSizeX()) return (GetRailTracks(tile) & RAILTRACK_NE_SE) != 0;
} else if (tile - from == ScriptMap::GetMapSizeX()) {
if (tile - to == 1) return (GetRailTracks(tile) & RAILTRACK_NW_NE) != 0;
if (to - tile == 1) return (GetRailTracks(tile) & RAILTRACK_NW_SW) != 0;
if (to - tile == ::MapSizeX()) return (GetRailTracks(tile) & RAILTRACK_NW_SE) != 0;
if (to - tile == ScriptMap::GetMapSizeX()) return (GetRailTracks(tile) & RAILTRACK_NW_SE) != 0;
} else {
return (GetRailTracks(tile) & RAILTRACK_SW_SE) != 0;
}
@@ -301,7 +301,7 @@ static uint32 SimulateDrag(TileIndex from, TileIndex tile, TileIndex *to)
*to -= Clamp((int)::TileX(*to) - (int)::TileX(tile), -1, 1);
} else if (::TileX(from) == ::TileX(*to)) {
p2 |= (TRACK_Y << 6);
*to -= ::MapSizeX() * Clamp((int)::TileY(*to) - (int)::TileY(tile), -1, 1);
*to -= ScriptMap::GetMapSizeX() * Clamp((int)::TileY(*to) - (int)::TileY(tile), -1, 1);
} else if (::TileY(from) < ::TileY(tile)) {
if (::TileX(*to) < ::TileX(tile)) {
p2 |= (TRACK_UPPER << 6);
@@ -311,7 +311,7 @@ static uint32 SimulateDrag(TileIndex from, TileIndex tile, TileIndex *to)
if (diag_offset != 0) {
*to -= Clamp((int)::TileX(*to) - (int)::TileX(tile), -1, 1);
} else {
*to -= ::MapSizeX() * Clamp((int)::TileY(*to) - (int)::TileY(tile), -1, 1);
*to -= ScriptMap::GetMapSizeX() * Clamp((int)::TileY(*to) - (int)::TileY(tile), -1, 1);
}
} else if (::TileY(from) > ::TileY(tile)) {
if (::TileX(*to) < ::TileX(tile)) {
@@ -322,7 +322,7 @@ static uint32 SimulateDrag(TileIndex from, TileIndex tile, TileIndex *to)
if (diag_offset != 0) {
*to -= Clamp((int)::TileX(*to) - (int)::TileX(tile), -1, 1);
} else {
*to -= ::MapSizeX() * Clamp((int)::TileY(*to) - (int)::TileY(tile), -1, 1);
*to -= ScriptMap::GetMapSizeX() * Clamp((int)::TileY(*to) - (int)::TileY(tile), -1, 1);
}
} else if (::TileX(from) < ::TileX(tile)) {
if (::TileY(*to) < ::TileY(tile)) {
@@ -333,7 +333,7 @@ static uint32 SimulateDrag(TileIndex from, TileIndex tile, TileIndex *to)
if (diag_offset == 0) {
*to -= Clamp((int)::TileX(*to) - (int)::TileX(tile), -1, 1);
} else {
*to -= ::MapSizeX() * Clamp((int)::TileY(*to) - (int)::TileY(tile), -1, 1);
*to -= ScriptMap::GetMapSizeX() * Clamp((int)::TileY(*to) - (int)::TileY(tile), -1, 1);
}
} else if (::TileX(from) > ::TileX(tile)) {
if (::TileY(*to) < ::TileY(tile)) {
@@ -344,7 +344,7 @@ static uint32 SimulateDrag(TileIndex from, TileIndex tile, TileIndex *to)
if (diag_offset == 0) {
*to -= Clamp((int)::TileX(*to) - (int)::TileX(tile), -1, 1);
} else {
*to -= ::MapSizeX() * Clamp((int)::TileY(*to) - (int)::TileY(tile), -1, 1);
*to -= ScriptMap::GetMapSizeX() * Clamp((int)::TileY(*to) - (int)::TileY(tile), -1, 1);
}
}
return p2;

View File

@@ -250,7 +250,7 @@
/* static */ bool ScriptTile::RaiseTile(TileIndex tile, int32 slope)
{
EnforcePrecondition(false, ScriptObject::GetCompany() != OWNER_DEITY);
EnforcePrecondition(false, tile < ::MapSize());
EnforcePrecondition(false, tile < ScriptMap::GetMapSize());
return ScriptObject::DoCommand(tile, slope, 1, CMD_TERRAFORM_LAND);
}
@@ -258,7 +258,7 @@
/* static */ bool ScriptTile::LowerTile(TileIndex tile, int32 slope)
{
EnforcePrecondition(false, ScriptObject::GetCompany() != OWNER_DEITY);
EnforcePrecondition(false, tile < ::MapSize());
EnforcePrecondition(false, tile < ScriptMap::GetMapSize());
return ScriptObject::DoCommand(tile, slope, 0, CMD_TERRAFORM_LAND);
}
@@ -266,8 +266,8 @@
/* static */ bool ScriptTile::LevelTiles(TileIndex start_tile, TileIndex end_tile)
{
EnforcePrecondition(false, ScriptObject::GetCompany() != OWNER_DEITY);
EnforcePrecondition(false, start_tile < ::MapSize());
EnforcePrecondition(false, end_tile < ::MapSize());
EnforcePrecondition(false, start_tile < ScriptMap::GetMapSize());
EnforcePrecondition(false, end_tile < ScriptMap::GetMapSize());
return ScriptObject::DoCommand(end_tile, start_tile, LM_LEVEL << 1, CMD_LEVEL_LAND);
}

View File

@@ -12,6 +12,7 @@
#include "script_cargo.hpp"
#include "script_gamesettings.hpp"
#include "script_group.hpp"
#include "script_map.hpp"
#include "../script_instance.hpp"
#include "../../string_func.h"
#include "../../strings_func.h"
@@ -255,8 +256,8 @@
const Vehicle *v = ::Vehicle::Get(vehicle_id);
if (v->type == VEH_AIRCRAFT) {
uint x = Clamp(v->x_pos / TILE_SIZE, 0, ::MapSizeX() - 2);
uint y = Clamp(v->y_pos / TILE_SIZE, 0, ::MapSizeY() - 2);
uint x = Clamp(v->x_pos / TILE_SIZE, 0, ScriptMap::GetMapSizeX() - 2);
uint y = Clamp(v->y_pos / TILE_SIZE, 0, ScriptMap::GetMapSizeY() - 2);
return ::TileXY(x, y);
}