1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

fix issue with incorrect game_command_playerid

This commit is contained in:
zsilencer
2016-01-22 16:57:00 -07:00
parent 5db2a37194
commit c557f02f4b
5 changed files with 9 additions and 6 deletions

View File

@@ -4050,7 +4050,7 @@ STR_5708 :Can't change the group that the host belongs to
STR_5709 :Rename Group
STR_5710 :Group name
STR_5711 :Enter new name for this group:
STR_5712 :Can't set permission that you do not have yourself
STR_5712 :Can't modify permission that you do not have yourself
STR_5713 :Kick Player
#############

View File

@@ -72,7 +72,7 @@ GAME_COMMAND_CALLBACK_POINTER* game_command_callback_table[] = {
game_command_callback_ride_construct_placed_back,
game_command_callback_ride_remove_track_piece,
};
uint8 game_command_playerid = 0;
int game_command_playerid = -1;
int game_command_callback_get_index(GAME_COMMAND_CALLBACK_POINTER* callback)
{
@@ -470,7 +470,7 @@ int game_do_command_p(int command, int *eax, int *ebx, int *ecx, int *edx, int *
scenery_remove_ghost_tool_placement();
}
if (!(flags & GAME_COMMAND_FLAG_NETWORKED)) {
if (game_command_playerid == -1) {
game_command_playerid = network_get_current_player_id();
}
@@ -514,6 +514,8 @@ int game_do_command_p(int command, int *eax, int *ebx, int *ecx, int *edx, int *
// Second call to actually perform the operation
new_game_command_table[command](eax, ebx, ecx, edx, esi, edi, ebp);
game_command_playerid = -1;
if (game_command_callback) {
game_command_callback(*eax, *ebx, *ecx, *edx, *esi, *edi, *ebp);
game_command_callback = 0;

View File

@@ -114,7 +114,7 @@ typedef void (GAME_COMMAND_CALLBACK_POINTER)(int eax, int ebx, int ecx, int edx,
extern GAME_COMMAND_CALLBACK_POINTER* game_command_callback;
int game_command_callback_get_index(GAME_COMMAND_CALLBACK_POINTER* callback);
GAME_COMMAND_CALLBACK_POINTER* game_command_callback_get_callback(int index);
extern uint8 game_command_playerid;
extern int game_command_playerid;
extern GAME_COMMAND_POINTER* new_game_command_table[65];

View File

@@ -2339,7 +2339,7 @@ enum {
STR_RENAME_GROUP = 5709,
STR_GROUP_NAME = 5710,
STR_ENTER_NEW_NAME_FOR_THIS_GROUP = 5711,
STR_CANT_SET_PERMISSION_THAT_YOU_DO_NOT_HAVE_YOURSELF = 5712,
STR_CANT_MODIFY_PERMISSION_THAT_YOU_DO_NOT_HAVE_YOURSELF = 5712,
STR_ACTION_KICK_PLAYER = 5713,

View File

@@ -1424,6 +1424,7 @@ void Network::ProcessGameCommandQueue()
if (GetPlayerID() == gc.playerid) {
game_command_callback = game_command_callback_get_callback(gc.callback);
}
game_command_playerid = gc.playerid;
money32 cost = game_do_command_p(gc.esi, (int*)&gc.eax, (int*)&gc.ebx, (int*)&gc.ecx, (int*)&gc.edx, (int*)&gc.esi, (int*)&gc.edi, (int*)&gc.ebp);
if (cost != MONEY32_UNDEFINED) {
NetworkPlayer* player = GetPlayerByID(gc.playerid);
@@ -2038,7 +2039,7 @@ void game_command_modify_groups(int *eax, int *ebx, int *ecx, int *edx, int *esi
mygroup = gNetwork.GetGroupByID(player->group);
if (mygroup) {
if (!all && !mygroup->CanPerformAction(index)) {
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_SET_PERMISSION_THAT_YOU_DO_NOT_HAVE_YOURSELF;
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = STR_CANT_MODIFY_PERMISSION_THAT_YOU_DO_NOT_HAVE_YOURSELF;
*ebx = MONEY32_UNDEFINED;
return;
}