mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #2535 from Gymnasiast/allow-ownership-map-edges
Allow setting ownership of map edges
This commit is contained in:
commit
ec50198fa4
|
@ -29,6 +29,7 @@
|
|||
- Feature: Ability to automatically open shops after placing them.
|
||||
- Feature: Ability to change the default inspection interval for rides.
|
||||
- Feature: Ability to disable lightning effect during a thunderstorm.
|
||||
- Feature: Ability to set ownership of map edges.
|
||||
- Feature: Display a chat hotkey when joining a server.
|
||||
- Change: Server IP addresses are no longer shown in the server list.
|
||||
- Change: Theme format changed from INI to JSON (INI format no longer supported).
|
||||
|
|
|
@ -686,6 +686,8 @@ enum {
|
|||
|
||||
STR_CANT_OPEN_PARK = 1723,
|
||||
STR_CANT_CLOSE_PARK = 1724,
|
||||
STR_LAND_NOT_FOR_SALE = 1726,
|
||||
STR_CONSTRUCTION_RIGHTS_NOT_FOR_SALE = 1727,
|
||||
|
||||
STR_LAND_NOT_OWNED_BY_PARK = 1729,
|
||||
|
||||
|
@ -1770,6 +1772,7 @@ enum {
|
|||
|
||||
STR_CANT_DECREASE_MAP_SIZE_ANY_FURTHER = 3213,
|
||||
STR_CANT_INCREASE_MAP_SIZE_ANY_FURTHER = 3214,
|
||||
STR_TOO_CLOSE_TO_EDGE_OF_MAP = 3215,
|
||||
|
||||
STR_SELECT_PARK_OWNED_LAND_TIP = 3216,
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ bool gClearFootpath;
|
|||
static void tiles_init();
|
||||
static void map_update_grass_length(int x, int y, rct_map_element *mapElement);
|
||||
static void map_set_grass_length(int x, int y, rct_map_element *mapElement, int length);
|
||||
static void sub_68AE2A(int x, int y);
|
||||
static void clear_elements_at(int x, int y);
|
||||
static void translate_3d_to_2d(int rotation, int *x, int *y);
|
||||
static void map_obstruction_set_error_text(rct_map_element *mapElement);
|
||||
|
||||
|
@ -4384,11 +4384,8 @@ void map_remove_out_of_range_elements()
|
|||
for (int y = 0; y < (256 * 32); y += 32) {
|
||||
for (int x = 0; x < (256 * 32); x += 32) {
|
||||
if (x == 0 || y == 0 || x >= mapMaxXY || y >= mapMaxXY) {
|
||||
sub_68AE2A(x, y);
|
||||
} else if (x >= mapMaxXY - 32 || y >= mapMaxXY - 32) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16) += 32;
|
||||
map_buy_land_rights(x, y, x, y, 6, GAME_COMMAND_FLAG_APPLY);
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16) -= 32;
|
||||
map_buy_land_rights(x, y, x, y, 1, GAME_COMMAND_FLAG_APPLY);
|
||||
clear_elements_at(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4435,6 +4432,8 @@ void map_extend_boundary_surface()
|
|||
newMapElement->properties.surface.slope |= slope;
|
||||
newMapElement->base_height = z;
|
||||
newMapElement->clearance_height = z;
|
||||
|
||||
update_park_fences(x << 5, y << 5);
|
||||
}
|
||||
|
||||
x = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE, uint16) - 2;
|
||||
|
@ -4469,11 +4468,16 @@ void map_extend_boundary_surface()
|
|||
newMapElement->properties.surface.slope |= slope;
|
||||
newMapElement->base_height = z;
|
||||
newMapElement->clearance_height = z;
|
||||
}
|
||||
|
||||
update_park_fences(x << 5, y << 5);
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_68AE2A(int x, int y)
|
||||
/**
|
||||
* Clears all elements properly from a certain tile.
|
||||
* rct2: 0x0068AE2A
|
||||
*/
|
||||
static void clear_elements_at(int x, int y)
|
||||
{
|
||||
for (;;) {
|
||||
rct2_peep_spawn *peepSpawns = RCT2_ADDRESS(RCT2_ADDRESS_PEEP_SPAWNS, rct2_peep_spawn);
|
||||
|
@ -4894,7 +4898,7 @@ void map_clear_all_elements()
|
|||
{
|
||||
for (int y = 0; y < (256 * 32); y += 32) {
|
||||
for (int x = 0; x < (256 * 32); x += 32) {
|
||||
sub_68AE2A(x, y);
|
||||
clear_elements_at(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -721,6 +721,12 @@ void update_park_fences(int x, int y)
|
|||
if (y > 0x1FFF)
|
||||
return;
|
||||
|
||||
// When setting the ownership of map edges
|
||||
if (x <= 0 || x >= RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16))
|
||||
return;
|
||||
if (y <= 0 || y >= RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16))
|
||||
return;
|
||||
|
||||
rct_map_element* sufaceElement = map_get_surface_element_at(x / 32, y / 32);
|
||||
if (sufaceElement == NULL)return;
|
||||
|
||||
|
@ -932,7 +938,7 @@ money32 map_buy_land_rights_for_tile(int x, int y, int setting, int flags) {
|
|||
}
|
||||
|
||||
if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) != 0 || (surfaceElement->properties.surface.ownership & OWNERSHIP_AVAILABLE) == 0) {
|
||||
gGameCommandErrorText = 1726; // Land not for sale!
|
||||
gGameCommandErrorText = STR_LAND_NOT_FOR_SALE;
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY) {
|
||||
|
@ -960,7 +966,7 @@ money32 map_buy_land_rights_for_tile(int x, int y, int setting, int flags) {
|
|||
}
|
||||
|
||||
if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_SCENARIO_EDITOR) != 0 || (surfaceElement->properties.surface.ownership & OWNERSHIP_CONSTRUCTION_RIGHTS_AVAILABLE) == 0) {
|
||||
gGameCommandErrorText = 1727; // Construction rights not for sale!
|
||||
gGameCommandErrorText = STR_CONSTRUCTION_RIGHTS_NOT_FOR_SALE;
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
|
@ -996,13 +1002,13 @@ money32 map_buy_land_rights_for_tile(int x, int y, int setting, int flags) {
|
|||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if (x <= 32 || y <= 32) {
|
||||
gGameCommandErrorText = 3215;
|
||||
if (x <= 0 || y <= 0) {
|
||||
gGameCommandErrorText = STR_TOO_CLOSE_TO_EDGE_OF_MAP;
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if (x >= RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16) - 32 || y >= RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16) - 32) {
|
||||
gGameCommandErrorText = 3215;
|
||||
if (x >= RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16) || y >= RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16)) {
|
||||
gGameCommandErrorText = STR_TOO_CLOSE_TO_EDGE_OF_MAP;
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue