From d39ca7de1022ed318960c8d1676955f17d883cb6 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Tue, 10 Jul 2012 14:36:18 -0300 Subject: [PATCH] Restore periodicalEvent function * and typo fixes --- README.md | 2 +- modules/corelib/globals.lua | 19 +++++++++++++++++++ src/framework/core/resourcemanager.cpp | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6840aa1b..b32cb871 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Beyond of it's flexibility with scripts, otclient comes with tons of other featu the creation of new client side stuff in otserv that was not possible before. These include, sound system, graphics effects with shaders, particle engines, modules/addons system, animated textures, styleable user interface, transparency, multi language, in game lua terminal, an OpenGL 1.1/2.0 ES engine that make possible to -run on mobile platforms like Androi/iPhon/iPad and much more. Otclient is also flexible enough to +run on mobile platforms like Android/iPhone/iPad and much more. Otclient is also flexible enough to create tibia tools like map editors just using scripts, because it wasn't designed to be just a client, instead otclient was designed to be a combination of a framework and tibia APIs. diff --git a/modules/corelib/globals.lua b/modules/corelib/globals.lua index 3cd0e128..9531e587 100644 --- a/modules/corelib/globals.lua +++ b/modules/corelib/globals.lua @@ -31,6 +31,25 @@ function cycleEvent(callback, front) return event end +function periodicalEvent(eventFunc, conditionFunc, delay, autoRepeatDelay) + delay = delay or 30 + autoRepeatDelay = autoRepeatDelay or delay + + local func + func = function() + if conditionFunc and not conditionFunc() then + func = nil + return + end + eventFunc() + scheduleEvent(func, delay) + end + + scheduleEvent(function() + func() + end, autoRepeatDelay) +end + function removeEvent(event) if event then event:cancel() diff --git a/src/framework/core/resourcemanager.cpp b/src/framework/core/resourcemanager.cpp index 8346cad9..ad508824 100644 --- a/src/framework/core/resourcemanager.cpp +++ b/src/framework/core/resourcemanager.cpp @@ -62,7 +62,7 @@ void ResourceManager::discoverWorkDir(const std::string& appName, const std::str } if(!found) - g_logger.fatal("Unable to find application work directory."); + g_logger.fatal(stdext::format("Unable to find %s, the application cannot be initialized.", existentFile)); } bool ResourceManager::setupWriteDir(const std::string& appWriteDirName)