summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/client.cpp b/src/client.cpp
index d584d168..20d85ede 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -450,8 +450,13 @@ Client::Client(const Options &options):
// Initialize frame limiting
SDL_initFramerate(&mFpsManager);
- config.addListener("fpslimit", this);
- optionChanged("fpslimit");
+
+ listen(CHANNEL_CONFIG);
+
+ //TODO: fix having to fake a option changed event
+ Mana::Event fakeevent(EVENT_CONFIGOPTIONCHANGED);
+ fakeevent.setString("option", "fpslimit");
+ event(CHANNEL_CONFIG, fakeevent);
// Initialize PlayerInfo
PlayerInfo::init();
@@ -1022,12 +1027,18 @@ int Client::exec()
return 0;
}
-void Client::optionChanged(const std::string &name)
+void Client::event(Channels channel, const Mana::Event &event)
{
- const int fpsLimit = config.getIntValue("fpslimit");
- mLimitFps = fpsLimit > 0;
- if (mLimitFps)
- SDL_setFramerate(&mFpsManager, fpsLimit);
+ if (channel == CHANNEL_CONFIG &&
+ event.getName() == EVENT_CONFIGOPTIONCHANGED &&
+ event.getString("option") == "fpslimit")
+ {
+ const int fpsLimit = config.getIntValue("fpslimit");
+ mLimitFps = fpsLimit > 0;
+ if (mLimitFps)
+ SDL_setFramerate(&mFpsManager, fpsLimit);
+ }
+
}
void Client::action(const gcn::ActionEvent &event)