Commit 8913ad81 authored by coppro's avatar coppro

Game settings loading is now deferred until the game is fully loading.

This allows auto replaces to be properly loaded from the game file.
parent b4f1bdef
......@@ -81,7 +81,11 @@ GameSettings::GameSettings()
{}
void GameSettings::initDefaults(const Game& game) {
if (initialized) return;
// Defer initialization until the game is fully loaded.
// This prevents data that needs to be initialized from
// being accessed from the new set window, but removes
// the need to load the entire file, which takes too long.
if (initialized || !game.isFullyLoaded()) return;
initialized = true;
// init auto_replaces, copy from game file
FOR_EACH_CONST(ar, game.auto_replaces) {
......
......@@ -81,7 +81,7 @@ AutoReplaceList::AutoReplaceList(Window* parent, int id, const Game& game)
items.push_back(ar->clone());
}
// Add columns
InsertColumn(0, _LABEL_(""), wxLIST_FORMAT_LEFT, 0); // dummy, prevent the image from taking up space
InsertColumn(0, _(""), wxLIST_FORMAT_LEFT, 0); // dummy, prevent the image from taking up space
InsertColumn(1, _LABEL_("auto match"), wxLIST_FORMAT_LEFT, 100);
InsertColumn(2, _LABEL_("auto replace"), wxLIST_FORMAT_LEFT, 200);
// grey for disabled items
......@@ -143,7 +143,7 @@ String AutoReplaceList::OnGetItemText (long pos, long col) const {
if (col == 0) return ar->match;
if (col == 1) return ar->match;
if (col == 2) return ar->replace;
throw InternalError(_("too mana columns"));
throw InternalError(_("too many columns"));
}
int AutoReplaceList::OnGetItemImage(long pos) const {
......
......@@ -231,6 +231,10 @@ class Packaged : public Package {
/** This is done to force people to fill in the dependencies */
void requireDependency(Packaged* package);
inline bool isFullyLoaded () const {
return fully_loaded;
}
protected:
/// filename of the data file, and extension of the package file
virtual String typeName() const = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment