Resolved termination issue when reading and comparing callsigns fro Coop savestates; Added scores sending after Coop savestate loading as unrestored players will send them when loading new level
This commit is contained in:
parent
cc5a7d1359
commit
3705012d32
|
@ -1,12 +1,23 @@
|
|||
D2X-Rebirth Changelog
|
||||
|
||||
20110420
|
||||
--------
|
||||
main/multi.c, main/state.c: Resolved termination issue when reading and comparing callsigns fro Coop savestates; Added scores sending after Coop savestate loading as unrestored players will send them when loading new level
|
||||
|
||||
20110418
|
||||
--------
|
||||
arch/sdl/digi_mixer_music.c, arch/sdl/jukebox.c, main/config.c, main/menu.c, main/songs.c, main/songs.h, main/titles.c: Fix broken m3u playlist support (in jukebox_play() path resolving); point to default descent.m3u playlist for Mac OS X (will be included in bundle); better error reporting in mix_play_file(); only make relative Jukebox path in the menu absolute after browsing it - relative paths are more flexible; allow select_file_recursive() to figure out PhysicsFS relative paths passed to it; stop the music if Jukebox is chosen and unavailable (used to just keep playing the last song)
|
||||
|
||||
20110416
|
||||
--------
|
||||
main/gamecntl.c, main/gauges.c: Due to controls rewrite was not possible anymore to send multiplayer messages while being dead - added specific exception to allow this; Rewrote show_HUD_names to only show names, indicators or typing string for enemy players when they are not cloaked; Small fix for position of Afterburner gauge in CM_FULL_SCREEN
|
||||
misc/hmp.c: Check for hmp before pausing/resuming it
|
||||
main/laser.c: Initialize variables in create_omega_blobs() and give omega_cleanup() a return value to see if we should continue rendering to fix potential crashes
|
||||
|
||||
20110414
|
||||
--------
|
||||
main/kmatrix.c: Fixing km struct being used after it's being freed by closing the window in EVENT_WINDOW_DRAW
|
||||
main/wall.c: Took out hack to force close doors as not needed anymore and does not take into account linked walls
|
||||
|
||||
20110413
|
||||
--------
|
||||
|
|
|
@ -5143,6 +5143,7 @@ void multi_restore_game(ubyte slot, uint id)
|
|||
}
|
||||
|
||||
pnum = state_restore_all_sub( filename, 0 );
|
||||
multi_send_score(); // send my restored scores. I sent 0 when I loaded the level anyways...
|
||||
}
|
||||
|
||||
void multi_do_msgsend_state(char *buf)
|
||||
|
|
31
main/state.c
31
main/state.c
|
@ -593,7 +593,7 @@ int state_get_savegame_filename(char * fname, char * dsc, char * caption, int bl
|
|||
char filename[NUM_SAVES][PATH_MAX];
|
||||
char desc[NUM_SAVES][DESC_LENGTH + 16];
|
||||
grs_bitmap *sc_bmp[NUM_SAVES];
|
||||
char id[5], dummy_callsign[CALLSIGN_LEN];
|
||||
char id[5], dummy_callsign[CALLSIGN_LEN+1];
|
||||
int valid;
|
||||
|
||||
nsaves=0;
|
||||
|
@ -613,7 +613,7 @@ int state_get_savegame_filename(char * fname, char * dsc, char * caption, int bl
|
|||
if (Game_mode & GM_MULTI_COOP)
|
||||
{
|
||||
dummy_state_game_id = PHYSFSX_readSXE32(fp, 0);
|
||||
PHYSFS_read(fp, &dummy_callsign, sizeof(char)*CALLSIGN_LEN, 1);
|
||||
PHYSFS_read(fp, &dummy_callsign, sizeof(char)*CALLSIGN_LEN+1, 1);
|
||||
}
|
||||
if ((version >= STATE_COMPATIBLE_VERSION) || (SWAPINT(version) >= STATE_COMPATIBLE_VERSION)) {
|
||||
// Read description
|
||||
|
@ -864,7 +864,7 @@ int state_save_all_sub(char *filename, char *desc)
|
|||
if (Game_mode & GM_MULTI_COOP)
|
||||
{
|
||||
PHYSFS_write(fp, &state_game_id, sizeof(uint), 1);
|
||||
PHYSFS_write(fp, &Players[Player_num].callsign, sizeof(char)*CALLSIGN_LEN, 1);
|
||||
PHYSFS_write(fp, &Players[Player_num].callsign, sizeof(char)*CALLSIGN_LEN+1, 1);
|
||||
}
|
||||
|
||||
//Save description
|
||||
|
@ -1097,12 +1097,7 @@ int state_save_all_sub(char *filename, char *desc)
|
|||
PHYSFS_write(fp, &Netgame.numplayers, sizeof(ubyte), 1);
|
||||
PHYSFS_write(fp, &Netgame.max_numplayers, sizeof(ubyte), 1);
|
||||
PHYSFS_write(fp, &Netgame.numconnected, sizeof(ubyte), 1);
|
||||
for (i = 0; i < MAX_PLAYERS; i++)
|
||||
PHYSFS_write(fp, &Netgame.killed[i], sizeof(short), 1);
|
||||
for (i = 0; i < MAX_PLAYERS; i++)
|
||||
PHYSFS_write(fp, &Netgame.player_score[i], sizeof(int), 1);
|
||||
for (i = 0; i < MAX_PLAYERS; i++)
|
||||
PHYSFS_write(fp, &Netgame.player_flags[i], sizeof(ubyte), 1);
|
||||
PHYSFS_write(fp, &Netgame.level_time, sizeof(int), 1);
|
||||
}
|
||||
|
||||
PHYSFS_close(fp);
|
||||
|
@ -1253,9 +1248,9 @@ int state_restore_all_sub(char *filename, int secret_restore)
|
|||
// Read Coop state_game_id. Oh the redundancy... we have this one later on but Coop games want to read this before loading a state so for easy access we have this here
|
||||
if (Game_mode & GM_MULTI_COOP)
|
||||
{
|
||||
char saved_callsign[CALLSIGN_LEN];
|
||||
char saved_callsign[CALLSIGN_LEN+1];
|
||||
state_game_id = PHYSFSX_readSXE32(fp, swap);
|
||||
PHYSFS_read(fp, &saved_callsign, sizeof(char)*CALLSIGN_LEN, 1);
|
||||
PHYSFS_read(fp, &saved_callsign, sizeof(char)*CALLSIGN_LEN+1, 1);
|
||||
if (strcmp(saved_callsign, Players[Player_num].callsign)) // check the callsign of the palyer who saved this state. It MUST match. If we transferred this savegame from pilot A to pilot B, others won't be able to restore us. So bail out here if this is the case.
|
||||
{
|
||||
PHYSFS_close(fp);
|
||||
|
@ -1646,13 +1641,13 @@ int state_restore_all_sub(char *filename, int secret_restore)
|
|||
PHYSFS_read(fp, &Netgame.max_numplayers, sizeof(ubyte), 1);
|
||||
MaxNumNetPlayers = Netgame.max_numplayers;
|
||||
PHYSFS_read(fp, &Netgame.numconnected, sizeof(ubyte), 1);
|
||||
for (i = 0; i < MAX_PLAYERS; i++)
|
||||
Netgame.killed[coop_player_slot_remap[i]] = PHYSFSX_readSXE16(fp, swap);
|
||||
Netgame.level_time = PHYSFSX_readSXE32(fp, swap);
|
||||
for (i = 0; i < MAX_PLAYERS; i++)
|
||||
Netgame.player_score[coop_player_slot_remap[i]] = PHYSFSX_readSXE32(fp, swap);
|
||||
for (i = 0; i < MAX_PLAYERS; i++)
|
||||
PHYSFS_read(fp, &Netgame.player_flags[coop_player_slot_remap[i]], sizeof(ubyte), 1);
|
||||
{
|
||||
Netgame.killed[i] = Players[i].net_killed_total;
|
||||
Netgame.player_score[i] = Players[i].score;
|
||||
Netgame.player_flags[i] = Players[i].flags;
|
||||
}
|
||||
for (i = 0; i < MAX_PLAYERS; i++) // Disconnect connected players not available in this Savegame
|
||||
if (!coop_player_got[i] && Players[i].connected == CONNECT_PLAYING)
|
||||
multi_disconnect_player(i);
|
||||
|
@ -1674,7 +1669,7 @@ int state_get_game_id(char *filename)
|
|||
int version;
|
||||
PHYSFS_file *fp;
|
||||
int swap = 0; // if file is not endian native, have to swap all shorts and ints
|
||||
char id[5], saved_callsign[CALLSIGN_LEN];
|
||||
char id[5], saved_callsign[CALLSIGN_LEN+1];
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (GameArg.SysUsePlayersDir && strncmp(filename, "Players/", 8))
|
||||
|
@ -1710,7 +1705,7 @@ int state_get_game_id(char *filename)
|
|||
|
||||
// Read Coop state_game_id to validate the savegame we are about to load matches the others
|
||||
state_game_id = PHYSFSX_readSXE32(fp, swap);
|
||||
PHYSFS_read(fp, &saved_callsign, sizeof(char)*CALLSIGN_LEN, 1);
|
||||
PHYSFS_read(fp, &saved_callsign, sizeof(char)*CALLSIGN_LEN+1, 1);
|
||||
if (strcmp(saved_callsign, Players[Player_num].callsign)) // check the callsign of the palyer who saved this state. It MUST match. If we transferred this savegame from pilot A to pilot B, others won't be able to restore us. So bail out here if this is the case.
|
||||
return 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue