diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 7c4ccfb38..df3ae5cd0 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ D2X-Rebirth Changelog +20110923 +-------- +main/state.c: When restoring Coop players and make turn them into ghosts perform a check if this player is actually a valid player so we do not just blindly use any object number from a possibly uninitialized player structure + 20110921 -------- main/net_udp.c: Streamlined joining, rejoining, disconnecting players and timeouts, getting rid of unwanted rejoin messages and let host remove a player for good without rejoining it via pdata packet to really get rid of lossy or unwanted players; Care for rollover of pkt_num of stored mdata packets diff --git a/main/state.c b/main/state.c index 9c1da7df4..69f3bc9d3 100644 --- a/main/state.c +++ b/main/state.c @@ -1095,7 +1095,7 @@ int state_save_all_sub(char *filename, char *desc) // Save Coop Info if (Game_mode & GM_MULTI_COOP) { - for (i = 0; i < MAX_PLAYERS; i++) + for (i = 0; i < MAX_PLAYERS; i++) // I know, I know we only allow 4 players in coop. I screwed that up. But if we ever allow 8 players in coop, who's gonna laugh then? { player_rw *pl_rw; MALLOC(pl_rw, player_rw, 1); @@ -1634,9 +1634,11 @@ int state_restore_all_sub(char *filename, int secret_restore) // make all (previous) player objects to ghosts obj = &Objects[restore_players[i].objnum]; - obj->type = OBJ_GHOST; - multi_reset_player_object(obj); - + if (restore_players[i].connected == CONNECT_PLAYING && obj->type == OBJ_PLAYER) + { + obj->type = OBJ_GHOST; + multi_reset_player_object(obj); + } } for (i = 0; i < MAX_PLAYERS; i++) // copy restored players to the current slots {