diff options
| author | Travis Howell | 2003-07-27 12:05:08 +0000 | 
|---|---|---|
| committer | Travis Howell | 2003-07-27 12:05:08 +0000 | 
| commit | b8ce60ea1872b760e9caecf40260c7ae3eeb8ae9 (patch) | |
| tree | 50f8ad513192105e8de35dcc3e838ef4d04b0e70 | |
| parent | f6984add8f67d53d1521021a2c336647f483f248 (diff) | |
| download | scummvm-rg350-b8ce60ea1872b760e9caecf40260c7ae3eeb8ae9.tar.gz scummvm-rg350-b8ce60ea1872b760e9caecf40260c7ae3eeb8ae9.tar.bz2 scummvm-rg350-b8ce60ea1872b760e9caecf40260c7ae3eeb8ae9.zip | |
Count amount of save files available so load/save dialog works correctly.
svn-id: r9196
| -rw-r--r-- | simon/items.cpp | 6 | ||||
| -rw-r--r-- | simon/simon.cpp | 17 | ||||
| -rw-r--r-- | simon/simon.h | 1 | 
3 files changed, 21 insertions, 3 deletions
| diff --git a/simon/items.cpp b/simon/items.cpp index 7191e45068..b7f5ea7f6a 100644 --- a/simon/items.cpp +++ b/simon/items.cpp @@ -1422,8 +1422,8 @@ start_over_2:;  		if (!_savedialog_flag)  			goto start_over_2;  		_saveload_row_curpos += 6; -//    if (_saveload_row_curpos >= _num_savegame_rows) -//      _saveload_row_curpos = _num_savegame_rows; +		if (_saveload_row_curpos >= _num_savegame_rows) +			_saveload_row_curpos = _num_savegame_rows;  		goto strange_jump;  	} @@ -1459,6 +1459,8 @@ start_over_3:;  		if (!_savedialog_flag)  			goto start_over_3;  		_saveload_row_curpos += 6; +		if (_saveload_row_curpos >= _num_savegame_rows) +			_saveload_row_curpos = _num_savegame_rows;  		goto strange_jump;  	} diff --git a/simon/simon.cpp b/simon/simon.cpp index d0ff610b00..7e10130e24 100644 --- a/simon/simon.cpp +++ b/simon/simon.cpp @@ -2513,6 +2513,21 @@ void SimonEngine::o_load_game() {  	save_or_load_dialog(true);  } +int SimonEngine::count_savegames() { +	File f; +	uint i = 1; + +	while (i < 256) { +		f.open(gen_savename(i), getSavePath()); +		if (f.isOpen() == false) +			break; + +		f.close(); +		i++; +	} +	return i; +} +  int SimonEngine::display_savegame_list(int curpos, bool load, char *dst) {  	int slot, last_slot;  	File in; @@ -2601,7 +2616,7 @@ void SimonEngine::save_or_load_dialog(bool load) {  	_copy_partial_mode = 1; -	num = _number_of_savegames; +	_number_of_savegames = num = count_savegames();  	if (!load)  		num++;  	num -= 6; diff --git a/simon/simon.h b/simon/simon.h index 7a95dc910f..3c73a9d521 100644 --- a/simon/simon.h +++ b/simon/simon.h @@ -790,6 +790,7 @@ protected:  	void o_unk_132_helper_2(FillOrCopyStruct *fcs, int x);  	void savegame_dialog(char *buf); +	int count_savegames();  	int display_savegame_list(int curpos, bool load, char *dst);  	void show_it(void *buf); | 
