Hi, first of all: I think this is a good idea. Second: I didn't dive into this deeply but if I am not completely mistaken, there is a misleading use of either the term "cache" or a wrong idea how its information is processed.
The cache is a file on disk. It is read in as a whole into a game_config object (I think, I am writing this without looking into the code). The config information for the current scenario is also held separate from the cache (don't ask me where exactly, must be somewhere in the play_controller class). If we state that the cache is replaced after every parsing (which happens right before the scenario starts if I understood you correct), then we don't need a cache for scenarios, we just need a store of the current scenario. The cache (game_config) would then just keep the general package information. Unit configs are also stored in the cache file on disk, read in and parsed. This can be extremely tedious, especially if you are in debug mode, got a whole lot of MP add-ons installed and are chasing a MP bug. Entering the lobby from the title screen can easily take more than 30s then. For quite some time I had the idea to do a similar thing to cached unit types. However, since you need them throughout the whole package I thought about this: - Unit Types are read in from the cache file (which is considerably fast) - They are not parsed right away (which takes 90+% of the time) - Every time a unit type is needed it gets created and stored. - Known unit types get created from the store (fast). - Unknown unit types are parsed out of the cache (still nice speed, since it is only one). Greetings Yogi _______________________________________________ Wesnoth-dev mailing list [email protected] https://mail.gna.org/listinfo/wesnoth-dev
