mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-04 13:42:55 +01:00
Add console option to reset all user strings
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "../addresses.h"
|
||||
#include "../drawing/drawing.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../localisation/user.h"
|
||||
#include "../platform/platform.h"
|
||||
#include "../world/park.h"
|
||||
#include "../util/sawyercoding.h"
|
||||
@@ -816,6 +817,7 @@ static int cc_load_object(const utf8 **argv, int argc) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cc_object_count(const utf8 **argv, int argc) {
|
||||
const utf8* object_type_names[] = { "Rides", "Small scenery", "Large scenery", "Walls", "Banners", "Paths", "Path Additions", "Scenery groups", "Park entrances", "Water" };
|
||||
for (int i = 0; i < 10; i++) {
|
||||
@@ -831,6 +833,13 @@ static int cc_object_count(const utf8 **argv, int argc) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cc_reset_user_strings(const utf8 **argv, int argc)
|
||||
{
|
||||
reset_user_strings();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cc_open(const utf8 **argv, int argc) {
|
||||
if (argc > 0) {
|
||||
bool title = (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TITLE_DEMO) != 0;
|
||||
@@ -920,7 +929,8 @@ console_command console_command_table[] = {
|
||||
"This is a safer method opposed to \"open object_selection\".",
|
||||
"load_object <objectfilenodat>" },
|
||||
{ "object_count", cc_object_count, "Shows the number of objects of each type in the scenario.", "object_count" },
|
||||
{ "twitch", cc_twitch, "Twitch API" }
|
||||
{ "twitch", cc_twitch, "Twitch API" },
|
||||
{ "reset_user_strings", cc_reset_user_strings, "Resets all user-defined strings, to fix incorrectly occurring 'Chosen name in use already' errors.", "reset_user_strings" }
|
||||
};
|
||||
|
||||
static int cc_windows(const utf8 **argv, int argc) {
|
||||
|
||||
@@ -89,4 +89,12 @@ static bool user_string_exists(const utf8 *text)
|
||||
bool is_user_string_id(rct_string_id stringId)
|
||||
{
|
||||
return stringId >= 0x8000 && stringId < 0x9000;
|
||||
}
|
||||
}
|
||||
|
||||
void reset_user_strings()
|
||||
{
|
||||
char *userString = gUserStrings;
|
||||
for (int i = 0; i < MAX_USER_STRINGS; i++, userString += USER_STRING_MAX_LENGTH) {
|
||||
userString[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
21
src/localisation/user.h
Normal file
21
src/localisation/user.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/*****************************************************************************
|
||||
* Copyright (c) 2015 Michael Steenbeek
|
||||
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
||||
*
|
||||
* This file is part of OpenRCT2.
|
||||
*
|
||||
* OpenRCT2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*****************************************************************************/
|
||||
|
||||
void reset_user_strings();
|
||||
Reference in New Issue
Block a user