Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Hello guys,
- I investigated "save_index" and confused by several things. General questions:
- 1) Which the reason create save_index file?
- If I right understood, only two purposes:
- a) decrease time of open "Load" dialog
- b) decrease time of render clicked save - show preview, game
- description, company name, etc.
- Perfomance reason, other words. Please approve/disapprove my understanding.
- 2) Unfortunatelly, right now "save_index" does not used by anywhere in game.
- I see just single call of save_index: write_save_index() (I skipped
- definition of class and definition of methods):
- src/savegame.hpp: /** Update the save_index */
- src/dialogs.cpp: config& cfg = savegame::save_index::save_summary(i->name);
- src/dialogs.cpp: savegame::save_index::write_save_index();
- You can check this by "find ./src -exec grep save_index". From this
- point of view, right now save_index nobody used.
- I also checked it by stacktraces *(see end of letter)
- In typical game usage nowhere is used :(
- 3) I supposed - save_index used before, but right now code with usage
- removed. I investigated revision history by git bisect and can't
- confirm this -
- commit fd497d4601f40acb0bc16c5c2ec3353767b94e92
- Author: Sirp <Sirp@75b3775d-3801-0410-9e12-e2e43121521d>
- Date: Thu Jun 10 00:35:45 2004 +0000
- added new 'load' dialog. changed behavior of pressing 'space' to
- end a unit's turn
- git-svn-id: svn+ssh://svn.gna.org/svn/wesnoth/trunk@2265
- 75b3775d-3801-0410-9e12-e2e43121521d
- 4) Current code directly read the dir with saves and parse every file
- separatelly. You can see this in src/gui/dialogs/game_load.cpp:
- tgame_load::display_savegame
- So, I want to change this situation, and full support of the
- "save_index" in soure code.
- I need this at least for:
- http://forums.wesnoth.org/viewtopic.php?f=10&t=36034&p=519985#p519985
- - for group the saves by game I should parse all saves.
- This is required a lot of time.
- Suppose we avoid directly read the directory, and use "save_index"
- instead of direct read.
- Which problem we will meet?
- 1) SHORT: missed save_index
- PROBLEM: User doesn't have "save_index" file, but have saves (for
- example, he move saves from another folder). As result "save_index"
- will no loaded, and user didn't see any saves.
- SOLUTION: rebuild save_index by directly read saves files while game is starting
- 2) SHORT: save_index file too old
- PROBLEM: User add some new save files, not listed in save_index
- SOLUTION: as in (1) - rebuild save_index directly from saves files
- (probably read & parse just new files, not listed in save_index).
- 3) SHORT: user added save file while play to game and wants open it.
- PROBLEM: added saves will not listed in "open" dialog without game restart.
- SOLUTION (simple): on open "Load" dialog read the filename and
- modify_time from directory (this is right now happendessin tgame_load)
- and compare their with information from save_index.
- SOLUTION (hard): use inotify/similar things for get updates about new
- files. Unreasonably complex solution.
- So, right now I wants to do SOLUTION(3)(simple). I would like again
- repeat what I will change:
- 1) replay direct file read in tgame_load by information from save_index
- 2) implement function "update" for save_index - function list all
- files from save_directory, and update information in save_index file
- 3) call "update" function on every open of game load dialog.
- How this plan for you?
- Best regards, Oleg
- savegame::save_index::load
- savegame::save_index::save_summary
- dialogs::load_game_dialog
- savegame::loadgame::show_dialog
- savegame::loadgame::load_game
- game_controller::load_game
- do_gameloop
- main
- savegame::save_index::load
- savegame::save_index::write_save_index
- dialogs::load_game_dialog
- savegame::loadgame::show_dialog
- savegame::loadgame::load_game
- game_controller::load_game
- do_gameloop
- main
Advertisement
Add Comment
Please, Sign In to add comment