mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 15:52:55 +01:00
fix #2651: remove ride when multiplayer client aborts ride construction
also fix ride construction window closing immediately after placing first track piece of a ride for clients
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
- Fix: [#2126] Ferris Wheels set to "backward rotation" stop working (original bug)
|
||||
- Fix: [#2449] Turning off Day/Night Circle while it is night doesn't reset back to day
|
||||
- Fix: [#2650] Server did not validate actions send from clients (caused error box and desynchronisation)
|
||||
- Fix: [#2651] Ride was not removed when multiplayer client aborted ride construction.
|
||||
|
||||
0.0.3.1-beta (2015-12-04)
|
||||
------------------------------------------------------------------------
|
||||
|
||||
@@ -310,15 +310,11 @@ money32 ride_calculate_income_per_hour(rct_ride *ride)
|
||||
* dl ride index
|
||||
* esi result map element
|
||||
*/
|
||||
int sub_6CAF80(int rideIndex, rct_xy_element *output)
|
||||
bool ride_try_get_origin_element(int rideIndex, rct_xy_element *output)
|
||||
{
|
||||
rct_map_element *resultMapElement = NULL;
|
||||
|
||||
map_element_iterator it;
|
||||
rct_map_element *resultMapElement;
|
||||
int foundSpecialTrackPiece;
|
||||
|
||||
resultMapElement = NULL;
|
||||
foundSpecialTrackPiece = 0;
|
||||
|
||||
map_element_iterator_begin(&it);
|
||||
do {
|
||||
if (map_element_get_type(it.element) != MAP_ELEMENT_TYPE_TRACK)
|
||||
@@ -329,9 +325,9 @@ int sub_6CAF80(int rideIndex, rct_xy_element *output)
|
||||
// Found a track piece for target ride
|
||||
|
||||
// Check if its not the station or ??? (but allow end piece of station)
|
||||
int specialTrackPiece = (
|
||||
it.element->properties.track.type != 2 &&
|
||||
it.element->properties.track.type != 3 &&
|
||||
bool specialTrackPiece = (
|
||||
it.element->properties.track.type != TRACK_ELEM_BEGIN_STATION &&
|
||||
it.element->properties.track.type != TRACK_ELEM_MIDDLE_STATION &&
|
||||
(RCT2_ADDRESS(0x0099BA64, uint8)[it.element->properties.track.type * 16] & 0x10)
|
||||
);
|
||||
|
||||
@@ -347,8 +343,7 @@ int sub_6CAF80(int rideIndex, rct_xy_element *output)
|
||||
}
|
||||
|
||||
if (specialTrackPiece) {
|
||||
foundSpecialTrackPiece = 1;
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
} while (map_element_iterator_next(&it));
|
||||
|
||||
@@ -875,7 +870,7 @@ void ride_construct(int rideIndex)
|
||||
rct_xy_element trackElement;
|
||||
rct_window *w;
|
||||
|
||||
if (sub_6CAF80(rideIndex, &trackElement)) {
|
||||
if (ride_try_get_origin_element(rideIndex, &trackElement)) {
|
||||
ride_find_track_gap(&trackElement, &trackElement);
|
||||
|
||||
w = window_get_main();
|
||||
@@ -4552,7 +4547,7 @@ void loc_6B51C0(int rideIndex)
|
||||
z = ride->station_heights[i] * 8;
|
||||
window_scroll_to_location(w, x, y, z);
|
||||
|
||||
sub_6CAF80(rideIndex, &trackElement);
|
||||
ride_try_get_origin_element(rideIndex, &trackElement);
|
||||
ride_find_track_gap(&trackElement, &trackElement);
|
||||
ride_modify(&trackElement);
|
||||
|
||||
|
||||
@@ -891,7 +891,7 @@ money32 get_shop_item_cost(int shopItem);
|
||||
money16 get_shop_base_value(int shopItem);
|
||||
money16 get_shop_hot_value(int shopItem);
|
||||
money16 get_shop_cold_value(int shopItem);
|
||||
int sub_6CAF80(int rideIndex, rct_xy_element *output);
|
||||
bool ride_try_get_origin_element(int rideIndex, rct_xy_element *output);
|
||||
int ride_find_track_gap(rct_xy_element *input, rct_xy_element *output);
|
||||
void ride_construct_new(ride_list_item listItem);
|
||||
void ride_construct(int rideIndex);
|
||||
|
||||
@@ -2694,7 +2694,7 @@ int tracked_ride_to_td6(uint8 rideIndex, rct_track_td6* track_design, uint8* tra
|
||||
rct_xy_element trackElement;
|
||||
track_begin_end trackBeginEnd;
|
||||
|
||||
if (sub_6CAF80(rideIndex, &trackElement) == 0){
|
||||
if (!ride_try_get_origin_element(rideIndex, &trackElement)) {
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -566,8 +566,6 @@ rct_window *window_ride_construction_open()
|
||||
*/
|
||||
static void window_ride_construction_close(rct_window *w)
|
||||
{
|
||||
rct_xy_element mapElement;
|
||||
|
||||
sub_6C9627();
|
||||
viewport_set_visibility(0);
|
||||
|
||||
@@ -584,8 +582,7 @@ static void window_ride_construction_close(rct_window *w)
|
||||
hide_gridlines();
|
||||
|
||||
uint8 rideIndex = _currentRideIndex;
|
||||
if (sub_6CAF80(rideIndex, &mapElement) || network_get_mode() == NETWORK_MODE_CLIENT) {
|
||||
|
||||
if (ride_try_get_origin_element(rideIndex, NULL)) {
|
||||
rct_ride *ride = GET_RIDE(rideIndex);
|
||||
if (ride->mode == RIDE_MODE_SHOP_STALL && gConfigGeneral.auto_open_shops) {
|
||||
ride->status = RIDE_STATUS_OPEN;
|
||||
@@ -1799,7 +1796,7 @@ void window_ride_construction_mouseup_demolish_next_piece(int x, int y, int z, i
|
||||
b4 = _currentTrackLiftHill;
|
||||
ride_construction_set_default_next_piece();
|
||||
sub_6C84CE();
|
||||
if (!sub_6CAF80(_currentRideIndex, NULL)) {
|
||||
if (!ride_try_get_origin_element(_currentRideIndex, NULL)) {
|
||||
sub_6CC3FB(_currentRideIndex);
|
||||
_currentTrackPieceDirection = direction;
|
||||
if (!(slope & 0x100)) {
|
||||
@@ -1866,7 +1863,7 @@ static void window_ride_construction_rotate(rct_window *w)
|
||||
static void window_ride_construction_entrance_click(rct_window *w)
|
||||
{
|
||||
if (tool_set(w, WIDX_ENTRANCE, 12)) {
|
||||
if (!sub_6CAF80(_currentRideIndex, NULL)) {
|
||||
if (!ride_try_get_origin_element(_currentRideIndex, NULL)) {
|
||||
sub_6CC3FB(_currentRideIndex);
|
||||
}
|
||||
} else {
|
||||
@@ -1890,7 +1887,7 @@ static void window_ride_construction_entrance_click(rct_window *w)
|
||||
static void window_ride_construction_exit_click(rct_window *w)
|
||||
{
|
||||
if (tool_set(w, WIDX_EXIT, 12)) {
|
||||
if (!sub_6CAF80(_currentRideIndex, NULL)) {
|
||||
if (!ride_try_get_origin_element(_currentRideIndex, NULL)) {
|
||||
sub_6CC3FB(_currentRideIndex);
|
||||
}
|
||||
} else {
|
||||
@@ -3648,7 +3645,10 @@ void ride_construction_tooldown_construct(int screenX, int screenY)
|
||||
w = window_find_by_class(WC_RIDE_CONSTRUCTION);
|
||||
if (w != NULL) {
|
||||
if (ride_are_all_possible_entrances_and_exits_built(ride)) {
|
||||
window_close(w);
|
||||
// Clients don't necessarily have any ride built at this point
|
||||
if (network_get_mode() == NETWORK_MODE_NONE) {
|
||||
window_close(w);
|
||||
}
|
||||
} else {
|
||||
window_event_mouse_up_call(w, WIDX_ENTRANCE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user