fix some issues

This commit is contained in:
Eduardo Bart 2011-12-09 13:01:04 -02:00
parent 2030a4da29
commit 8638c980ec
8 changed files with 23 additions and 21 deletions

1
TODO
View File

@ -15,6 +15,7 @@ todo display otclient icon in window bar
remake otui styles states system
padding
break UILabel lines
find a way to add new widgets without focusing them
rename Game to g_game, etc
implement Console key binding

View File

@ -61,6 +61,7 @@ function CharacterList.create(characters, premDays)
local accountStatusLabel = charactersWindow:getChildById('accountStatusLabel')
charactersWindow.onKeyPress = onCharactersWindowKeyPress
local focusLabel
for i,characterInfo in ipairs(characters) do
local characterName = characterInfo[1]
local worldName = characterInfo[2]
@ -76,10 +77,12 @@ function CharacterList.create(characters, premDays)
label.worldPort = worldIp
if i == 1 or g_configs.get('lastUsedCharacter') == characterName then
characterList:focusChild(label, ActiveFocusReason)
focusLabel = label
end
end
characterList:focusChild(focusLabel, ActiveFocusReason)
if premDays > 0 then
accountStatusLabel:setText("Account Status:\nPremium Account (" .. premDays .. ' days left)')
end

View File

@ -79,7 +79,7 @@ IF(WIN32)
ENDIF(NO_CONSOLE)
ELSE(WIN32)
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -rdynamic")
SET(ADDITIONAL_LIBRARIES pthread X11)
SET(ADDITIONAL_LIBRARIES pthread X11 dl)
SET(framework_SOURCES ${framework_SOURCES} ${CMAKE_CURRENT_LIST_DIR}/platform/x11window.cpp)
ENDIF(WIN32)

View File

@ -34,21 +34,17 @@ void Logger::log(Fw::LogLevel level, std::string message)
{
const static std::string logPrefixes[] = { "", "", "WARNING: ", "ERROR: ", "FATAL ERROR: " };
if(!m_terminated) {
message.insert(0, logPrefixes[level]);
std::cout << message << std::endl;
message.insert(0, logPrefixes[level]);
std::cout << message << std::endl;
std::size_t now = std::time(NULL);
m_logMessages.push_back(LogMessage(level, message, now));
std::size_t now = std::time(NULL);
m_logMessages.push_back(LogMessage(level, message, now));
if(m_onLog)
m_onLog(level, message, now);
}
if(m_onLog)
m_onLog(level, message, now);
if(level == Fw::LogFatal) {
m_terminated = true;
if(level == Fw::LogFatal)
throw std::runtime_error(message);
}
}
void Logger::logFunc(Fw::LogLevel level, const std::string& message, std::string prettyFunction)

View File

@ -23,11 +23,7 @@
#ifndef LOGGER_H
#define LOGGER_H
#include "../util/tools.h"
#include "../const.h"
#include <vector>
#include <functional>
#include <list>
#include <framework/global.h>
struct LogMessage {
LogMessage(Fw::LogLevel level, const std::string& message, std::size_t when) : level(level), message(message), when(when) { }

View File

@ -33,10 +33,7 @@ public:
bool setupWriteDir(const std::string& appWriteDirName);
/// Add an package or directory to the search path
bool addToSearchPath(const std::string& path, bool insertInFront = true);
/// Search and packages from a directory to the search path
void searchAndAddPackages(const std::string& packagesDir, const std::string& packagesExt, bool append);
bool fileExists(const std::string& fileName);

View File

@ -22,6 +22,7 @@
#include "otclient.h"
#include <framework/core/modulemanager.h>
#include "core/game.h"
OTClient::OTClient() : Application(Otc::AppCompactName)
{
@ -38,3 +39,10 @@ void OTClient::init(const std::vector<std::string>& args)
g_modules.ensureModuleLoaded("client");
g_modules.autoLoadModules(1000);
}
void OTClient::close()
{
if(g_game.isOnline())
g_game.logout(true);
exit();
}

View File

@ -31,6 +31,7 @@ class OTClient : public Application
public:
OTClient();
void init(const std::vector<std::string>& args);
void close();
void registerLuaFunctions();
};