From 070511a39b941fd4648e46a2302e1670c3fef09e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 3 May 2013 21:36:25 +0300 Subject: add config versioning. --- src/client.cpp | 15 +++++++++++++++ src/client.h | 2 ++ src/defaults.cpp | 1 + 3 files changed, 18 insertions(+) (limited to 'src') diff --git a/src/client.cpp b/src/client.cpp index df8fa3c85..1199c1213 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -589,6 +589,7 @@ void Client::gameInit() runCounters = config.getBoolValue("packetcounters"); applyVSync(); graphicsManager.setVideoMode(); + checkConfigVersion(); getConfigDefaults2(config.getDefaultValues()); applyGrabMode(); applyGamma(); @@ -2929,3 +2930,17 @@ void Client::updateScreenKeyboard(int height A_UNUSED) { // logger->log("keyboard height: %d", height); } + +void Client::checkConfigVersion() +{ + const int version = config.getIntValue("cfgver"); + if (version < 1) + { + if (config.getIntValue("fontSize") == 11) + config.deleteKey("fontSize"); + if (config.getIntValue("npcfontSize") == 13) + config.deleteKey("npcfontSize"); + } + + config.setValue("cfgver", 1); +} diff --git a/src/client.h b/src/client.h index e5bf5183e..733bc21e8 100644 --- a/src/client.h +++ b/src/client.h @@ -366,6 +366,8 @@ private: void logVars(); + void checkConfigVersion(); + static Client *mInstance; static void bindTextDomain(const char *const name, const char *const path); diff --git a/src/defaults.cpp b/src/defaults.cpp index 045b007f0..481960606 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -316,6 +316,7 @@ DefaultsData* getConfigDefaults() AddDEF("moveNames", false); AddDEF("uselonglivesprites", false); AddDEF("screenDensity", 0); + AddDEF("cfgver", 0); return configData; } -- cgit v1.2.3-60-g2f50