1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 19:13:07 +01:00

fix demolish track piece as client on multiplayer

This commit is contained in:
IntelOrca
2015-11-03 22:58:30 +00:00
parent c8701ef01e
commit 800e80aeb3
4 changed files with 31 additions and 12 deletions

View File

@@ -871,10 +871,12 @@ bool Network::ProcessConnection(NetworkConnection& connection)
break;
}
} while (packetStatus == NETWORK_READPACKET_MORE_DATA || packetStatus == NETWORK_READPACKET_SUCCESS);
#if !DEBUG
if (!connection.ReceivedPacketRecently()) {
connection.last_disconnect_reason = "No Data";
return false;
}
#endif
return true;
}

View File

@@ -129,6 +129,11 @@ static const int RideInspectionInterval[] = {
rct_ride_type **gRideTypeList = RCT2_ADDRESS(RCT2_ADDRESS_RIDE_ENTRIES, rct_ride_type*);
rct_ride* g_ride_list = RCT2_ADDRESS(RCT2_ADDRESS_RIDE_LIST, rct_ride);
bool gGotoStartPlacementMode = false;
int gRideRemoveTrackPieceCallbackX;
int gRideRemoveTrackPieceCallbackY;
int gRideRemoveTrackPieceCallbackZ;
int gRideRemoveTrackPieceCallbackDirection;
int gRideRemoveTrackPieceCallbackType;
// Static function declarations
rct_peep *find_closest_mechanic(int x, int y, int forInspection);
@@ -5548,15 +5553,14 @@ void game_command_callback_ride_construct_placed_front(int eax, int ebx, int ecx
void game_command_callback_ride_remove_track_piece(int eax, int ebx, int ecx, int edx, int esi, int edi, int ebp)
{
int x, y, z, direction, type;
rct_xy_element outputElement;
x = _currentTrackBeginX;
y = _currentTrackBeginY;
z = _currentTrackBeginZ;
direction = _currentTrackPieceDirection;
type = _currentTrackPieceType;
window_ride_construction_mouseup_demolish_next_piece(x, y, z, direction, type, outputElement);
x = gRideRemoveTrackPieceCallbackX;
y = gRideRemoveTrackPieceCallbackY;
z = gRideRemoveTrackPieceCallbackZ;
direction = gRideRemoveTrackPieceCallbackDirection;
type = gRideRemoveTrackPieceCallbackType;
window_ride_construction_mouseup_demolish_next_piece(x, y, z, direction, type);
}
/**

View File

@@ -877,6 +877,11 @@ extern const uint8 gRideClassifications[255];
#define _currentSeatRotationAngle RCT2_GLOBAL(0x00F440CF, uint8)
extern bool gGotoStartPlacementMode;
extern int gRideRemoveTrackPieceCallbackX;
extern int gRideRemoveTrackPieceCallbackY;
extern int gRideRemoveTrackPieceCallbackZ;
extern int gRideRemoveTrackPieceCallbackDirection;
extern int gRideRemoveTrackPieceCallbackType;
int ride_get_count();
int ride_get_total_queue_length(rct_ride *ride);
@@ -1012,6 +1017,6 @@ bool shop_item_is_souvenir(int shopItem);
void ride_reset_all_names();
const uint8* ride_seek_available_modes(rct_ride *ride);
void window_ride_construction_mouseup_demolish_next_piece(int x, int y, int z, int direction, int type, rct_xy_element outputElement);
void window_ride_construction_mouseup_demolish_next_piece(int x, int y, int z, int direction, int type);
#endif

View File

@@ -1753,10 +1753,18 @@ static void window_ride_construction_mouseup_demolish(rct_window* w)
return;
}
window_ride_construction_mouseup_demolish_next_piece(x, y, z, direction, type, outputElement);
if (network_get_mode() == NETWORK_MODE_CLIENT) {
gRideRemoveTrackPieceCallbackX = x;
gRideRemoveTrackPieceCallbackY = y;
gRideRemoveTrackPieceCallbackZ = z;
gRideRemoveTrackPieceCallbackDirection = direction;
gRideRemoveTrackPieceCallbackType = type;
} else {
window_ride_construction_mouseup_demolish_next_piece(x, y, z, direction, type);
}
}
void window_ride_construction_mouseup_demolish_next_piece(int x, int y, int z, int direction, int type, rct_xy_element outputElement)
void window_ride_construction_mouseup_demolish_next_piece(int x, int y, int z, int direction, int type)
{
int slope, slopeEnd, b2, bankEnd, bankStart, b5, b4;
if (gGotoStartPlacementMode) {
@@ -1775,7 +1783,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, &outputElement)) {
if (!sub_6CAF80(_currentRideIndex, NULL)) {
sub_6CC3FB(_currentRideIndex);
_currentTrackPieceDirection = direction;
if (!(slope & 0x100)) {