From 14835b9e314ba6bf6c20222ad3de6217945c5298 Mon Sep 17 00:00:00 2001 From: Phillip Walters Date: Sun, 10 Feb 2019 17:58:02 -0800 Subject: [PATCH 1/4] Removed dead code per issue 8677 (https://github.com/OpenRCT2/OpenRCT2/issues/8677) --- src/openrct2/Game.cpp | 136 +----------------------------------------- 1 file changed, 2 insertions(+), 134 deletions(-) diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index a65150bd1d..6196c8fb5b 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -601,21 +601,6 @@ void game_log_multiplayer_command(int command, const int* eax, const int* ebx, c format_string(log_msg, 256, STR_LOG_CHEAT_USED, args); network_append_server_log(log_msg); } - else if (command == GAME_COMMAND_CREATE_RIDE && *ebp == 1) - { // ebp is 1 if the command comes from ride_create method in ride.c, other calls send ride_entry instead of ride and wont - // work - // Get ride name - Ride* ride = get_ride(*edx); - char ride_name[128]; - format_string(ride_name, 128, ride->name, &ride->name_arguments); - - char* args[2] = { - (char*)player_name, - ride_name, - }; - format_string(log_msg, 256, STR_LOG_CREATE_RIDE, args); - network_append_server_log(log_msg); - } else if (command == GAME_COMMAND_DEMOLISH_RIDE && (*ebp == 1 || *ebp == 0)) { // ebp is 1 if command comes from ride window prompt, so we don't log "demolishing" ride previews // Get ride name @@ -630,96 +615,6 @@ void game_log_multiplayer_command(int command, const int* eax, const int* ebx, c format_string(log_msg, 256, STR_LOG_DEMOLISH_RIDE, args); network_append_server_log(log_msg); } - else if ( - command == GAME_COMMAND_SET_RIDE_APPEARANCE || command == GAME_COMMAND_SET_RIDE_VEHICLES - || command == GAME_COMMAND_SET_RIDE_SETTING) - { - // Get ride name - int ride_index = *edx & 0xFF; - Ride* ride = get_ride(ride_index); - char ride_name[128]; - format_string(ride_name, 128, ride->name, &ride->name_arguments); - - char* args[2] = { - (char*)player_name, - ride_name, - }; - - switch (command) - { - case GAME_COMMAND_SET_RIDE_APPEARANCE: - format_string(log_msg, 256, STR_LOG_RIDE_APPEARANCE, args); - break; - case GAME_COMMAND_SET_RIDE_VEHICLES: - format_string(log_msg, 256, STR_LOG_RIDE_VEHICLES, args); - break; - case GAME_COMMAND_SET_RIDE_SETTING: - format_string(log_msg, 256, STR_LOG_RIDE_SETTINGS, args); - break; - } - - network_append_server_log(log_msg); - } - else if (command == GAME_COMMAND_SET_RIDE_STATUS) - { - // Get ride name - int ride_index = *edx & 0xFF; - Ride* ride = get_ride(ride_index); - char ride_name[128]; - format_string(ride_name, 128, ride->name, &ride->name_arguments); - - char* args[2] = { - (char*)player_name, - ride_name, - }; - - int status = *edx >> 8; - switch (status) - { - case 0: - format_string(log_msg, 256, STR_LOG_RIDE_STATUS_CLOSED, args); - break; - case 1: - format_string(log_msg, 256, STR_LOG_RIDE_STATUS_OPEN, args); - break; - case 2: - format_string(log_msg, 256, STR_LOG_RIDE_STATUS_TESTING, args); - break; - } - - network_append_server_log(log_msg); - } - else if (command == GAME_COMMAND_SET_RIDE_PRICE) - { - // Get ride name - int ride_index = *edx & 0xFF; - Ride* ride = get_ride(ride_index); - char ride_name[128]; - format_string(ride_name, 128, ride->name, &ride->name_arguments); - - // Format price - int price_args[1] = { *edi }; - char price_str[16]; - format_string(price_str, 16, STR_BOTTOM_TOOLBAR_CASH, price_args); - - // Log change in primary or secondary price - char* args[3] = { - (char*)player_name, - ride_name, - price_str, - }; - - if (*edx >> 8 == 0) - { - format_string(log_msg, 256, STR_LOG_RIDE_PRICE, args); - } - else if (*edx >> 8 == 1) - { - format_string(log_msg, 256, STR_LOG_RIDE_SECONDARY_PRICE, args); - } - - network_append_server_log(log_msg); - } else if (command == GAME_COMMAND_SET_PARK_OPEN) { // Log change in park open/close @@ -738,22 +633,6 @@ void game_log_multiplayer_command(int command, const int* eax, const int* ebx, c network_append_server_log(log_msg); } - else if (command == GAME_COMMAND_SET_PARK_ENTRANCE_FEE) - { - // Format price - int price_args[1] = { *edi }; - char price_str[16]; - format_string(price_str, 16, STR_BOTTOM_TOOLBAR_CASH, price_args); - - // Log change in park entrance fee - char* args[2] = { - (char*)player_name, - price_str, - }; - - format_string(log_msg, 256, STR_LOG_PARK_ENTRANCE_FEE, args); - network_append_server_log(log_msg); - } else if ( command == GAME_COMMAND_PLACE_SCENERY || command == GAME_COMMAND_PLACE_WALL || command == GAME_COMMAND_PLACE_LARGE_SCENERY || command == GAME_COMMAND_PLACE_BANNER) @@ -773,9 +652,7 @@ void game_log_multiplayer_command(int command, const int* eax, const int* ebx, c format_string(log_msg, 256, STR_LOG_PLACE_SCENERY, args); network_append_server_log(log_msg); } - else if ( - command == GAME_COMMAND_REMOVE_SCENERY || command == GAME_COMMAND_REMOVE_WALL - || command == GAME_COMMAND_REMOVE_LARGE_SCENERY || command == GAME_COMMAND_REMOVE_BANNER) + else if (command == GAME_COMMAND_REMOVE_BANNER) { uint8_t flags = *ebx & 0xFF; if (flags & GAME_COMMAND_FLAG_GHOST) @@ -794,8 +671,7 @@ void game_log_multiplayer_command(int command, const int* eax, const int* ebx, c else if ( command == GAME_COMMAND_SET_SCENERY_COLOUR || command == GAME_COMMAND_SET_WALL_COLOUR || command == GAME_COMMAND_SET_LARGE_SCENERY_COLOUR || command == GAME_COMMAND_SET_BANNER_COLOUR - || command == GAME_COMMAND_SET_BANNER_NAME || command == GAME_COMMAND_SET_SIGN_NAME - || command == GAME_COMMAND_SET_BANNER_STYLE || command == GAME_COMMAND_SET_SIGN_STYLE) + || command == GAME_COMMAND_SET_SIGN_NAME || command == GAME_COMMAND_SET_BANNER_STYLE) { // Log editing scenery char* args[1] = { @@ -851,14 +727,6 @@ void game_log_multiplayer_command(int command, const int* eax, const int* ebx, c format_string(log_msg, 256, STR_LOG_REMOVE_TRACK, args); network_append_server_log(log_msg); } - else if (command == GAME_COMMAND_PLACE_PEEP_SPAWN) - { - char* args[1] = { - (char*)player_name, - }; - format_string(log_msg, 256, STR_LOG_PLACE_PEEP_SPAWN, args); - network_append_server_log(log_msg); - } } void pause_toggle() From 28d4446da4efea6aa70f006783879479e3c56fa1 Mon Sep 17 00:00:00 2001 From: Phillip Walters Date: Mon, 11 Feb 2019 18:58:56 -0800 Subject: [PATCH 2/4] Re-added some code that shouldn't have been removed and removed some other code that I missed last time. --- src/openrct2/Game.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index 6196c8fb5b..c2afa86dc4 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -615,6 +615,35 @@ void game_log_multiplayer_command(int command, const int* eax, const int* ebx, c format_string(log_msg, 256, STR_LOG_DEMOLISH_RIDE, args); network_append_server_log(log_msg); } + else if ( + command == GAME_COMMAND_SET_RIDE_VEHICLES || command == GAME_COMMAND_SET_RIDE_SETTING) + { + // Get ride name + int ride_index = *edx & 0xFF; + Ride* ride = get_ride(ride_index); + char ride_name[128]; + format_string(ride_name, 128, ride->name, &ride->name_arguments); + + char* args[2] = { + (char*)player_name, + ride_name, + }; + + switch (command) + { + case GAME_COMMAND_SET_RIDE_APPEARANCE: + format_string(log_msg, 256, STR_LOG_RIDE_APPEARANCE, args); + break; + case GAME_COMMAND_SET_RIDE_VEHICLES: + format_string(log_msg, 256, STR_LOG_RIDE_VEHICLES, args); + break; + case GAME_COMMAND_SET_RIDE_SETTING: + format_string(log_msg, 256, STR_LOG_RIDE_SETTINGS, args); + break; + } + + network_append_server_log(log_msg); + } else if (command == GAME_COMMAND_SET_PARK_OPEN) { // Log change in park open/close @@ -671,7 +700,7 @@ void game_log_multiplayer_command(int command, const int* eax, const int* ebx, c else if ( command == GAME_COMMAND_SET_SCENERY_COLOUR || command == GAME_COMMAND_SET_WALL_COLOUR || command == GAME_COMMAND_SET_LARGE_SCENERY_COLOUR || command == GAME_COMMAND_SET_BANNER_COLOUR - || command == GAME_COMMAND_SET_SIGN_NAME || command == GAME_COMMAND_SET_BANNER_STYLE) + || command == GAME_COMMAND_SET_BANNER_STYLE) { // Log editing scenery char* args[1] = { From 11ff0b6688d9ed20da348e0ed23f76f1c782cf10 Mon Sep 17 00:00:00 2001 From: Phillip Walters Date: Tue, 12 Feb 2019 17:53:39 -0800 Subject: [PATCH 3/4] Cleaned up some formatting --- src/openrct2/Game.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index c2afa86dc4..94f5ed6712 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -615,8 +615,7 @@ void game_log_multiplayer_command(int command, const int* eax, const int* ebx, c format_string(log_msg, 256, STR_LOG_DEMOLISH_RIDE, args); network_append_server_log(log_msg); } - else if ( - command == GAME_COMMAND_SET_RIDE_VEHICLES || command == GAME_COMMAND_SET_RIDE_SETTING) + else if (command == GAME_COMMAND_SET_RIDE_VEHICLES || command == GAME_COMMAND_SET_RIDE_SETTING) { // Get ride name int ride_index = *edx & 0xFF; From b7787daa9f7aa81bc31839a8759318a085d7deae Mon Sep 17 00:00:00 2001 From: Phillip Walters Date: Tue, 12 Feb 2019 18:02:33 -0800 Subject: [PATCH 4/4] More formatting changes. --- src/openrct2/Game.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index 94f5ed6712..13b42fed05 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -615,7 +615,7 @@ void game_log_multiplayer_command(int command, const int* eax, const int* ebx, c format_string(log_msg, 256, STR_LOG_DEMOLISH_RIDE, args); network_append_server_log(log_msg); } - else if (command == GAME_COMMAND_SET_RIDE_VEHICLES || command == GAME_COMMAND_SET_RIDE_SETTING) + else if (command == GAME_COMMAND_SET_RIDE_VEHICLES || command == GAME_COMMAND_SET_RIDE_SETTING) { // Get ride name int ride_index = *edx & 0xFF;