fix some issues
This commit is contained in:
parent
2030a4da29
commit
8638c980ec
1
TODO
1
TODO
|
@ -15,6 +15,7 @@ todo display otclient icon in window bar
|
||||||
remake otui styles states system
|
remake otui styles states system
|
||||||
padding
|
padding
|
||||||
break UILabel lines
|
break UILabel lines
|
||||||
|
find a way to add new widgets without focusing them
|
||||||
|
|
||||||
rename Game to g_game, etc
|
rename Game to g_game, etc
|
||||||
implement Console key binding
|
implement Console key binding
|
||||||
|
|
|
@ -61,6 +61,7 @@ function CharacterList.create(characters, premDays)
|
||||||
local accountStatusLabel = charactersWindow:getChildById('accountStatusLabel')
|
local accountStatusLabel = charactersWindow:getChildById('accountStatusLabel')
|
||||||
charactersWindow.onKeyPress = onCharactersWindowKeyPress
|
charactersWindow.onKeyPress = onCharactersWindowKeyPress
|
||||||
|
|
||||||
|
local focusLabel
|
||||||
for i,characterInfo in ipairs(characters) do
|
for i,characterInfo in ipairs(characters) do
|
||||||
local characterName = characterInfo[1]
|
local characterName = characterInfo[1]
|
||||||
local worldName = characterInfo[2]
|
local worldName = characterInfo[2]
|
||||||
|
@ -76,10 +77,12 @@ function CharacterList.create(characters, premDays)
|
||||||
label.worldPort = worldIp
|
label.worldPort = worldIp
|
||||||
|
|
||||||
if i == 1 or g_configs.get('lastUsedCharacter') == characterName then
|
if i == 1 or g_configs.get('lastUsedCharacter') == characterName then
|
||||||
characterList:focusChild(label, ActiveFocusReason)
|
focusLabel = label
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
characterList:focusChild(focusLabel, ActiveFocusReason)
|
||||||
|
|
||||||
if premDays > 0 then
|
if premDays > 0 then
|
||||||
accountStatusLabel:setText("Account Status:\nPremium Account (" .. premDays .. ' days left)')
|
accountStatusLabel:setText("Account Status:\nPremium Account (" .. premDays .. ' days left)')
|
||||||
end
|
end
|
||||||
|
|
|
@ -79,7 +79,7 @@ IF(WIN32)
|
||||||
ENDIF(NO_CONSOLE)
|
ENDIF(NO_CONSOLE)
|
||||||
ELSE(WIN32)
|
ELSE(WIN32)
|
||||||
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -rdynamic")
|
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)
|
SET(framework_SOURCES ${framework_SOURCES} ${CMAKE_CURRENT_LIST_DIR}/platform/x11window.cpp)
|
||||||
ENDIF(WIN32)
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
|
|
@ -34,21 +34,17 @@ void Logger::log(Fw::LogLevel level, std::string message)
|
||||||
{
|
{
|
||||||
const static std::string logPrefixes[] = { "", "", "WARNING: ", "ERROR: ", "FATAL ERROR: " };
|
const static std::string logPrefixes[] = { "", "", "WARNING: ", "ERROR: ", "FATAL ERROR: " };
|
||||||
|
|
||||||
if(!m_terminated) {
|
message.insert(0, logPrefixes[level]);
|
||||||
message.insert(0, logPrefixes[level]);
|
std::cout << message << std::endl;
|
||||||
std::cout << message << std::endl;
|
|
||||||
|
|
||||||
std::size_t now = std::time(NULL);
|
std::size_t now = std::time(NULL);
|
||||||
m_logMessages.push_back(LogMessage(level, message, now));
|
m_logMessages.push_back(LogMessage(level, message, now));
|
||||||
|
|
||||||
if(m_onLog)
|
if(m_onLog)
|
||||||
m_onLog(level, message, now);
|
m_onLog(level, message, now);
|
||||||
}
|
|
||||||
|
|
||||||
if(level == Fw::LogFatal) {
|
if(level == Fw::LogFatal)
|
||||||
m_terminated = true;
|
|
||||||
throw std::runtime_error(message);
|
throw std::runtime_error(message);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Logger::logFunc(Fw::LogLevel level, const std::string& message, std::string prettyFunction)
|
void Logger::logFunc(Fw::LogLevel level, const std::string& message, std::string prettyFunction)
|
||||||
|
|
|
@ -23,11 +23,7 @@
|
||||||
#ifndef LOGGER_H
|
#ifndef LOGGER_H
|
||||||
#define LOGGER_H
|
#define LOGGER_H
|
||||||
|
|
||||||
#include "../util/tools.h"
|
#include <framework/global.h>
|
||||||
#include "../const.h"
|
|
||||||
#include <vector>
|
|
||||||
#include <functional>
|
|
||||||
#include <list>
|
|
||||||
|
|
||||||
struct LogMessage {
|
struct LogMessage {
|
||||||
LogMessage(Fw::LogLevel level, const std::string& message, std::size_t when) : level(level), message(message), when(when) { }
|
LogMessage(Fw::LogLevel level, const std::string& message, std::size_t when) : level(level), message(message), when(when) { }
|
||||||
|
|
|
@ -33,10 +33,7 @@ public:
|
||||||
|
|
||||||
bool setupWriteDir(const std::string& appWriteDirName);
|
bool setupWriteDir(const std::string& appWriteDirName);
|
||||||
|
|
||||||
/// Add an package or directory to the search path
|
|
||||||
bool addToSearchPath(const std::string& path, bool insertInFront = true);
|
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);
|
void searchAndAddPackages(const std::string& packagesDir, const std::string& packagesExt, bool append);
|
||||||
|
|
||||||
bool fileExists(const std::string& fileName);
|
bool fileExists(const std::string& fileName);
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include "otclient.h"
|
#include "otclient.h"
|
||||||
#include <framework/core/modulemanager.h>
|
#include <framework/core/modulemanager.h>
|
||||||
|
#include "core/game.h"
|
||||||
|
|
||||||
OTClient::OTClient() : Application(Otc::AppCompactName)
|
OTClient::OTClient() : Application(Otc::AppCompactName)
|
||||||
{
|
{
|
||||||
|
@ -38,3 +39,10 @@ void OTClient::init(const std::vector<std::string>& args)
|
||||||
g_modules.ensureModuleLoaded("client");
|
g_modules.ensureModuleLoaded("client");
|
||||||
g_modules.autoLoadModules(1000);
|
g_modules.autoLoadModules(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OTClient::close()
|
||||||
|
{
|
||||||
|
if(g_game.isOnline())
|
||||||
|
g_game.logout(true);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ class OTClient : public Application
|
||||||
public:
|
public:
|
||||||
OTClient();
|
OTClient();
|
||||||
void init(const std::vector<std::string>& args);
|
void init(const std::vector<std::string>& args);
|
||||||
|
void close();
|
||||||
void registerLuaFunctions();
|
void registerLuaFunctions();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue