1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-24 00:03:11 +01:00

Show error message when map element limit is reached

This commit is contained in:
Broxzier
2016-11-03 00:01:10 +01:00
parent 109f1d094e
commit c60463c8a7
3 changed files with 12 additions and 1 deletions

View File

@@ -4299,6 +4299,8 @@ STR_5987 :Unable to create folder
STR_5988 :{SMALLFONT}{BLACK}No remaining land rights for sale
STR_5989 :{SMALLFONT}{BLACK}No remaining construction rights for sale
STR_5990 :{SMALLFONT}{BLACK}No remaining land rights or construction rights for sale
STR_5991 :Can't paste element...
STR_5992 :The map elements limit has been reached
#############
# Scenarios #

View File

@@ -3639,6 +3639,8 @@ enum {
STR_NO_LAND_RIGHTS_FOR_SALE_TIP = 5988,
STR_NO_CONSTRUCTION_RIGHTS_FOR_SALE_TIP = 5989,
STR_NO_LAND_OR_CONSTRUCTION_RIGHTS_FOR_SALE_TIP = 5990,
STR_CANT_PASTE = 5991,
STR_MAP_ELEMENT_LIMIT_REACHED = 5992,
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
STR_COUNT = 32768

View File

@@ -15,6 +15,7 @@
#pragma endregion
#include "dropdown.h"
#include "error.h"
#include "../input.h"
#include "../interface/themes.h"
#include "../interface/viewport.h"
@@ -740,6 +741,13 @@ static void window_tile_inspector_copy_element(rct_window *w)
static void window_tile_inspector_paste_element(rct_window *w)
{
rct_map_element *const pastedElement = map_element_insert(windowTileInspectorTileX, windowTileInspectorTileY, tileInspectorCopiedElement.base_height, 0);
if (pastedElement == NULL) {
// map_element_insert displays an error message on failure
window_error_open(STR_CANT_PASTE, STR_MAP_ELEMENT_LIMIT_REACHED);
return;
}
windowTileInspectorElementCount++;
bool lastForTile = map_element_is_last_for_tile(pastedElement);
*pastedElement = tileInspectorCopiedElement;
pastedElement->flags &= ~MAP_ELEMENT_FLAG_LAST_TILE;
@@ -1066,7 +1074,6 @@ static void window_tile_inspector_mouseup(rct_window *w, int widgetIndex)
case WIDX_BUTTON_PASTE:
window_tile_inspector_paste_element(w);
map_invalidate_tile_full(windowTileInspectorTileX << 5, windowTileInspectorTileY << 5);
windowTileInspectorElementCount++;
widget_invalidate(w, WIDX_LIST);
break;
case WIDX_BUTTON_MOVE_DOWN: