From 08e646812a6881552141bed7cdb6f05f8b81dd0f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 9 Aug 2011 03:07:41 +0300 Subject: Fix copyright headers. Add missing copyrights and fix program name. --- src/net/beinghandler.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/net') diff --git a/src/net/beinghandler.h b/src/net/beinghandler.h index 89f972e6d..07279b148 100644 --- a/src/net/beinghandler.h +++ b/src/net/beinghandler.h @@ -1,8 +1,9 @@ /* - * The Mana World + * The ManaPlus Client * Copyright (C) 2004 The Mana World Development Team + * Copyright (C) 2011 ManaPlus developers * - * This file is part of The Mana World. + * This file is part of The ManaPlus Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by -- cgit v1.2.3-70-g09d2 From 69c4bf1494b19ca3b3333effff83086b0f0b87fd Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 11 Aug 2011 03:43:22 +0300 Subject: Remove some unused code. --- src/net/ea/inventoryhandler.cpp | 6 +++--- src/resources/itemdb.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/net') diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index acd674d12..2e52b85ff 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -275,7 +275,7 @@ void InventoryHandler::processPlayerStorageEquip(Net::MessageIn &msg) void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg) { int index, amount, itemId, equipType, refine; - int cards[4], itemType; +// int cards[4], itemType; unsigned char identified; int floorId; @@ -296,9 +296,9 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg) msg.readInt8(); // attribute refine = msg.readInt8(); for (int i = 0; i < 4; i++) - cards[i] = msg.readInt16(); + msg.readInt16(); // cards[i] equipType = msg.readInt16(); - itemType = msg.readInt8(); + msg.readInt8(); // itemType const ItemInfo &itemInfo = ItemDB::get(itemId); diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index 2d14ba687..7919145bd 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -213,7 +213,7 @@ void ItemDB::load() std::string attackAction = XML::getProperty(node, "attack-action", ""); std::string drawBefore = XML::getProperty(node, "drawBefore", ""); std::string drawAfter = XML::getProperty(node, "drawAfter", ""); - std::string removeSprite = XML::getProperty(node, "removeSprite", ""); +// std::string removeSprite = XML::getProperty(node, "removeSprite", ""); std::string colors; if (serverVersion >= 1) colors = XML::getProperty(node, "colors", ""); -- cgit v1.2.3-70-g09d2 From 2d45a2ca5480ae0fdc03a807787f622444830d44 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 12 Aug 2011 03:47:28 +0300 Subject: Rename file names log and chatlog to correct logger and chatlogger. --- manaplus.cbp | 8 +- src/CMakeLists.txt | 8 +- src/Makefile.am | 8 +- src/actorsprite.cpp | 2 +- src/actorspritemanager.cpp | 2 +- src/animatedsprite.cpp | 2 +- src/being.cpp | 2 +- src/chatlog.cpp | 204 --------------------------- src/chatlog.h | 79 ----------- src/chatlogger.cpp | 204 +++++++++++++++++++++++++++ src/chatlogger.h | 79 +++++++++++ src/client.cpp | 2 +- src/commandhandler.cpp | 2 +- src/configuration.cpp | 2 +- src/effectmanager.cpp | 2 +- src/filefilter.txt | 2 + src/game.cpp | 2 +- src/graphics.cpp | 2 +- src/gui/changeemaildialog.cpp | 2 +- src/gui/changepassworddialog.cpp | 2 +- src/gui/charselectdialog.cpp | 2 +- src/gui/connectiondialog.cpp | 2 +- src/gui/didyouknowwindow.cpp | 2 +- src/gui/emotepopup.cpp | 2 +- src/gui/gui.cpp | 2 +- src/gui/helpwindow.cpp | 2 +- src/gui/minimap.cpp | 2 +- src/gui/outfitwindow.cpp | 2 +- src/gui/palette.h | 2 +- src/gui/popupmenu.cpp | 2 +- src/gui/register.cpp | 2 +- src/gui/sdlfont.cpp | 2 +- src/gui/serverdialog.cpp | 4 +- src/gui/setup_audio.cpp | 2 +- src/gui/setup_chat.cpp | 2 +- src/gui/setup_other.cpp | 2 +- src/gui/setup_perfomance.cpp | 2 +- src/gui/setup_players.cpp | 2 +- src/gui/setup_relations.cpp | 2 +- src/gui/setup_theme.cpp | 2 +- src/gui/setup_video.cpp | 2 +- src/gui/setupitem.cpp | 2 +- src/gui/skilldialog.cpp | 2 +- src/gui/socialwindow.cpp | 2 +- src/gui/specialswindow.cpp | 2 +- src/gui/theme.cpp | 2 +- src/gui/unregisterdialog.cpp | 2 +- src/gui/updatewindow.cpp | 2 +- src/gui/userpalette.cpp | 2 +- src/gui/widgets/battletab.cpp | 4 +- src/gui/widgets/browserbox.cpp | 2 +- src/gui/widgets/button.cpp | 2 +- src/gui/widgets/chattab.cpp | 4 +- src/gui/widgets/desktop.cpp | 2 +- src/gui/widgets/emoteshortcutcontainer.cpp | 2 +- src/gui/widgets/inventoryfilter.cpp | 2 +- src/gui/widgets/itemcontainer.cpp | 2 +- src/gui/widgets/layout.cpp | 2 +- src/gui/widgets/popup.cpp | 2 +- src/gui/widgets/scrollarea.cpp | 2 +- src/gui/widgets/spellshortcutcontainer.cpp | 2 +- src/gui/widgets/tab.cpp | 2 +- src/gui/widgets/tabbedarea.cpp | 2 +- src/gui/widgets/textfield.cpp | 2 +- src/gui/widgets/tradetab.cpp | 4 +- src/gui/widgets/whispertab.cpp | 4 +- src/gui/widgets/window.cpp | 2 +- src/inventory.cpp | 2 +- src/joystick.cpp | 2 +- src/keyboardconfig.cpp | 2 +- src/localplayer.cpp | 2 +- src/log.cpp | 217 ----------------------------- src/log.h | 110 --------------- src/logger.cpp | 217 +++++++++++++++++++++++++++++ src/logger.h | 110 +++++++++++++++ src/main.cpp | 2 +- src/map.cpp | 2 +- src/mumblemanager.cpp | 2 +- src/net/download.cpp | 2 +- src/net/ea/beinghandler.cpp | 2 +- src/net/ea/charserverhandler.cpp | 2 +- src/net/ea/chathandler.cpp | 2 +- src/net/ea/gamehandler.cpp | 2 +- src/net/ea/gui/guildtab.cpp | 2 +- src/net/ea/gui/partytab.cpp | 2 +- src/net/ea/guildhandler.cpp | 2 +- src/net/ea/inventoryhandler.cpp | 2 +- src/net/ea/inventoryhandler.h | 2 +- src/net/ea/loginhandler.cpp | 2 +- src/net/ea/partyhandler.cpp | 2 +- src/net/ea/playerhandler.cpp | 2 +- src/net/ea/specialhandler.cpp | 2 +- src/net/ea/tradehandler.cpp | 2 +- src/net/manaserv/attributes.cpp | 2 +- src/net/manaserv/beinghandler.cpp | 2 +- src/net/manaserv/charhandler.cpp | 2 +- src/net/manaserv/connection.cpp | 2 +- src/net/manaserv/effecthandler.cpp | 2 +- src/net/manaserv/guildhandler.cpp | 2 +- src/net/manaserv/inventoryhandler.cpp | 2 +- src/net/manaserv/itemhandler.cpp | 2 +- src/net/manaserv/loginhandler.cpp | 2 +- src/net/manaserv/network.cpp | 2 +- src/net/manaserv/partyhandler.cpp | 2 +- src/net/manaserv/playerhandler.cpp | 2 +- src/net/messagein.cpp | 2 +- src/net/messageout.cpp | 2 +- src/net/tmwa/adminhandler.cpp | 2 +- src/net/tmwa/beinghandler.cpp | 2 +- src/net/tmwa/charserverhandler.cpp | 2 +- src/net/tmwa/chathandler.cpp | 2 +- src/net/tmwa/gamehandler.cpp | 2 +- src/net/tmwa/generalhandler.cpp | 2 +- src/net/tmwa/gui/guildtab.cpp | 2 +- src/net/tmwa/gui/partytab.cpp | 2 +- src/net/tmwa/guildhandler.cpp | 2 +- src/net/tmwa/inventoryhandler.cpp | 2 +- src/net/tmwa/inventoryhandler.h | 2 +- src/net/tmwa/loginhandler.cpp | 2 +- src/net/tmwa/messagein.cpp | 2 +- src/net/tmwa/messageout.cpp | 2 +- src/net/tmwa/network.cpp | 2 +- src/net/tmwa/partyhandler.cpp | 2 +- src/net/tmwa/playerhandler.cpp | 2 +- src/net/tmwa/specialhandler.cpp | 2 +- src/net/tmwa/tradehandler.cpp | 2 +- src/opengl1graphics.cpp | 2 +- src/openglgraphics.cpp | 2 +- src/particle.cpp | 2 +- src/particleemitter.cpp | 2 +- src/playerinfo.cpp | 2 +- src/properties.h | 2 +- src/resources/animation.cpp | 2 +- src/resources/beinginfo.cpp | 2 +- src/resources/colordb.cpp | 2 +- src/resources/dye.cpp | 2 +- src/resources/emotedb.cpp | 2 +- src/resources/image.cpp | 2 +- src/resources/imageset.cpp | 2 +- src/resources/imagewriter.cpp | 2 +- src/resources/itemdb.cpp | 2 +- src/resources/mapdb.cpp | 2 +- src/resources/mapreader.cpp | 2 +- src/resources/monsterdb.cpp | 2 +- src/resources/music.cpp | 2 +- src/resources/npcdb.cpp | 2 +- src/resources/resource.cpp | 2 +- src/resources/resourcemanager.cpp | 2 +- src/resources/soundeffect.cpp | 2 +- src/resources/specialdb.cpp | 2 +- src/resources/spritedef.cpp | 2 +- src/resources/wallpaper.cpp | 2 +- src/simpleanimation.cpp | 2 +- src/sound.cpp | 2 +- src/spellmanager.cpp | 2 +- src/spellshortcut.h | 2 +- src/statuseffect.cpp | 2 +- src/units.cpp | 2 +- src/utils/mutex.h | 2 +- src/utils/xml.cpp | 2 +- 160 files changed, 777 insertions(+), 775 deletions(-) delete mode 100644 src/chatlog.cpp delete mode 100644 src/chatlog.h create mode 100644 src/chatlogger.cpp create mode 100644 src/chatlogger.h delete mode 100644 src/log.cpp delete mode 100644 src/log.h create mode 100644 src/logger.cpp create mode 100644 src/logger.h (limited to 'src/net') diff --git a/manaplus.cbp b/manaplus.cbp index e31f4fee9..020e65357 100644 --- a/manaplus.cbp +++ b/manaplus.cbp @@ -117,8 +117,8 @@ - - + + @@ -410,8 +410,8 @@ - - + + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9a9d09f97..a48c4f28a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -472,8 +472,8 @@ SET(SRCS being.h spellmanager.cpp spellmanager.h - chatlog.cpp - chatlog.h + chatlogger.cpp + chatlogger.h client.cpp client.h channel.cpp @@ -532,8 +532,8 @@ SET(SRCS listener.h localplayer.cpp localplayer.h - log.cpp - log.h + logger.cpp + logger.h main.cpp main.h map.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 76010cb73..c1287e06c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -479,8 +479,8 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ being.h \ spellmanager.cpp \ spellmanager.h \ - chatlog.cpp \ - chatlog.h \ + chatlogger.cpp \ + chatlogger.h \ client.cpp \ client.h \ channel.cpp \ @@ -539,8 +539,8 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ listener.h \ localplayer.cpp \ localplayer.h \ - log.cpp \ - log.h \ + logger.cpp \ + logger.h \ main.cpp \ main.h \ map.cpp\ diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp index 5f71c6bbb..848e84e0f 100644 --- a/src/actorsprite.cpp +++ b/src/actorsprite.cpp @@ -26,7 +26,7 @@ #include "effectmanager.h" #include "imagesprite.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "simpleanimation.h" #include "sound.h" #include "statuseffect.h" diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp index 61534c340..e8244bc30 100644 --- a/src/actorspritemanager.cpp +++ b/src/actorspritemanager.cpp @@ -24,7 +24,7 @@ #include "configuration.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "main.h" #include "playerinfo.h" #include "playerrelations.h" diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp index 41aabf60c..7414c94bc 100644 --- a/src/animatedsprite.cpp +++ b/src/animatedsprite.cpp @@ -23,7 +23,7 @@ #include "animatedsprite.h" #include "graphics.h" -#include "log.h" +#include "logger.h" #include "resources/action.h" #include "resources/animation.h" diff --git a/src/being.cpp b/src/being.cpp index b6f06a75a..7c2a6bf40 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -31,7 +31,7 @@ #include "guild.h" #include "item.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "map.h" #include "particle.h" #include "party.h" diff --git a/src/chatlog.cpp b/src/chatlog.cpp deleted file mode 100644 index 99fe317c6..000000000 --- a/src/chatlog.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2009-2010 Andrei Karas - * Copyright (C) 2011 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "chatlog.h" - -#include -#include -#include - -#include -#include -#include - -#ifdef WIN32 -#include -#elif defined __APPLE__ -#include -#endif - -#include "log.h" -#include "configuration.h" - -#include "utils/stringutils.h" - -#include "debug.h" - -ChatLogger::ChatLogger() -{ -} - -ChatLogger::~ChatLogger() -{ - if (mLogFile.is_open()) - mLogFile.close(); -} - -void ChatLogger::setLogFile(const std::string &logFilename) -{ - if (mLogFile.is_open()) - mLogFile.close(); - - mLogFile.open(logFilename.c_str(), std::ios_base::app); - - if (!mLogFile.is_open()) - { - std::cout << "Warning: error while opening " << logFilename << - " for writing.\n"; - } -} - -void ChatLogger::setLogDir(const std::string &logDir) -{ - mLogDir = logDir; - - if (mLogFile.is_open()) - mLogFile.close(); - - DIR *dir = opendir(mLogDir.c_str()); - if (!dir) - makeDir(mLogDir); - else - closedir(dir); -} - -void ChatLogger::log(std::string str) -{ - std::string dateStr = getDateString(); - if (!mLogFile.is_open() || dateStr != mLogDate) - { - mLogDate = dateStr; - setLogFile(strprintf("%s/%s/#General_%s.log", mLogDir.c_str(), - mServerName.c_str(), dateStr.c_str())); - } - - str = removeColors(str); - writeTo(mLogFile, str); -} - -void ChatLogger::log(std::string name, std::string str) -{ - std::ofstream logFile; - logFile.open(strprintf("%s/%s/%s_%s.log", mLogDir.c_str(), - mServerName.c_str(), secureName(name).c_str(), - getDateString().c_str()).c_str(), std::ios_base::app); - - if (!logFile.is_open()) - return; - - str = removeColors(str); - writeTo(logFile, str); - - if (logFile.is_open()) - logFile.close(); -} - -std::string ChatLogger::getDateString() const -{ - std::string date; - - time_t rawtime; - struct tm *timeinfo; - char buffer [81]; - - time (&rawtime); - timeinfo = localtime(&rawtime); - - strftime(buffer, 79, "%y-%m-%d", timeinfo); - date = buffer; - return date; -} - -std::string ChatLogger::secureName(std::string &name) const -{ - for (unsigned int f = 0; f < name.length(); f ++) - { - if (name[f] < '0' && name[f] > '9' && name[f] < 'a' && name[f] > 'z' - && name[f] < 'A' && name[f] > 'Z' - && name[f] != '-' && name[f] != '+' && name[f] != '=' - && name[f] != '.' && name[f] != ',' && name[f] != ')' - && name[f] != '(' && name[f] != '[' && name[f] != ']') - { - name[f] = '_'; - } - } - return name; -} - -void ChatLogger::writeTo(std::ofstream &file, const std::string &str) const -{ - file << str << std::endl; -} - -void ChatLogger::setServerName(const std::string &serverName) -{ - mServerName = serverName; - if (mServerName == "") - mServerName = config.getStringValue("MostUsedServerName0"); - - if (mLogFile.is_open()) - mLogFile.close(); - - secureName(mServerName); - if (mLogDir != "") - { - DIR *dir = opendir((mLogDir + "/" + mServerName).c_str()); - if (!dir) - makeDir(mLogDir + "/" + mServerName); - else - closedir(dir); - } -} - -void ChatLogger::makeDir(const std::string &dir) -{ -#ifdef WIN32 - mkdir(dir.c_str()); -#else - mkdir(dir.c_str(), 0750); -#endif -} - -void ChatLogger::loadLast(std::string name, std::list &list, - unsigned n) -{ - std::ifstream logFile; - - logFile.open(strprintf("%s/%s/%s_%s.log", mLogDir.c_str(), - mServerName.c_str(), secureName(name).c_str(), - getDateString().c_str()).c_str(), std::ios::in); - - if (!logFile.is_open()) - return; - - char line[710]; - while (logFile.getline(line, 700)) - { - list.push_back(line); - if (list.size() > n) - list.pop_front(); - } - - if (logFile.is_open()) - logFile.close(); -} diff --git a/src/chatlog.h b/src/chatlog.h deleted file mode 100644 index 2e9545b04..000000000 --- a/src/chatlog.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011 The ManaPlus Developers - * Copyright (C) 2009-2010 Andrei Karas - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef M_CHATLOG_H -#define M_CHATLOG_H - -#include -#include - -class ChatLogger -{ - public: - /** - * Constructor. - */ - ChatLogger(); - - /** - * Destructor, closes log file. - */ - ~ChatLogger(); - - void setLogDir(const std::string &logDir); - - /** - * Enters a message in the log. The message will be timestamped. - */ - void log(std::string str); - - void log(std::string name, std::string str); - - void loadLast(std::string name, std::list &list, - unsigned n); - - std::string getDateString() const; - - std::string secureName(std::string &str) const; - - void setServerName(const std::string &serverName); - - private: - /** - * Sets the file to log to and opens it - */ - void setLogFile(const std::string &logFilename); - - void writeTo(std::ofstream &file, const std::string &str) const; - - void makeDir(const std::string &dir); - - std::ofstream mLogFile; - std::string mLogDir; - std::string mServerName; - std::string mLogDate; -}; - -extern ChatLogger *chatLogger; - -#endif diff --git a/src/chatlogger.cpp b/src/chatlogger.cpp new file mode 100644 index 000000000..067265138 --- /dev/null +++ b/src/chatlogger.cpp @@ -0,0 +1,204 @@ +/* + * The ManaPlus Client + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2009-2010 Andrei Karas + * Copyright (C) 2011 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "chatlogger.h" + +#include +#include +#include + +#include +#include +#include + +#ifdef WIN32 +#include +#elif defined __APPLE__ +#include +#endif + +#include "logger.h" +#include "configuration.h" + +#include "utils/stringutils.h" + +#include "debug.h" + +ChatLogger::ChatLogger() +{ +} + +ChatLogger::~ChatLogger() +{ + if (mLogFile.is_open()) + mLogFile.close(); +} + +void ChatLogger::setLogFile(const std::string &logFilename) +{ + if (mLogFile.is_open()) + mLogFile.close(); + + mLogFile.open(logFilename.c_str(), std::ios_base::app); + + if (!mLogFile.is_open()) + { + std::cout << "Warning: error while opening " << logFilename << + " for writing.\n"; + } +} + +void ChatLogger::setLogDir(const std::string &logDir) +{ + mLogDir = logDir; + + if (mLogFile.is_open()) + mLogFile.close(); + + DIR *dir = opendir(mLogDir.c_str()); + if (!dir) + makeDir(mLogDir); + else + closedir(dir); +} + +void ChatLogger::log(std::string str) +{ + std::string dateStr = getDateString(); + if (!mLogFile.is_open() || dateStr != mLogDate) + { + mLogDate = dateStr; + setLogFile(strprintf("%s/%s/#General_%s.log", mLogDir.c_str(), + mServerName.c_str(), dateStr.c_str())); + } + + str = removeColors(str); + writeTo(mLogFile, str); +} + +void ChatLogger::log(std::string name, std::string str) +{ + std::ofstream logFile; + logFile.open(strprintf("%s/%s/%s_%s.log", mLogDir.c_str(), + mServerName.c_str(), secureName(name).c_str(), + getDateString().c_str()).c_str(), std::ios_base::app); + + if (!logFile.is_open()) + return; + + str = removeColors(str); + writeTo(logFile, str); + + if (logFile.is_open()) + logFile.close(); +} + +std::string ChatLogger::getDateString() const +{ + std::string date; + + time_t rawtime; + struct tm *timeinfo; + char buffer [81]; + + time (&rawtime); + timeinfo = localtime(&rawtime); + + strftime(buffer, 79, "%y-%m-%d", timeinfo); + date = buffer; + return date; +} + +std::string ChatLogger::secureName(std::string &name) const +{ + for (unsigned int f = 0; f < name.length(); f ++) + { + if (name[f] < '0' && name[f] > '9' && name[f] < 'a' && name[f] > 'z' + && name[f] < 'A' && name[f] > 'Z' + && name[f] != '-' && name[f] != '+' && name[f] != '=' + && name[f] != '.' && name[f] != ',' && name[f] != ')' + && name[f] != '(' && name[f] != '[' && name[f] != ']') + { + name[f] = '_'; + } + } + return name; +} + +void ChatLogger::writeTo(std::ofstream &file, const std::string &str) const +{ + file << str << std::endl; +} + +void ChatLogger::setServerName(const std::string &serverName) +{ + mServerName = serverName; + if (mServerName == "") + mServerName = config.getStringValue("MostUsedServerName0"); + + if (mLogFile.is_open()) + mLogFile.close(); + + secureName(mServerName); + if (mLogDir != "") + { + DIR *dir = opendir((mLogDir + "/" + mServerName).c_str()); + if (!dir) + makeDir(mLogDir + "/" + mServerName); + else + closedir(dir); + } +} + +void ChatLogger::makeDir(const std::string &dir) +{ +#ifdef WIN32 + mkdir(dir.c_str()); +#else + mkdir(dir.c_str(), 0750); +#endif +} + +void ChatLogger::loadLast(std::string name, std::list &list, + unsigned n) +{ + std::ifstream logFile; + + logFile.open(strprintf("%s/%s/%s_%s.log", mLogDir.c_str(), + mServerName.c_str(), secureName(name).c_str(), + getDateString().c_str()).c_str(), std::ios::in); + + if (!logFile.is_open()) + return; + + char line[710]; + while (logFile.getline(line, 700)) + { + list.push_back(line); + if (list.size() > n) + list.pop_front(); + } + + if (logFile.is_open()) + logFile.close(); +} diff --git a/src/chatlogger.h b/src/chatlogger.h new file mode 100644 index 000000000..2e9545b04 --- /dev/null +++ b/src/chatlogger.h @@ -0,0 +1,79 @@ +/* + * The ManaPlus Client + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011 The ManaPlus Developers + * Copyright (C) 2009-2010 Andrei Karas + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef M_CHATLOG_H +#define M_CHATLOG_H + +#include +#include + +class ChatLogger +{ + public: + /** + * Constructor. + */ + ChatLogger(); + + /** + * Destructor, closes log file. + */ + ~ChatLogger(); + + void setLogDir(const std::string &logDir); + + /** + * Enters a message in the log. The message will be timestamped. + */ + void log(std::string str); + + void log(std::string name, std::string str); + + void loadLast(std::string name, std::list &list, + unsigned n); + + std::string getDateString() const; + + std::string secureName(std::string &str) const; + + void setServerName(const std::string &serverName); + + private: + /** + * Sets the file to log to and opens it + */ + void setLogFile(const std::string &logFilename); + + void writeTo(std::ofstream &file, const std::string &str) const; + + void makeDir(const std::string &dir); + + std::ofstream mLogFile; + std::string mLogDir; + std::string mServerName; + std::string mLogDate; +}; + +extern ChatLogger *chatLogger; + +#endif diff --git a/src/client.cpp b/src/client.cpp index 022bc07d5..e85c5b08f 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -23,7 +23,7 @@ #include "client.h" #include "main.h" -#include "chatlog.h" +#include "chatlogger.h" #include "configuration.h" #include "dropshortcut.h" #include "emoteshortcut.h" diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index dc9a4d1bf..f650ac8d1 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -27,7 +27,7 @@ #include "channel.h" #include "game.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "main.h" #include "gui/chatwindow.h" diff --git a/src/configuration.cpp b/src/configuration.cpp index 7d1f41fe5..2524d6b93 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -23,7 +23,7 @@ #include "configuration.h" #include "configlistener.h" -#include "log.h" +#include "logger.h" #include "utils/paths.h" #include "utils/stringutils.h" diff --git a/src/effectmanager.cpp b/src/effectmanager.cpp index bb54ced99..36e7aac16 100644 --- a/src/effectmanager.cpp +++ b/src/effectmanager.cpp @@ -21,7 +21,7 @@ #include "being.h" #include "effectmanager.h" -#include "log.h" +#include "logger.h" #include "particle.h" #include "sound.h" diff --git a/src/filefilter.txt b/src/filefilter.txt index b2b1e7d0c..0dde8e90c 100644 --- a/src/filefilter.txt +++ b/src/filefilter.txt @@ -1,5 +1,6 @@ ~ RULE_3_1_A_do_not_start_filename_with_underbar ~ RULE_3_2_CD_do_not_use_special_characters_in_filename +~ RULE_3_2_F_use_representitive_classname_for_cpp_filename ~ RULE_3_2_H_do_not_use_uppercase_for_c_filename ~ RULE_3_3_A_start_function_name_with_lowercase_unix ~ RULE_4_1_A_B_use_space_for_indentation @@ -23,3 +24,4 @@ ~ RULE_8_1_A_provide_file_info_comment ~ RULE_9_1_A_do_not_use_hardcorded_include_path ~ RULE_9_2_D_use_reentrant_function + diff --git a/src/game.cpp b/src/game.cpp index 4332c8e11..4967231b0 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -42,7 +42,7 @@ #include "joystick.h" #include "keyboardconfig.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "map.h" #include "particle.h" #include "playerrelations.h" diff --git a/src/graphics.cpp b/src/graphics.cpp index 6a6760c36..a86ac7fd0 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -25,7 +25,7 @@ #include "graphics.h" #include "graphicsvertexes.h" -#include "log.h" +#include "logger.h" #include "map.h" #include "resources/image.h" diff --git a/src/gui/changeemaildialog.cpp b/src/gui/changeemaildialog.cpp index d424fff91..c24624bc2 100644 --- a/src/gui/changeemaildialog.cpp +++ b/src/gui/changeemaildialog.cpp @@ -23,7 +23,7 @@ #include "gui/changeemaildialog.h" #include "client.h" -#include "log.h" +#include "logger.h" #include "gui/register.h" #include "gui/okdialog.h" diff --git a/src/gui/changepassworddialog.cpp b/src/gui/changepassworddialog.cpp index dc640841a..30012ae52 100644 --- a/src/gui/changepassworddialog.cpp +++ b/src/gui/changepassworddialog.cpp @@ -23,7 +23,7 @@ #include "changepassworddialog.h" #include "client.h" -#include "log.h" +#include "logger.h" #include "gui/register.h" #include "gui/okdialog.h" diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index 264df06e3..28c7a083c 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -26,7 +26,7 @@ #include "game.h" #include "localplayer.h" #include "units.h" -#include "log.h" +#include "logger.h" #include "gui/changeemaildialog.h" #include "gui/changepassworddialog.h" diff --git a/src/gui/connectiondialog.cpp b/src/gui/connectiondialog.cpp index 157398297..da98ea5ac 100644 --- a/src/gui/connectiondialog.cpp +++ b/src/gui/connectiondialog.cpp @@ -22,7 +22,7 @@ #include "connectiondialog.h" -#include "log.h" +#include "logger.h" #include "gui/widgets/button.h" #include "gui/widgets/label.h" diff --git a/src/gui/didyouknowwindow.cpp b/src/gui/didyouknowwindow.cpp index 03188907f..4d89bd924 100644 --- a/src/gui/didyouknowwindow.cpp +++ b/src/gui/didyouknowwindow.cpp @@ -22,7 +22,7 @@ #include "gui/didyouknowwindow.h" -#include "log.h" +#include "logger.h" #include "gui/gui.h" #include "gui/setup.h" diff --git a/src/gui/emotepopup.cpp b/src/gui/emotepopup.cpp index 3a754d0e3..348a97952 100644 --- a/src/gui/emotepopup.cpp +++ b/src/gui/emotepopup.cpp @@ -28,7 +28,7 @@ #include "emoteshortcut.h" #include "graphics.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "gui/theme.h" diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 0bea1d0d7..3e4ec764f 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -35,7 +35,7 @@ #include "configlistener.h" #include "configuration.h" #include "graphics.h" -#include "log.h" +#include "logger.h" #include "resources/image.h" #include "resources/imageset.h" diff --git a/src/gui/helpwindow.cpp b/src/gui/helpwindow.cpp index ae0a432ea..368049389 100644 --- a/src/gui/helpwindow.cpp +++ b/src/gui/helpwindow.cpp @@ -22,7 +22,7 @@ #include "gui/helpwindow.h" -#include "log.h" +#include "logger.h" #include "gui/gui.h" #include "gui/setup.h" diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 5022f9210..c735eec82 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -27,7 +27,7 @@ #include "configuration.h" #include "graphics.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "map.h" #include "gui/userpalette.h" diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp index 9dd41a643..09e75856f 100644 --- a/src/gui/outfitwindow.cpp +++ b/src/gui/outfitwindow.cpp @@ -28,7 +28,7 @@ #include "inventory.h" #include "item.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "playerinfo.h" #include "gui/chatwindow.h" diff --git a/src/gui/palette.h b/src/gui/palette.h index 9409bfc06..1cebe236f 100644 --- a/src/gui/palette.h +++ b/src/gui/palette.h @@ -24,7 +24,7 @@ #ifndef PALETTE_H #define PALETTE_H -#include "log.h" +#include "logger.h" #include "utils/stringutils.h" #include diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 14a326e41..86ddfda53 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -32,7 +32,7 @@ #include "item.h" #include "itemshortcut.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "map.h" #include "party.h" #include "playerinfo.h" diff --git a/src/gui/register.cpp b/src/gui/register.cpp index 80ddb7469..913c958f2 100644 --- a/src/gui/register.cpp +++ b/src/gui/register.cpp @@ -24,7 +24,7 @@ #include "client.h" #include "configuration.h" -#include "log.h" +#include "logger.h" #include "gui/logindialog.h" #include "gui/okdialog.h" diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp index a0f8699f8..8dd7f929d 100644 --- a/src/gui/sdlfont.cpp +++ b/src/gui/sdlfont.cpp @@ -25,7 +25,7 @@ #include "client.h" #include "graphics.h" -#include "log.h" +#include "logger.h" #include "main.h" #include "resources/image.h" diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 41b0076e1..37870a87f 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -22,10 +22,10 @@ #include "gui/serverdialog.h" -#include "chatlog.h" +#include "chatlogger.h" #include "client.h" #include "configuration.h" -#include "log.h" +#include "logger.h" #include "main.h" #include "gui/gui.h" diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp index 28e6d8cfa..1737e9004 100644 --- a/src/gui/setup_audio.cpp +++ b/src/gui/setup_audio.cpp @@ -23,7 +23,7 @@ #include "gui/setup_audio.h" #include "configuration.h" -#include "log.h" +#include "logger.h" #include "sound.h" #include "gui/okdialog.h" diff --git a/src/gui/setup_chat.cpp b/src/gui/setup_chat.cpp index 621f62810..7ce44a552 100644 --- a/src/gui/setup_chat.cpp +++ b/src/gui/setup_chat.cpp @@ -37,7 +37,7 @@ #include "configuration.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "utils/gettext.h" diff --git a/src/gui/setup_other.cpp b/src/gui/setup_other.cpp index 3675da4ca..3b603a8ee 100644 --- a/src/gui/setup_other.cpp +++ b/src/gui/setup_other.cpp @@ -29,7 +29,7 @@ #include "gui/widgets/scrollarea.h" #include "configuration.h" -#include "log.h" +#include "logger.h" #include "utils/gettext.h" diff --git a/src/gui/setup_perfomance.cpp b/src/gui/setup_perfomance.cpp index eaadc7c3a..583f2909a 100644 --- a/src/gui/setup_perfomance.cpp +++ b/src/gui/setup_perfomance.cpp @@ -37,7 +37,7 @@ #include "configuration.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "utils/gettext.h" diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp index 7490135cd..d2664adbd 100644 --- a/src/gui/setup_players.cpp +++ b/src/gui/setup_players.cpp @@ -37,7 +37,7 @@ #include "configuration.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "utils/gettext.h" diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp index 646d47550..93887b133 100644 --- a/src/gui/setup_relations.cpp +++ b/src/gui/setup_relations.cpp @@ -25,7 +25,7 @@ #include "actorspritemanager.h" #include "configuration.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "gui/editdialog.h" #include "gui/okdialog.h" diff --git a/src/gui/setup_theme.cpp b/src/gui/setup_theme.cpp index 42ed0205c..7a2c66595 100644 --- a/src/gui/setup_theme.cpp +++ b/src/gui/setup_theme.cpp @@ -37,7 +37,7 @@ #include "configuration.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "utils/gettext.h" diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 8979a81e1..03b485097 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -26,7 +26,7 @@ #include "game.h" #include "graphics.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "main.h" #include "particle.h" diff --git a/src/gui/setupitem.cpp b/src/gui/setupitem.cpp index 182501e72..defdb4005 100644 --- a/src/gui/setupitem.cpp +++ b/src/gui/setupitem.cpp @@ -22,7 +22,7 @@ #include "configuration.h" #include "main.h" -#include "log.h" +#include "logger.h" #include "gui/editdialog.h" diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index 5b47a5494..896f06cab 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -22,7 +22,7 @@ #include "gui/skilldialog.h" -#include "log.h" +#include "logger.h" #include "playerinfo.h" #include "configuration.h" diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index adcfe4d70..e3aa69b30 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -25,7 +25,7 @@ #include "guild.h" #include "keyboardconfig.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "map.h" #include "party.h" diff --git a/src/gui/specialswindow.cpp b/src/gui/specialswindow.cpp index 1c41752f3..a5d95c7ff 100644 --- a/src/gui/specialswindow.cpp +++ b/src/gui/specialswindow.cpp @@ -21,7 +21,7 @@ #include "gui/specialswindow.h" -#include "log.h" +#include "logger.h" #include "gui/setup.h" #include "gui/theme.h" diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index 92613a3b3..056eafc0f 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -26,7 +26,7 @@ #include "client.h" #include "configuration.h" -#include "log.h" +#include "logger.h" #include "resources/dye.h" #include "resources/image.h" diff --git a/src/gui/unregisterdialog.cpp b/src/gui/unregisterdialog.cpp index 8f845e746..568e0613e 100644 --- a/src/gui/unregisterdialog.cpp +++ b/src/gui/unregisterdialog.cpp @@ -23,7 +23,7 @@ #include "gui/unregisterdialog.h" #include "client.h" -#include "log.h" +#include "logger.h" #include "gui/okdialog.h" #include "gui/register.h" diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index eb5471e2a..895c99121 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -24,7 +24,7 @@ #include "client.h" #include "configuration.h" -#include "log.h" +#include "logger.h" #include "main.h" #include "gui/sdlinput.h" diff --git a/src/gui/userpalette.cpp b/src/gui/userpalette.cpp index 40dddc4f1..eac9559ef 100644 --- a/src/gui/userpalette.cpp +++ b/src/gui/userpalette.cpp @@ -25,7 +25,7 @@ #include "configuration.h" #include "client.h" -#include "log.h" +#include "logger.h" #include "gui/gui.h" diff --git a/src/gui/widgets/battletab.cpp b/src/gui/widgets/battletab.cpp index e72c78ee0..c5500e801 100644 --- a/src/gui/widgets/battletab.cpp +++ b/src/gui/widgets/battletab.cpp @@ -22,10 +22,10 @@ #include "gui/widgets/battletab.h" -#include "chatlog.h" +#include "chatlogger.h" #include "commandhandler.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "main.h" #include "gui/theme.h" diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 140a72770..7df70bd04 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -25,7 +25,7 @@ #include "client.h" #include "graphics.h" -#include "log.h" +#include "logger.h" #include "utils/stringutils.h" diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 0570630c3..2d9678a53 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -26,7 +26,7 @@ #include "configuration.h" #include "graphics.h" #include "graphicsvertexes.h" -#include "log.h" +#include "logger.h" #include "gui/palette.h" #include "gui/theme.h" diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index 42a39a20f..e27af8b25 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -23,11 +23,11 @@ #include "gui/widgets/chattab.h" #include "actorspritemanager.h" -#include "chatlog.h" +#include "chatlogger.h" #include "commandhandler.h" #include "configuration.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "sound.h" #include "gui/widgets/browserbox.h" diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index 3ade3b37f..cfb757638 100644 --- a/src/gui/widgets/desktop.cpp +++ b/src/gui/widgets/desktop.cpp @@ -22,7 +22,7 @@ #include "configuration.h" #include "graphics.h" -#include "log.h" +#include "logger.h" #include "main.h" #include "gui/palette.h" diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index bb5af4b1c..5bb972adc 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -29,7 +29,7 @@ #include "itemshortcut.h" #include "keyboardconfig.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "gui/palette.h" #include "gui/textpopup.h" diff --git a/src/gui/widgets/inventoryfilter.cpp b/src/gui/widgets/inventoryfilter.cpp index 563e37b8c..795f0d31e 100644 --- a/src/gui/widgets/inventoryfilter.cpp +++ b/src/gui/widgets/inventoryfilter.cpp @@ -23,7 +23,7 @@ #include "gui/widgets/horizontcontainer.h" #include "gui/widgets/radiobutton.h" -#include "log.h" +#include "logger.h" #include "debug.h" diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 7818432f8..b79f26226 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -27,7 +27,7 @@ #include "item.h" #include "itemshortcut.h" #include "dropshortcut.h" -#include "log.h" +#include "logger.h" #include "gui/chatwindow.h" #include "gui/itempopup.h" diff --git a/src/gui/widgets/layout.cpp b/src/gui/widgets/layout.cpp index 274c17d61..382d169dc 100644 --- a/src/gui/widgets/layout.cpp +++ b/src/gui/widgets/layout.cpp @@ -22,7 +22,7 @@ #include "gui/widgets/layout.h" -#include "log.h" +#include "logger.h" #include diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index ea51c146a..38088770b 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -26,7 +26,7 @@ #include "configuration.h" #include "graphics.h" #include "graphicsvertexes.h" -#include "log.h" +#include "logger.h" #include "gui/theme.h" #include "gui/viewport.h" diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index df39854da..08f0b5a70 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -26,7 +26,7 @@ #include "configuration.h" #include "graphics.h" #include "graphicsvertexes.h" -#include "log.h" +#include "logger.h" #include "gui/theme.h" diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 872ed16c7..8d5b563bb 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -40,7 +40,7 @@ #include "keyboardconfig.h" #include "localplayer.h" #include "spellmanager.h" -#include "log.h" +#include "logger.h" #include "resources/image.h" #include "textcommand.h" diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index 1b548a6a3..b7d6b4458 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -26,7 +26,7 @@ #include "configuration.h" #include "graphics.h" #include "graphicsvertexes.h" -#include "log.h" +#include "logger.h" #include "gui/palette.h" #include "gui/theme.h" diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index d3539a115..940dad12a 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -25,7 +25,7 @@ #include "gui/widgets/scrollarea.h" #include "gui/widgets/tab.h" -#include "log.h" +#include "logger.h" #include diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index d3108a77f..f80039650 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -25,7 +25,7 @@ #include "client.h" #include "configuration.h" #include "graphics.h" -#include "log.h" +#include "logger.h" #include "gui/palette.h" #include "gui/sdlinput.h" diff --git a/src/gui/widgets/tradetab.cpp b/src/gui/widgets/tradetab.cpp index 99a145d86..deec2aea6 100644 --- a/src/gui/widgets/tradetab.cpp +++ b/src/gui/widgets/tradetab.cpp @@ -22,10 +22,10 @@ #include "gui/widgets/tradetab.h" -#include "chatlog.h" +#include "chatlogger.h" #include "commandhandler.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "gui/theme.h" diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp index bee30b969..c99c4e0c5 100644 --- a/src/gui/widgets/whispertab.cpp +++ b/src/gui/widgets/whispertab.cpp @@ -22,10 +22,10 @@ #include "gui/widgets/whispertab.h" -#include "chatlog.h" +#include "chatlogger.h" #include "commandhandler.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "gui/theme.h" diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 14448ea86..9a7c689e6 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -25,7 +25,7 @@ #include "client.h" #include "configuration.h" #include "graphicsvertexes.h" -#include "log.h" +#include "logger.h" #include "gui/gui.h" #include "gui/palette.h" diff --git a/src/inventory.cpp b/src/inventory.cpp index 3ff40374a..acd35efdd 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -22,7 +22,7 @@ #include "inventory.h" #include "item.h" -#include "log.h" +#include "logger.h" #include "net/inventoryhandler.h" #include "net/net.h" diff --git a/src/joystick.cpp b/src/joystick.cpp index f1255c4c0..8f808a2d1 100644 --- a/src/joystick.cpp +++ b/src/joystick.cpp @@ -22,7 +22,7 @@ #include "configuration.h" #include "joystick.h" -#include "log.h" +#include "logger.h" #include diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp index 8ad38ab76..bf58c518a 100644 --- a/src/keyboardconfig.cpp +++ b/src/keyboardconfig.cpp @@ -20,7 +20,7 @@ #include "configuration.h" #include "keyboardconfig.h" -#include "log.h" +#include "logger.h" #include "gui/sdlinput.h" #include "gui/setup_keyboard.h" diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 0310bb8ad..a9e9d1f21 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -31,7 +31,7 @@ #include "guild.h" #include "item.h" #include "keyboardconfig.h" -#include "log.h" +#include "logger.h" #include "map.h" #include "party.h" #include "particle.h" diff --git a/src/log.cpp b/src/log.cpp deleted file mode 100644 index 9bcf1ea4f..000000000 --- a/src/log.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include -#include - -#include "log.h" - -#include "configuration.h" - -#include "gui/widgets/chattab.h" - -#ifdef WIN32 -#include -#elif defined __APPLE__ -#include -#elif __linux__ || __linux -#include -#endif - -#include - -#include "debug.h" - -Logger::Logger(): - mLogToStandardOut(true), - mChatWindow(NULL), - mDebugLog(false) -{ -} - -Logger::~Logger() -{ - if (mLogFile.is_open()) - { - mLogFile.close(); - } -} - -void Logger::setLogFile(const std::string &logFilename) -{ - if (mLogFile.is_open()) - mLogFile.close(); - - mLogFile.open(logFilename.c_str(), std::ios_base::trunc); - - if (!mLogFile.is_open()) - { - std::cout << "Warning: error while opening " << logFilename << - " for writing.\n"; - } -} - -void Logger::log(std::string str) -{ - log("%s", str.c_str()); -} - -void Logger::dlog(std::string str) -{ - if (!mDebugLog) - return; - - // Get the current system time - timeval tv; - gettimeofday(&tv, NULL); - - // Print the log entry - std::stringstream timeStr; - timeStr << "[" - << ((((tv.tv_sec / 60) / 60) % 24 < 10) ? "0" : "") - << static_cast(((tv.tv_sec / 60) / 60) % 24) - << ":" - << (((tv.tv_sec / 60) % 60 < 10) ? "0" : "") - << static_cast((tv.tv_sec / 60) % 60) - << ":" - << ((tv.tv_sec % 60 < 10) ? "0" : "") - << static_cast(tv.tv_sec % 60) - << "." - << (((tv.tv_usec / 10000) % 100) < 10 ? "0" : "") - << static_cast((tv.tv_usec / 10000) % 100) - << "] "; - - if (mLogFile.is_open()) - mLogFile << timeStr.str() << str << std::endl; - - if (mLogToStandardOut) - std::cout << timeStr.str() << str << std::endl; - - if (mChatWindow && debugChatTab) - debugChatTab->chatLog(str, BY_LOGGER); -} - -void Logger::log1(const char *buf) -{ - // Get the current system time - timeval tv; - gettimeofday(&tv, NULL); - - // Print the log entry - std::stringstream timeStr; - timeStr << "[" - << ((((tv.tv_sec / 60) / 60) % 24 < 10) ? "0" : "") - << static_cast(((tv.tv_sec / 60) / 60) % 24) - << ":" - << (((tv.tv_sec / 60) % 60 < 10) ? "0" : "") - << static_cast((tv.tv_sec / 60) % 60) - << ":" - << ((tv.tv_sec % 60 < 10) ? "0" : "") - << static_cast(tv.tv_sec % 60) - << "." - << (((tv.tv_usec / 10000) % 100) < 10 ? "0" : "") - << static_cast((tv.tv_usec / 10000) % 100) - << "] "; - - if (mLogFile.is_open()) - mLogFile << timeStr.str() << buf << std::endl; - - if (mLogToStandardOut) - std::cout << timeStr.str() << buf << std::endl; - - if (mChatWindow && debugChatTab) - debugChatTab->chatLog(buf, BY_LOGGER); -} - -void Logger::log(const char *log_text, ...) -{ - unsigned size = 1024; - char* buf = 0; - if (strlen(log_text) * 3> size) - size = static_cast(strlen(log_text) * 3); - - buf = new char[size + 1]; - va_list ap; - - // Use a temporary buffer to fill in the variables - va_start(ap, log_text); - vsnprintf(buf, size, log_text, ap); - buf[size] = 0; - va_end(ap); - - // Get the current system time - timeval tv; - gettimeofday(&tv, NULL); - - // Print the log entry - std::stringstream timeStr; - timeStr << "[" - << ((((tv.tv_sec / 60) / 60) % 24 < 10) ? "0" : "") - << static_cast(((tv.tv_sec / 60) / 60) % 24) - << ":" - << (((tv.tv_sec / 60) % 60 < 10) ? "0" : "") - << static_cast((tv.tv_sec / 60) % 60) - << ":" - << ((tv.tv_sec % 60 < 10) ? "0" : "") - << static_cast(tv.tv_sec % 60) - << "." - << (((tv.tv_usec / 10000) % 100) < 10 ? "0" : "") - << static_cast((tv.tv_usec / 10000) % 100) - << "] "; - - if (mLogFile.is_open()) - mLogFile << timeStr.str() << buf << std::endl; - - if (mLogToStandardOut) - std::cout << timeStr.str() << buf << std::endl; - - if (mChatWindow && debugChatTab) - debugChatTab->chatLog(buf, BY_LOGGER); - - // Delete temporary buffer - delete[] buf; -} - -void Logger::error(const std::string &error_text) -{ - log("Error: %s", error_text.c_str()); -#ifdef WIN32 - MessageBox(NULL, error_text.c_str(), "Error", MB_ICONERROR | MB_OK); -#elif defined __APPLE__ -// Str255 msg; -// CFStringRef error; -// error = CFStringCreateWithCString(NULL, -// error_text.c_str(), -// kCFStringEncodingMacRoman); -// CFStringGetPascalString(error, msg, 255, kCFStringEncodingMacRoman); -// StandardAlert(kAlertStopAlert, -// (const unsigned char*)"\pError", -// (ConstStr255Param) msg, NULL, NULL); -#elif defined __linux__ || __linux - std::cerr << "Error: " << error_text << std::endl; - std::string msg = "xmessage \"" + error_text + "\""; - system(msg.c_str()); -#else - std::cerr << "Error: " << error_text << std::endl; -#endif - exit(1); -} diff --git a/src/log.h b/src/log.h deleted file mode 100644 index b8517f696..000000000 --- a/src/log.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef M_LOG_H -#define M_LOG_H - -#include "main.h" -#include - -class ChatWindow; - -#ifdef ENABLEDEBUGLOG -#define DEBUGLOG(msg) logger->dlog(msg) -#else -#define DEBUGLOG(msg) {} -#endif - -/** - * The Log Class : Useful to write debug or info messages - */ -class Logger -{ - public: - /** - * Constructor. - */ - Logger(); - - /** - * Destructor, closes log file. - */ - ~Logger(); - - /** - * Sets the file to log to and opens it - */ - void setLogFile(const std::string &logFilename); - - /** - * Sets whether the log should be written to standard output. - */ - void setLogToStandardOut(bool value) { mLogToStandardOut = value; } - - /** - * Enables logging to chat window - */ - void setChatWindow(ChatWindow *window) { mChatWindow = window; } - - /** - * Enters a message in the log. The message will be timestamped. - */ - void log(const char *log_text, ...) -#ifdef __GNUC__ - __attribute__((__format__(__printf__, 2, 3))) -#endif - ; - - /** - * Enters a message in the log. The message will be timestamped. - */ - void log1(const char *log_text); - - /** - * Enters a message in the log. The message will be timestamped. - */ - void log(std::string str); - - /** - * Enters debug message in the log. The message will be timestamped. - */ - void dlog(std::string str); - - void setDebugLog(bool n) - { mDebugLog = n; } - - /** - * Log an error and quit. The error will pop-up on Windows and Mac, and - * will be printed to standard error everywhere else. - */ - void error(const std::string &error_text) __attribute__ ((noreturn)); - - private: - std::ofstream mLogFile; - bool mLogToStandardOut; - ChatWindow *mChatWindow; - bool mDebugLog; -}; - -extern Logger *logger; - -#endif diff --git a/src/logger.cpp b/src/logger.cpp new file mode 100644 index 000000000..6790d622a --- /dev/null +++ b/src/logger.cpp @@ -0,0 +1,217 @@ +/* + * The ManaPlus Client + * Copyright (C) 2004-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include + +#include "logger.h" + +#include "configuration.h" + +#include "gui/widgets/chattab.h" + +#ifdef WIN32 +#include +#elif defined __APPLE__ +#include +#elif __linux__ || __linux +#include +#endif + +#include + +#include "debug.h" + +Logger::Logger(): + mLogToStandardOut(true), + mChatWindow(NULL), + mDebugLog(false) +{ +} + +Logger::~Logger() +{ + if (mLogFile.is_open()) + { + mLogFile.close(); + } +} + +void Logger::setLogFile(const std::string &logFilename) +{ + if (mLogFile.is_open()) + mLogFile.close(); + + mLogFile.open(logFilename.c_str(), std::ios_base::trunc); + + if (!mLogFile.is_open()) + { + std::cout << "Warning: error while opening " << logFilename << + " for writing.\n"; + } +} + +void Logger::log(std::string str) +{ + log("%s", str.c_str()); +} + +void Logger::dlog(std::string str) +{ + if (!mDebugLog) + return; + + // Get the current system time + timeval tv; + gettimeofday(&tv, NULL); + + // Print the log entry + std::stringstream timeStr; + timeStr << "[" + << ((((tv.tv_sec / 60) / 60) % 24 < 10) ? "0" : "") + << static_cast(((tv.tv_sec / 60) / 60) % 24) + << ":" + << (((tv.tv_sec / 60) % 60 < 10) ? "0" : "") + << static_cast((tv.tv_sec / 60) % 60) + << ":" + << ((tv.tv_sec % 60 < 10) ? "0" : "") + << static_cast(tv.tv_sec % 60) + << "." + << (((tv.tv_usec / 10000) % 100) < 10 ? "0" : "") + << static_cast((tv.tv_usec / 10000) % 100) + << "] "; + + if (mLogFile.is_open()) + mLogFile << timeStr.str() << str << std::endl; + + if (mLogToStandardOut) + std::cout << timeStr.str() << str << std::endl; + + if (mChatWindow && debugChatTab) + debugChatTab->chatLog(str, BY_LOGGER); +} + +void Logger::log1(const char *buf) +{ + // Get the current system time + timeval tv; + gettimeofday(&tv, NULL); + + // Print the log entry + std::stringstream timeStr; + timeStr << "[" + << ((((tv.tv_sec / 60) / 60) % 24 < 10) ? "0" : "") + << static_cast(((tv.tv_sec / 60) / 60) % 24) + << ":" + << (((tv.tv_sec / 60) % 60 < 10) ? "0" : "") + << static_cast((tv.tv_sec / 60) % 60) + << ":" + << ((tv.tv_sec % 60 < 10) ? "0" : "") + << static_cast(tv.tv_sec % 60) + << "." + << (((tv.tv_usec / 10000) % 100) < 10 ? "0" : "") + << static_cast((tv.tv_usec / 10000) % 100) + << "] "; + + if (mLogFile.is_open()) + mLogFile << timeStr.str() << buf << std::endl; + + if (mLogToStandardOut) + std::cout << timeStr.str() << buf << std::endl; + + if (mChatWindow && debugChatTab) + debugChatTab->chatLog(buf, BY_LOGGER); +} + +void Logger::log(const char *log_text, ...) +{ + unsigned size = 1024; + char* buf = 0; + if (strlen(log_text) * 3> size) + size = static_cast(strlen(log_text) * 3); + + buf = new char[size + 1]; + va_list ap; + + // Use a temporary buffer to fill in the variables + va_start(ap, log_text); + vsnprintf(buf, size, log_text, ap); + buf[size] = 0; + va_end(ap); + + // Get the current system time + timeval tv; + gettimeofday(&tv, NULL); + + // Print the log entry + std::stringstream timeStr; + timeStr << "[" + << ((((tv.tv_sec / 60) / 60) % 24 < 10) ? "0" : "") + << static_cast(((tv.tv_sec / 60) / 60) % 24) + << ":" + << (((tv.tv_sec / 60) % 60 < 10) ? "0" : "") + << static_cast((tv.tv_sec / 60) % 60) + << ":" + << ((tv.tv_sec % 60 < 10) ? "0" : "") + << static_cast(tv.tv_sec % 60) + << "." + << (((tv.tv_usec / 10000) % 100) < 10 ? "0" : "") + << static_cast((tv.tv_usec / 10000) % 100) + << "] "; + + if (mLogFile.is_open()) + mLogFile << timeStr.str() << buf << std::endl; + + if (mLogToStandardOut) + std::cout << timeStr.str() << buf << std::endl; + + if (mChatWindow && debugChatTab) + debugChatTab->chatLog(buf, BY_LOGGER); + + // Delete temporary buffer + delete[] buf; +} + +void Logger::error(const std::string &error_text) +{ + log("Error: %s", error_text.c_str()); +#ifdef WIN32 + MessageBox(NULL, error_text.c_str(), "Error", MB_ICONERROR | MB_OK); +#elif defined __APPLE__ +// Str255 msg; +// CFStringRef error; +// error = CFStringCreateWithCString(NULL, +// error_text.c_str(), +// kCFStringEncodingMacRoman); +// CFStringGetPascalString(error, msg, 255, kCFStringEncodingMacRoman); +// StandardAlert(kAlertStopAlert, +// (const unsigned char*)"\pError", +// (ConstStr255Param) msg, NULL, NULL); +#elif defined __linux__ || __linux + std::cerr << "Error: " << error_text << std::endl; + std::string msg = "xmessage \"" + error_text + "\""; + system(msg.c_str()); +#else + std::cerr << "Error: " << error_text << std::endl; +#endif + exit(1); +} diff --git a/src/logger.h b/src/logger.h new file mode 100644 index 000000000..b8517f696 --- /dev/null +++ b/src/logger.h @@ -0,0 +1,110 @@ +/* + * The ManaPlus Client + * Copyright (C) 2004-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef M_LOG_H +#define M_LOG_H + +#include "main.h" +#include + +class ChatWindow; + +#ifdef ENABLEDEBUGLOG +#define DEBUGLOG(msg) logger->dlog(msg) +#else +#define DEBUGLOG(msg) {} +#endif + +/** + * The Log Class : Useful to write debug or info messages + */ +class Logger +{ + public: + /** + * Constructor. + */ + Logger(); + + /** + * Destructor, closes log file. + */ + ~Logger(); + + /** + * Sets the file to log to and opens it + */ + void setLogFile(const std::string &logFilename); + + /** + * Sets whether the log should be written to standard output. + */ + void setLogToStandardOut(bool value) { mLogToStandardOut = value; } + + /** + * Enables logging to chat window + */ + void setChatWindow(ChatWindow *window) { mChatWindow = window; } + + /** + * Enters a message in the log. The message will be timestamped. + */ + void log(const char *log_text, ...) +#ifdef __GNUC__ + __attribute__((__format__(__printf__, 2, 3))) +#endif + ; + + /** + * Enters a message in the log. The message will be timestamped. + */ + void log1(const char *log_text); + + /** + * Enters a message in the log. The message will be timestamped. + */ + void log(std::string str); + + /** + * Enters debug message in the log. The message will be timestamped. + */ + void dlog(std::string str); + + void setDebugLog(bool n) + { mDebugLog = n; } + + /** + * Log an error and quit. The error will pop-up on Windows and Mac, and + * will be printed to standard error everywhere else. + */ + void error(const std::string &error_text) __attribute__ ((noreturn)); + + private: + std::ofstream mLogFile; + bool mLogToStandardOut; + ChatWindow *mChatWindow; + bool mDebugLog; +}; + +extern Logger *logger; + +#endif diff --git a/src/main.cpp b/src/main.cpp index faeedadaa..5c13b10ec 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -25,7 +25,7 @@ #include "utils/gettext.h" #include "client.h" -#include "log.h" +#include "logger.h" #include diff --git a/src/map.cpp b/src/map.cpp index 8225aded1..700f6d0d2 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -27,7 +27,7 @@ #include "configuration.h" #include "graphics.h" #include "graphicsvertexes.h" -#include "log.h" +#include "logger.h" #include "particle.h" #include "simpleanimation.h" #include "tileset.h" diff --git a/src/mumblemanager.cpp b/src/mumblemanager.cpp index 456606406..a9a8146b6 100644 --- a/src/mumblemanager.cpp +++ b/src/mumblemanager.cpp @@ -3,7 +3,7 @@ #include "mumblemanager.h" #include "configuration.h" -#include "log.h" +#include "logger.h" #include "utils/mathutils.h" diff --git a/src/net/download.cpp b/src/net/download.cpp index c93f33c21..93417197e 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -22,7 +22,7 @@ #include "net/download.h" #include "configuration.h" -#include "log.h" +#include "logger.h" #include "main.h" #include "utils/stringutils.h" diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index ee070593f..06e86f8a4 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -31,7 +31,7 @@ #include "guild.h" #include "keyboardconfig.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "party.h" #include "playerrelations.h" #include "configuration.h" diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp index c69d8a5be..a0e5b392a 100644 --- a/src/net/ea/charserverhandler.cpp +++ b/src/net/ea/charserverhandler.cpp @@ -23,7 +23,7 @@ #include "net/ea/charserverhandler.h" #include "client.h" -#include "log.h" +#include "logger.h" #include "gui/charcreatedialog.h" #include "gui/okdialog.h" diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp index ea9d17798..c188a2204 100644 --- a/src/net/ea/chathandler.cpp +++ b/src/net/ea/chathandler.cpp @@ -27,7 +27,7 @@ #include "configuration.h" #include "localplayer.h" #include "playerrelations.h" -#include "log.h" +#include "logger.h" #include "gui/chatwindow.h" #include "gui/shopwindow.h" diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp index 0b6b8a040..04c13572f 100644 --- a/src/net/ea/gamehandler.cpp +++ b/src/net/ea/gamehandler.cpp @@ -26,7 +26,7 @@ #include "event.h" #include "game.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "gui/okdialog.h" diff --git a/src/net/ea/gui/guildtab.cpp b/src/net/ea/gui/guildtab.cpp index 037885fd1..ab030be83 100644 --- a/src/net/ea/gui/guildtab.cpp +++ b/src/net/ea/gui/guildtab.cpp @@ -22,7 +22,7 @@ #include "net/ea/gui/guildtab.h" -#include "chatlog.h" +#include "chatlogger.h" #include "commandhandler.h" #include "guild.h" #include "localplayer.h" diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp index 02e0910a7..23eab361c 100644 --- a/src/net/ea/gui/partytab.cpp +++ b/src/net/ea/gui/partytab.cpp @@ -22,7 +22,7 @@ #include "net/ea/gui/partytab.h" -#include "chatlog.h" +#include "chatlogger.h" #include "commandhandler.h" #include "localplayer.h" #include "party.h" diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp index bb5cbe94b..0210a76ff 100644 --- a/src/net/ea/guildhandler.cpp +++ b/src/net/ea/guildhandler.cpp @@ -25,7 +25,7 @@ #include "guild.h" #include "event.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "gui/socialwindow.h" diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index 2e52b85ff..d921b5e2a 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -24,7 +24,7 @@ #include "inventory.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "gui/ministatus.h" diff --git a/src/net/ea/inventoryhandler.h b/src/net/ea/inventoryhandler.h index 1f1f8d296..4be4ddaa6 100644 --- a/src/net/ea/inventoryhandler.h +++ b/src/net/ea/inventoryhandler.h @@ -25,7 +25,7 @@ #include "equipment.h" #include "inventory.h" -#include "log.h" +#include "logger.h" #include "playerinfo.h" #include "gui/inventorywindow.h" diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index 51502895c..9f7a5f07d 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -23,7 +23,7 @@ #include "net/ea/loginhandler.h" #include "client.h" -#include "log.h" +#include "logger.h" #include "configuration.h" #include "utils/dtor.h" diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp index f720f9f96..045a2332b 100644 --- a/src/net/ea/partyhandler.cpp +++ b/src/net/ea/partyhandler.cpp @@ -22,7 +22,7 @@ #include "actorspritemanager.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "gui/socialwindow.h" diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 05b6cf9e3..4198c14ad 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -22,7 +22,7 @@ #include "net/ea/playerhandler.h" -#include "log.h" +#include "logger.h" #include "party.h" #include "playerinfo.h" #include "units.h" diff --git a/src/net/ea/specialhandler.cpp b/src/net/ea/specialhandler.cpp index 33fea3b27..4f0f22aed 100644 --- a/src/net/ea/specialhandler.cpp +++ b/src/net/ea/specialhandler.cpp @@ -22,7 +22,7 @@ #include "net/ea/specialhandler.h" -#include "log.h" +#include "logger.h" #include "localplayer.h" #include "playerinfo.h" diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp index 36a5f8811..a03782db2 100644 --- a/src/net/ea/tradehandler.cpp +++ b/src/net/ea/tradehandler.cpp @@ -25,7 +25,7 @@ #include "event.h" #include "inventory.h" #include "item.h" -#include "log.h" +#include "logger.h" #include "playerinfo.h" #include "playerrelations.h" diff --git a/src/net/manaserv/attributes.cpp b/src/net/manaserv/attributes.cpp index b48cc9eff..25c75f9d8 100644 --- a/src/net/manaserv/attributes.cpp +++ b/src/net/manaserv/attributes.cpp @@ -21,7 +21,7 @@ #include "net/manaserv/attributes.h" -#include "log.h" +#include "logger.h" #include "playerinfo.h" #include "gui/statuswindow.h" diff --git a/src/net/manaserv/beinghandler.cpp b/src/net/manaserv/beinghandler.cpp index 23aae1f56..d14cdcadf 100644 --- a/src/net/manaserv/beinghandler.cpp +++ b/src/net/manaserv/beinghandler.cpp @@ -27,7 +27,7 @@ #include "client.h" #include "game.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "particle.h" #include "gui/okdialog.h" diff --git a/src/net/manaserv/charhandler.cpp b/src/net/manaserv/charhandler.cpp index c2611c64b..3b2306feb 100644 --- a/src/net/manaserv/charhandler.cpp +++ b/src/net/manaserv/charhandler.cpp @@ -24,7 +24,7 @@ #include "client.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "gui/charcreatedialog.h" #include "gui/okdialog.h" diff --git a/src/net/manaserv/connection.cpp b/src/net/manaserv/connection.cpp index 7f51aeb98..33d6f28cf 100644 --- a/src/net/manaserv/connection.cpp +++ b/src/net/manaserv/connection.cpp @@ -22,7 +22,7 @@ #include "net/manaserv/connection.h" -#include "log.h" +#include "logger.h" #include "net/manaserv/internal.h" #include "net/manaserv/messageout.h" diff --git a/src/net/manaserv/effecthandler.cpp b/src/net/manaserv/effecthandler.cpp index 3979a0fde..92cf66302 100644 --- a/src/net/manaserv/effecthandler.cpp +++ b/src/net/manaserv/effecthandler.cpp @@ -24,7 +24,7 @@ #include "actorspritemanager.h" #include "effectmanager.h" -#include "log.h" +#include "logger.h" #include "net/messagein.h" diff --git a/src/net/manaserv/guildhandler.cpp b/src/net/manaserv/guildhandler.cpp index dc3dbc616..306a15be4 100644 --- a/src/net/manaserv/guildhandler.cpp +++ b/src/net/manaserv/guildhandler.cpp @@ -24,7 +24,7 @@ #include "event.h" #include "guild.h" -#include "log.h" +#include "logger.h" #include "localplayer.h" #include "channel.h" #include "channelmanager.h" diff --git a/src/net/manaserv/inventoryhandler.cpp b/src/net/manaserv/inventoryhandler.cpp index 5e38354fb..ce837b5e1 100644 --- a/src/net/manaserv/inventoryhandler.cpp +++ b/src/net/manaserv/inventoryhandler.cpp @@ -38,7 +38,7 @@ #include "resources/iteminfo.h" -#include "log.h" // <<< REMOVE ME! +#include "logger.h" // <<< REMOVE ME! extern Net::InventoryHandler *inventoryHandler; diff --git a/src/net/manaserv/itemhandler.cpp b/src/net/manaserv/itemhandler.cpp index 0afd12d21..89826a33f 100644 --- a/src/net/manaserv/itemhandler.cpp +++ b/src/net/manaserv/itemhandler.cpp @@ -29,7 +29,7 @@ #include "game.h" #include "map.h" -#include "log.h" +#include "logger.h" namespace ManaServ { diff --git a/src/net/manaserv/loginhandler.cpp b/src/net/manaserv/loginhandler.cpp index e6109ca28..bf823562f 100644 --- a/src/net/manaserv/loginhandler.cpp +++ b/src/net/manaserv/loginhandler.cpp @@ -23,7 +23,7 @@ #include "net/manaserv/loginhandler.h" #include "client.h" -#include "log.h" +#include "logger.h" #include "net/logindata.h" diff --git a/src/net/manaserv/network.cpp b/src/net/manaserv/network.cpp index e0ab7af78..53e83e4ec 100644 --- a/src/net/manaserv/network.cpp +++ b/src/net/manaserv/network.cpp @@ -22,7 +22,7 @@ #include "net/manaserv/network.h" -#include "log.h" +#include "logger.h" #include "net/manaserv/connection.h" #include "net/manaserv/internal.h" diff --git a/src/net/manaserv/partyhandler.cpp b/src/net/manaserv/partyhandler.cpp index 0e6af4578..987a40dc5 100644 --- a/src/net/manaserv/partyhandler.cpp +++ b/src/net/manaserv/partyhandler.cpp @@ -23,7 +23,7 @@ #include "net/manaserv/partyhandler.h" #include "event.h" -#include "log.h" +#include "logger.h" #include "localplayer.h" #include "gui/socialwindow.h" diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp index ca7fe511f..3dfddb436 100644 --- a/src/net/manaserv/playerhandler.cpp +++ b/src/net/manaserv/playerhandler.cpp @@ -27,7 +27,7 @@ #include "effectmanager.h" #include "game.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "particle.h" #include "playerinfo.h" #include "configuration.h" diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp index 8b5f2eee3..5bfeefdb6 100644 --- a/src/net/messagein.cpp +++ b/src/net/messagein.cpp @@ -24,7 +24,7 @@ #include "net/packetcounters.h" -#include "log.h" +#include "logger.h" #include "net.h" #include "utils/stringutils.h" diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp index 3cdcb42e0..a8b66f5ae 100644 --- a/src/net/messageout.cpp +++ b/src/net/messageout.cpp @@ -24,7 +24,7 @@ #include "net/packetcounters.h" -#include "log.h" +#include "logger.h" #include "utils/stringutils.h" diff --git a/src/net/tmwa/adminhandler.cpp b/src/net/tmwa/adminhandler.cpp index a0d996dbf..a332b04fa 100644 --- a/src/net/tmwa/adminhandler.cpp +++ b/src/net/tmwa/adminhandler.cpp @@ -28,7 +28,7 @@ #include "being.h" #include "event.h" #include "game.h" -#include "log.h" +#include "logger.h" #include "playerrelations.h" #include "net/chathandler.h" diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index d6f67f716..17503a406 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -29,7 +29,7 @@ #include "guild.h" #include "keyboardconfig.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "party.h" #include "playerrelations.h" #include "configuration.h" diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index fe803dc62..7aa68e617 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -24,7 +24,7 @@ #include "client.h" #include "configuration.h" -#include "log.h" +#include "logger.h" #include "gui/charcreatedialog.h" diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp index 0f23f6412..90acf0f90 100644 --- a/src/net/tmwa/chathandler.cpp +++ b/src/net/tmwa/chathandler.cpp @@ -29,7 +29,7 @@ #include "game.h" #include "localplayer.h" #include "playerrelations.h" -#include "log.h" +#include "logger.h" #include "gui/chatwindow.h" #include "gui/shopwindow.h" diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp index cc0a37c57..242e9f9de 100644 --- a/src/net/tmwa/gamehandler.cpp +++ b/src/net/tmwa/gamehandler.cpp @@ -26,7 +26,7 @@ #include "event.h" #include "game.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "net/messagein.h" #include "net/messageout.h" diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp index 3e46fa66b..746cb6620 100644 --- a/src/net/tmwa/generalhandler.cpp +++ b/src/net/tmwa/generalhandler.cpp @@ -24,7 +24,7 @@ #include "client.h" #include "configuration.h" -#include "log.h" +#include "logger.h" #include "gui/charselectdialog.h" #include "gui/inventorywindow.h" diff --git a/src/net/tmwa/gui/guildtab.cpp b/src/net/tmwa/gui/guildtab.cpp index 99b775089..05a93bff8 100644 --- a/src/net/tmwa/gui/guildtab.cpp +++ b/src/net/tmwa/gui/guildtab.cpp @@ -22,7 +22,7 @@ #include "net/tmwa/gui/guildtab.h" -#include "chatlog.h" +#include "chatlogger.h" #include "commandhandler.h" #include "guild.h" #include "localplayer.h" diff --git a/src/net/tmwa/gui/partytab.cpp b/src/net/tmwa/gui/partytab.cpp index d15f4754f..373fcca31 100644 --- a/src/net/tmwa/gui/partytab.cpp +++ b/src/net/tmwa/gui/partytab.cpp @@ -22,7 +22,7 @@ #include "net/tmwa/gui/partytab.h" -#include "chatlog.h" +#include "chatlogger.h" #include "commandhandler.h" #include "localplayer.h" #include "party.h" diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp index 43583971f..640a6fd78 100644 --- a/src/net/tmwa/guildhandler.cpp +++ b/src/net/tmwa/guildhandler.cpp @@ -23,7 +23,7 @@ #include "actorspritemanager.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "playerinfo.h" #include "net/tmwa/messagein.h" diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index ae79f6842..14a15e59f 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -22,7 +22,7 @@ #include "net/tmwa/inventoryhandler.h" -#include "log.h" +#include "logger.h" #include "net/messagein.h" diff --git a/src/net/tmwa/inventoryhandler.h b/src/net/tmwa/inventoryhandler.h index 405bacc43..9a0978bd0 100644 --- a/src/net/tmwa/inventoryhandler.h +++ b/src/net/tmwa/inventoryhandler.h @@ -23,7 +23,7 @@ #ifndef NET_TA_INVENTORYHANDLER_H #define NET_TA_INVENTORYHANDLER_H -#include "log.h" +#include "logger.h" #include "net/net.h" diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp index 15ed2f27c..029c379a0 100644 --- a/src/net/tmwa/loginhandler.cpp +++ b/src/net/tmwa/loginhandler.cpp @@ -23,7 +23,7 @@ #include "net/tmwa/loginhandler.h" #include "client.h" -#include "log.h" +#include "logger.h" #include "configuration.h" #include "net/messagein.h" diff --git a/src/net/tmwa/messagein.cpp b/src/net/tmwa/messagein.cpp index 6e2fcc187..fb1986597 100644 --- a/src/net/tmwa/messagein.cpp +++ b/src/net/tmwa/messagein.cpp @@ -24,7 +24,7 @@ #include "net/packetcounters.h" -#include "log.h" +#include "logger.h" #include "utils/stringutils.h" diff --git a/src/net/tmwa/messageout.cpp b/src/net/tmwa/messageout.cpp index a904b6bbb..6071e0ab6 100644 --- a/src/net/tmwa/messageout.cpp +++ b/src/net/tmwa/messageout.cpp @@ -26,7 +26,7 @@ #include "net/tmwa/network.h" -#include "log.h" +#include "logger.h" #include "utils/stringutils.h" diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index c2049d3cc..8ecf04d36 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -22,7 +22,7 @@ #include "net/tmwa/network.h" -#include "log.h" +#include "logger.h" #include "net/messagehandler.h" #include "net/messagein.h" diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp index 5bbf8baf3..7f942a206 100644 --- a/src/net/tmwa/partyhandler.cpp +++ b/src/net/tmwa/partyhandler.cpp @@ -22,7 +22,7 @@ #include "actorspritemanager.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "net/messagein.h" diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp index f20ea64a0..c34c661e8 100644 --- a/src/net/tmwa/playerhandler.cpp +++ b/src/net/tmwa/playerhandler.cpp @@ -22,7 +22,7 @@ #include "net/tmwa/playerhandler.h" -#include "log.h" +#include "logger.h" #include "net/messagein.h" diff --git a/src/net/tmwa/specialhandler.cpp b/src/net/tmwa/specialhandler.cpp index b175368bd..509c5ecd1 100644 --- a/src/net/tmwa/specialhandler.cpp +++ b/src/net/tmwa/specialhandler.cpp @@ -22,7 +22,7 @@ #include "net/tmwa/specialhandler.h" -#include "log.h" +#include "logger.h" #include "net/messagein.h" diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp index 108b544a0..2280079ea 100644 --- a/src/net/tmwa/tradehandler.cpp +++ b/src/net/tmwa/tradehandler.cpp @@ -23,7 +23,7 @@ #include "net/tmwa/tradehandler.h" #include "item.h" -#include "log.h" +#include "logger.h" #include "playerinfo.h" #include "net/messagein.h" diff --git a/src/opengl1graphics.cpp b/src/opengl1graphics.cpp index d40784aff..e93066b96 100644 --- a/src/opengl1graphics.cpp +++ b/src/opengl1graphics.cpp @@ -26,7 +26,7 @@ #include "opengl1graphics.h" #include "graphicsvertexes.h" -#include "log.h" +#include "logger.h" #include "resources/image.h" diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp index 6081fa6b3..f918a5c0d 100644 --- a/src/openglgraphics.cpp +++ b/src/openglgraphics.cpp @@ -26,7 +26,7 @@ #include "graphicsvertexes.h" #include "openglgraphics.h" -#include "log.h" +#include "logger.h" #include "resources/image.h" diff --git a/src/particle.cpp b/src/particle.cpp index eca9307ea..7d7a73e9a 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -27,7 +27,7 @@ #include "configuration.h" #include "resources/dye.h" #include "imageparticle.h" -#include "log.h" +#include "logger.h" #include "map.h" #include "particle.h" #include "particleemitter.h" diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp index c04b1b36f..caa48a795 100644 --- a/src/particleemitter.cpp +++ b/src/particleemitter.cpp @@ -22,7 +22,7 @@ #include "animationparticle.h" #include "imageparticle.h" -#include "log.h" +#include "logger.h" #include "particle.h" #include "particleemitter.h" #include "rotationalparticle.h" diff --git a/src/playerinfo.cpp b/src/playerinfo.cpp index 72b091244..3bb196921 100644 --- a/src/playerinfo.cpp +++ b/src/playerinfo.cpp @@ -26,7 +26,7 @@ #include "event.h" #include "inventory.h" #include "listener.h" -#include "log.h" +#include "logger.h" #include "resources/itemdb.h" #include "resources/iteminfo.h" diff --git a/src/properties.h b/src/properties.h index c65e30c22..19354b9ab 100644 --- a/src/properties.h +++ b/src/properties.h @@ -23,7 +23,7 @@ #ifndef PROPERTIES_H #define PROPERTIES_H -#include "log.h" +#include "logger.h" #include #include #include diff --git a/src/resources/animation.cpp b/src/resources/animation.cpp index ea7f44199..32b57b3b1 100644 --- a/src/resources/animation.cpp +++ b/src/resources/animation.cpp @@ -22,7 +22,7 @@ #include "resources/animation.h" -#include "log.h" +#include "logger.h" #include "utils/dtor.h" diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp index 6b4f57d81..8beea420d 100644 --- a/src/resources/beinginfo.cpp +++ b/src/resources/beinginfo.cpp @@ -22,7 +22,7 @@ #include "resources/beinginfo.h" -#include "log.h" +#include "logger.h" #include "utils/dtor.h" #include "utils/gettext.h" diff --git a/src/resources/colordb.cpp b/src/resources/colordb.cpp index 72a5e4023..ed8c934dc 100644 --- a/src/resources/colordb.cpp +++ b/src/resources/colordb.cpp @@ -21,7 +21,7 @@ #include "resources/colordb.h" #include "client.h" -#include "log.h" +#include "logger.h" #include "utils/xml.h" diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp index fe7d4bcac..a782b6ec1 100644 --- a/src/resources/dye.cpp +++ b/src/resources/dye.cpp @@ -22,7 +22,7 @@ #include "resources/dye.h" -#include "log.h" +#include "logger.h" #include #include diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp index 85a2993dd..b7f7d7901 100644 --- a/src/resources/emotedb.cpp +++ b/src/resources/emotedb.cpp @@ -21,7 +21,7 @@ #include "resources/emotedb.h" #include "animatedsprite.h" -#include "log.h" +#include "logger.h" #include "utils/xml.h" #include "configuration.h" diff --git a/src/resources/image.cpp b/src/resources/image.cpp index b1f83e258..802f2ee12 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -31,7 +31,7 @@ #endif #include "client.h" -#include "log.h" +#include "logger.h" #include "main.h" #include "utils/stringutils.h" diff --git a/src/resources/imageset.cpp b/src/resources/imageset.cpp index 1d41c6e63..5cf3e7d82 100644 --- a/src/resources/imageset.cpp +++ b/src/resources/imageset.cpp @@ -22,7 +22,7 @@ #include "resources/imageset.h" -#include "log.h" +#include "logger.h" #include "resources/image.h" diff --git a/src/resources/imagewriter.cpp b/src/resources/imagewriter.cpp index 5d0bd9d94..e6f3c8c27 100644 --- a/src/resources/imagewriter.cpp +++ b/src/resources/imagewriter.cpp @@ -22,7 +22,7 @@ #include "resources/imagewriter.h" -#include "log.h" +#include "logger.h" #if defined __OpenBSD__ #include diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index 7919145bd..e60127997 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -23,7 +23,7 @@ #include "resources/itemdb.h" #include "client.h" -#include "log.h" +#include "logger.h" #include "resources/iteminfo.h" #include "resources/resourcemanager.h" diff --git a/src/resources/mapdb.cpp b/src/resources/mapdb.cpp index e8aeaf168..e7288e039 100644 --- a/src/resources/mapdb.cpp +++ b/src/resources/mapdb.cpp @@ -23,7 +23,7 @@ #include "configuration.h" #include "client.h" -#include "log.h" +#include "logger.h" #include "utils/xml.h" diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 35267533f..70c45054f 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -23,7 +23,7 @@ #include "resources/mapreader.h" #include "configuration.h" -#include "log.h" +#include "logger.h" #include "map.h" #include "tileset.h" diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp index 7a0494fc9..dbf9d3e9a 100644 --- a/src/resources/monsterdb.cpp +++ b/src/resources/monsterdb.cpp @@ -22,7 +22,7 @@ #include "resources/monsterdb.h" -#include "log.h" +#include "logger.h" #include "net/net.h" diff --git a/src/resources/music.cpp b/src/resources/music.cpp index ccd1d9280..5ae9a2202 100644 --- a/src/resources/music.cpp +++ b/src/resources/music.cpp @@ -22,7 +22,7 @@ #include "resources/music.h" -#include "log.h" +#include "logger.h" #include "debug.h" diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp index 49eab5bf2..d04a2518f 100644 --- a/src/resources/npcdb.cpp +++ b/src/resources/npcdb.cpp @@ -22,7 +22,7 @@ #include "resources/npcdb.h" -#include "log.h" +#include "logger.h" #include "resources/beinginfo.h" diff --git a/src/resources/resource.cpp b/src/resources/resource.cpp index 6e986272a..b180712c1 100644 --- a/src/resources/resource.cpp +++ b/src/resources/resource.cpp @@ -23,7 +23,7 @@ #include "resources/resource.h" #include "client.h" -#include "log.h" +#include "logger.h" #include "resources/resourcemanager.h" diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index 92c18fa2a..ee325e253 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -24,7 +24,7 @@ #include "client.h" #include "configuration.h" -#include "log.h" +#include "logger.h" #include "main.h" #include "resources/dye.h" diff --git a/src/resources/soundeffect.cpp b/src/resources/soundeffect.cpp index a01bf21a0..49e7adc31 100644 --- a/src/resources/soundeffect.cpp +++ b/src/resources/soundeffect.cpp @@ -22,7 +22,7 @@ #include "resources/soundeffect.h" -#include "log.h" +#include "logger.h" #include "debug.h" diff --git a/src/resources/specialdb.cpp b/src/resources/specialdb.cpp index 4ab5e2a91..573ffb2a3 100644 --- a/src/resources/specialdb.cpp +++ b/src/resources/specialdb.cpp @@ -21,7 +21,7 @@ #include "resources/specialdb.h" -#include "log.h" +#include "logger.h" #include "utils/dtor.h" #include "utils/xml.h" diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp index b6addba77..dee93e1e7 100644 --- a/src/resources/spritedef.cpp +++ b/src/resources/spritedef.cpp @@ -22,7 +22,7 @@ #include "resources/spritedef.h" -#include "log.h" +#include "logger.h" #include "resources/action.h" #include "resources/animation.h" diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp index 397b87993..09c9f2a04 100644 --- a/src/resources/wallpaper.cpp +++ b/src/resources/wallpaper.cpp @@ -23,7 +23,7 @@ #include "resources/wallpaper.h" #include "resources/resourcemanager.h" -#include "log.h" +#include "logger.h" #include "utils/stringutils.h" #include "configuration.h" diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp index e3591f30c..4736b2e57 100644 --- a/src/simpleanimation.cpp +++ b/src/simpleanimation.cpp @@ -23,7 +23,7 @@ #include "simpleanimation.h" #include "graphics.h" -#include "log.h" +#include "logger.h" #include "utils/stringutils.h" diff --git a/src/sound.cpp b/src/sound.cpp index 92a5eaa6f..0a3c75d11 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -24,7 +24,7 @@ #include "configuration.h" #include "localplayer.h" -#include "log.h" +#include "logger.h" #include "sound.h" #include "resources/resourcemanager.h" diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp index 13b8e7b69..a79388350 100644 --- a/src/spellmanager.cpp +++ b/src/spellmanager.cpp @@ -25,7 +25,7 @@ #include "being.h" #include "configuration.h" -#include "log.h" +#include "logger.h" #include "localplayer.h" #include "playerinfo.h" diff --git a/src/spellshortcut.h b/src/spellshortcut.h index 4d59384bd..047ccdef3 100644 --- a/src/spellshortcut.h +++ b/src/spellshortcut.h @@ -25,7 +25,7 @@ #define SPELLSHORTCUT_H #include "spellmanager.h" -#include "log.h" +#include "logger.h" #include "utils/stringutils.h" class TextCommand; diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp index 27e351a45..dccf21f46 100644 --- a/src/statuseffect.cpp +++ b/src/statuseffect.cpp @@ -22,7 +22,7 @@ #include "statuseffect.h" -#include "log.h" +#include "logger.h" #include "sound.h" #include "gui/widgets/chattab.h" diff --git a/src/units.cpp b/src/units.cpp index ee0647e2e..db9faadd1 100644 --- a/src/units.cpp +++ b/src/units.cpp @@ -22,7 +22,7 @@ #include "units.h" -#include "log.h" +#include "logger.h" #include "utils/stringutils.h" #include "utils/xml.h" diff --git a/src/utils/mutex.h b/src/utils/mutex.h index f23ddc2aa..03dac2e7a 100644 --- a/src/utils/mutex.h +++ b/src/utils/mutex.h @@ -23,7 +23,7 @@ #ifndef MUTEX_H #define MUTEX_H -#include "log.h" +#include "logger.h" #include diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp index b31b60ee1..89457a4e8 100644 --- a/src/utils/xml.cpp +++ b/src/utils/xml.cpp @@ -22,7 +22,7 @@ #include "utils/xml.h" -#include "log.h" +#include "logger.h" #include "resources/resourcemanager.h" -- cgit v1.2.3-70-g09d2 From b2c9a0fa784997232141336dca358295bd57a75f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 12 Aug 2011 04:03:26 +0300 Subject: Rename file name ministatus to correct ministatuswindow. --- manaplus.cbp | 4 +- src/CMakeLists.txt | 4 +- src/Makefile.am | 4 +- src/game.cpp | 2 +- src/gui/ministatus.cpp | 473 ---------------------------------------- src/gui/ministatus.h | 127 ----------- src/gui/ministatuswindow.cpp | 473 ++++++++++++++++++++++++++++++++++++++++ src/gui/ministatuswindow.h | 127 +++++++++++ src/gui/popupmenu.cpp | 2 +- src/gui/viewport.cpp | 2 +- src/localplayer.cpp | 2 +- src/net/ea/inventoryhandler.cpp | 2 +- 12 files changed, 611 insertions(+), 611 deletions(-) delete mode 100644 src/gui/ministatus.cpp delete mode 100644 src/gui/ministatus.h create mode 100644 src/gui/ministatuswindow.cpp create mode 100644 src/gui/ministatuswindow.h (limited to 'src/net') diff --git a/manaplus.cbp b/manaplus.cbp index de71b2947..0083d9c8b 100644 --- a/manaplus.cbp +++ b/manaplus.cbp @@ -196,8 +196,8 @@ - - + + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8a0135790..655d4896c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -267,8 +267,8 @@ SET(SRCS gui/logindialog.h gui/minimap.cpp gui/minimap.h - gui/ministatus.cpp - gui/ministatus.h + gui/ministatuswindow.cpp + gui/ministatuswindow.h gui/npcdialog.cpp gui/npcdialog.h gui/npcpostdialog.cpp diff --git a/src/Makefile.am b/src/Makefile.am index e6d84e016..8bacf6803 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -270,8 +270,8 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ gui/logindialog.h \ gui/minimap.cpp \ gui/minimap.h \ - gui/ministatus.cpp \ - gui/ministatus.h \ + gui/ministatuswindow.cpp \ + gui/ministatuswindow.h \ gui/npcdialog.cpp \ gui/npcdialog.h \ gui/npcpostdialog.cpp \ diff --git a/src/game.cpp b/src/game.cpp index 4967231b0..4e7345340 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -60,7 +60,7 @@ #include "gui/inventorywindow.h" #include "gui/killstats.h" #include "gui/minimap.h" -#include "gui/ministatus.h" +#include "gui/ministatuswindow.h" #include "gui/npcpostdialog.h" #include "gui/okdialog.h" #include "gui/outfitwindow.h" diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp deleted file mode 100644 index 817cd74a5..000000000 --- a/src/gui/ministatus.cpp +++ /dev/null @@ -1,473 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#include "gui/ministatus.h" - -#include "animatedsprite.h" -#include "configuration.h" -#include "graphics.h" -#include "playerinfo.h" - -#include "gui/chatwindow.h" -#include "gui/gui.h" -#include "gui/statuswindow.h" -#include "gui/statuspopup.h" -#include "gui/textpopup.h" -#include "gui/theme.h" -#include "gui/viewport.h" - -#include "gui/widgets/chattab.h" -#include "gui/widgets/label.h" -#include "gui/widgets/progressbar.h" - -#include "net/net.h" -#include "net/playerhandler.h" -#include "net/gamehandler.h" - -#include "utils/dtor.h" -#include "utils/gettext.h" -#include "utils/stringutils.h" - -#include "debug.h" - -extern volatile int tick_time; - -MiniStatusWindow::MiniStatusWindow(): - Popup("MiniStatus") -{ - listen(Mana::CHANNEL_ATTRIBUTES); - - mHpBar = createBar(0, 100, 20, Theme::PROG_HP, "hp bar", _("health bar")); - StatusWindow::updateHPBar(mHpBar); - - if (Net::getGameHandler()->canUseMagicBar()) - { - mMpBar = createBar(0, 100, 20, Net::getPlayerHandler()->canUseMagic() - ? Theme::PROG_MP : Theme::PROG_NO_MP, "mp bar", _("mana bar")); - StatusWindow::updateMPBar(mMpBar); - } - else - { - mMpBar = 0; - } - - int job = Net::getPlayerHandler()->getJobLocation() - && serverConfig.getValueBool("showJob", false); - - mXpBar = createBar(0, 100, 20, Theme::PROG_EXP, - "xp bar", _("experience bar")); - StatusWindow::updateXPBar(mXpBar); - - if (job) - { - mJobBar = createBar(0, 100, 20, Theme::PROG_JOB, "job bar", - _("job bar")); - StatusWindow::updateJobBar(mJobBar); - } - else - { - mJobBar = 0; - } - - mWeightBar = createBar(0, 140, 20, Theme::PROG_WEIGHT, - "weight bar", _("weight bar")); - - mInvSlotsBar = createBar(0, 45, 20, Theme::PROG_INVY_SLOTS, - "inventory slots bar", _("inventory slots bar")); - - mMoneyBar = createBar(0, 130, 20, Theme::PROG_INVY_SLOTS, - "money bar", _("money bar")); - - mArrowsBar = createBar(0, 50, 20, Theme::PROG_INVY_SLOTS, - "arrows bar", _("arrows bar")); - - mStatusBar = createBar(100, 150, 20, Theme::PROG_EXP, - "status bar", _("status bar")); - - loadBars(); - updateBars(); - - setVisible(config.getValueBool(getPopupName() + "Visible", true)); - - mStatusPopup = new StatusPopup(); - mTextPopup = new TextPopup(); - - addMouseListener(this); - Inventory *inv = PlayerInfo::getInventory(); - if (inv) - inv->addInventoyListener(this); - - StatusWindow::updateMoneyBar(mMoneyBar); - StatusWindow::updateArrowsBar(mArrowsBar); - updateStatus(); -} - -MiniStatusWindow::~MiniStatusWindow() -{ - delete mTextPopup; - mTextPopup = 0; - delete mStatusPopup; - mStatusPopup = 0; - delete_all(mIcons); - mIcons.clear(); - - Inventory *inv = PlayerInfo::getInventory(); - if (inv) - inv->removeInventoyListener(this); - - std::vector ::iterator it, it_end; - for (it = mBars.begin(), it_end = mBars.end(); it != it_end; ++it) - { - ProgressBar *bar = *it; - if (!bar) - continue; - if (!bar->isVisible()) - delete bar; - } -} - -ProgressBar *MiniStatusWindow::createBar(float progress, int width, int height, - int color, std::string name, - std::string description) -{ - ProgressBar *bar = new ProgressBar(progress, width, height, color); - bar->setActionEventId(name); - bar->setId(description); - mBars.push_back(bar); - mBarNames[name] = bar; - return bar; -} - -void MiniStatusWindow::updateBars() -{ - int x = 0; - std::vector ::iterator it, it_end; - ProgressBar* lastBar = 0; - for (it = mBars.begin(), it_end = mBars.end(); it != it_end; ++it) - safeRemove(*it); - for (it = mBars.begin(), it_end = mBars.end(); it != it_end; ++it) - { - ProgressBar *bar = *it; - if (!bar) - continue; - if (bar->isVisible()) - { - bar->setPosition(x, 3); - add(bar); - x += bar->getWidth() + 3; - lastBar = bar; - } - } - - if (lastBar) - { - setContentSize(lastBar->getX() + lastBar->getWidth(), - lastBar->getY() + lastBar->getHeight()); - } -} - -void MiniStatusWindow::setIcon(int index, AnimatedSprite *sprite) -{ - if (index >= static_cast(mIcons.size())) - mIcons.resize(index + 1, 0); - - delete mIcons[index]; - - mIcons[index] = sprite; -} - -void MiniStatusWindow::eraseIcon(int index) -{ - if (index < static_cast(mIcons.size())) - { - delete mIcons[index]; - mIcons.erase(mIcons.begin() + index); - } -} - -void MiniStatusWindow::drawIcons(Graphics *graphics) -{ - // Draw icons - int icon_x = mStatusBar->getX() + mStatusBar->getWidth() + 4; - for (unsigned int i = 0; i < mIcons.size(); i++) - { - if (mIcons[i]) - { - mIcons[i]->draw(graphics, icon_x, 3); - icon_x += 2 + mIcons[i]->getWidth(); - } - } -} - -void MiniStatusWindow::event(Mana::Channels channel A_UNUSED, - const Mana::Event &event) -{ - if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) - { - int id = event.getInt("id"); - if (id == HP || id == MAX_HP) - StatusWindow::updateHPBar(mHpBar); - else if (id == MP || id == MAX_MP) - StatusWindow::updateMPBar(mMpBar); - else if (id == EXP || id == EXP_NEEDED) - StatusWindow::updateXPBar(mXpBar); - else if (id == TOTAL_WEIGHT || id == MAX_WEIGHT) - StatusWindow::updateWeightBar(mWeightBar); - else if (id == MONEY) - StatusWindow::updateMoneyBar(mMoneyBar); - } - else if (event.getName() == Mana::EVENT_UPDATESTAT) - { - StatusWindow::updateMPBar(mMpBar); - StatusWindow::updateJobBar(mJobBar); - } -} - -void MiniStatusWindow::updateStatus() -{ - StatusWindow::updateStatusBar(mStatusBar); - if (mStatusPopup && mStatusPopup->isVisible()) - mStatusPopup->update(); -} - -void MiniStatusWindow::logic() -{ - Popup::logic(); - - for (unsigned int i = 0; i < mIcons.size(); i++) - { - if (mIcons[i]) - mIcons[i]->update(tick_time * 10); - } -} - -void MiniStatusWindow::draw(gcn::Graphics *graphics) -{ - drawChildren(graphics); -} - -void MiniStatusWindow::mouseMoved(gcn::MouseEvent &event) -{ - Popup::mouseMoved(event); - - const int x = event.getX(); - const int y = event.getY(); - - if (event.getSource() == mStatusBar) - { - mStatusPopup->view(x + getX(), y + getY()); - mTextPopup->hide(); - } - else if (event.getSource() == mXpBar) - { - if (PlayerInfo::getAttribute(EXP) - > PlayerInfo::getAttribute(EXP_NEEDED)) - { - mTextPopup->show(x + getX(), y + getY(), - event.getSource()->getId(), - strprintf("%u/%u", PlayerInfo::getAttribute(EXP), - PlayerInfo::getAttribute(EXP_NEEDED))); - } - else - { - mTextPopup->show(x + getX(), y + getY(), - event.getSource()->getId(), - strprintf("%u/%u", PlayerInfo::getAttribute(EXP), - PlayerInfo::getAttribute(EXP_NEEDED)), - strprintf("%s: %u", _("Need"), - PlayerInfo::getAttribute(EXP_NEEDED) - - PlayerInfo::getAttribute(EXP))); - } - mStatusPopup->hide(); - } - else if (event.getSource() == mHpBar) - { - mTextPopup->show(x + getX(), y + getY(), - event.getSource()->getId(), - strprintf("%u/%u", PlayerInfo::getAttribute(HP), - PlayerInfo::getAttribute(MAX_HP))); - mStatusPopup->hide(); - } - else if (event.getSource() == mMpBar) - { - mTextPopup->show(x + getX(), y + getY(), - event.getSource()->getId(), - strprintf("%u/%u", PlayerInfo::getAttribute(MP), - PlayerInfo::getAttribute(MAX_MP))); - mStatusPopup->hide(); - } - else if (event.getSource() == mJobBar) - { - std::pair exp = PlayerInfo::getStatExperience( - Net::getPlayerHandler()->getJobLocation()); - - if (exp.first > exp.second) - { - mTextPopup->show(x + getX(), y + getY(), - event.getSource()->getId(), - strprintf("%u/%u", exp.first, - exp.second)); - } - else - { - mTextPopup->show(x + getX(), y + getY(), - event.getSource()->getId(), - strprintf("%u/%u", exp.first, - exp.second), - strprintf("%s: %u", _("Need"), - exp.second - - exp.first)); - } - mStatusPopup->hide(); - } - else if (event.getSource() == mWeightBar) - { - mTextPopup->show(x + getX(), y + getY(), - event.getSource()->getId(), - strprintf("%u/%u", PlayerInfo::getAttribute(TOTAL_WEIGHT), - PlayerInfo::getAttribute(MAX_WEIGHT))); - mStatusPopup->hide(); - } - else if (event.getSource() == mInvSlotsBar) - { - Inventory *inv = PlayerInfo::getInventory(); - if (inv) - { - const int usedSlots = inv->getNumberOfSlotsUsed(); - const int maxSlots = inv->getSize(); - - mTextPopup->show(x + getX(), y + getY(), - event.getSource()->getId(), - strprintf("%u/%u", usedSlots, maxSlots)); - } - mStatusPopup->hide(); - } - else if (event.getSource() == mMoneyBar) - { - mTextPopup->show(x + getX(), y + getY(), - event.getSource()->getId(), - toString(PlayerInfo::getAttribute(MONEY))); - } - else - { - mTextPopup->hide(); - mStatusPopup->hide(); - } -} - -void MiniStatusWindow::mousePressed(gcn::MouseEvent &event) -{ - if (!viewport) - return; - - if (event.getButton() == gcn::MouseEvent::RIGHT) - { - ProgressBar *bar = dynamic_cast(event.getSource()); - if (!bar) - return; - if (viewport) - { - viewport->showPopup(getX() + event.getX(), - getY() + event.getY(), bar); - } - } -} - -void MiniStatusWindow::mouseExited(gcn::MouseEvent &event) -{ - Popup::mouseExited(event); - - mTextPopup->hide(); - mStatusPopup->hide(); -} - -void MiniStatusWindow::showBar(std::string name, bool isVisible) -{ - ProgressBar *bar = mBarNames[name]; - if (!bar) - return; - bar->setVisible(isVisible); - updateBars(); - saveBars(); -} - -void MiniStatusWindow::loadBars() -{ - if (!config.getValue("ministatussaved", 0)) - { - if (mWeightBar) - mWeightBar->setVisible(false); - if (mInvSlotsBar) - mInvSlotsBar->setVisible(false); - if (mMoneyBar) - mMoneyBar->setVisible(false); - if (mArrowsBar) - mArrowsBar->setVisible(false); - return; - } - - for (int f = 0; f < 10; f ++) - { - std::string str = config.getValue("ministatus" + toString(f), ""); - if (str == "" || str == "status bar") - continue; - ProgressBar *bar = mBarNames[str]; - if (!bar) - continue; - bar->setVisible(false); - } -} - -void MiniStatusWindow::saveBars() -{ - std::vector ::iterator it, it_end; - int i = 0; - for (it = mBars.begin(), it_end = mBars.end(); - it != it_end; ++it) - { - ProgressBar *bar = *it; - if (!bar->isVisible()) - { - config.setValue("ministatus" + toString(i), - bar->getActionEventId()); - i ++; - } - } - for (int f = i; f < 10; f ++) - config.deleteKey("ministatus" + toString(f)); - - config.setValue("ministatussaved", true); -} - -void MiniStatusWindow::slotsChanged(Inventory* inventory) -{ - if (!inventory) - return; - - if (inventory->getType() == Inventory::INVENTORY) - StatusWindow::updateInvSlotsBar(mInvSlotsBar); -} - -void MiniStatusWindow::updateArrows() -{ - StatusWindow::updateArrowsBar(mArrowsBar); -} diff --git a/src/gui/ministatus.h b/src/gui/ministatus.h deleted file mode 100644 index f19055305..000000000 --- a/src/gui/ministatus.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef MINISTATUS_H -#define MINISTATUS_H - -#include "inventory.h" -#include "listener.h" - -#include "gui/widgets/popup.h" -#include "gui/widgets/window.h" - -#include - -#ifdef __GNUC__ -#define A_UNUSED __attribute__ ((unused)) -#else -#define A_UNUSED -#endif - -class AnimatedSprite; -class Graphics; -class ProgressBar; -class StatusPopup; -class TextPopup; - -/** - * The player mini-status dialog. - * - * \ingroup Interface - */ -class MiniStatusWindow : public Popup, - public InventoryListener, - public Mana::Listener -{ - public: - MiniStatusWindow(); - - ~MiniStatusWindow(); - - /** - * Sets one of the icons. - */ - void setIcon(int index, AnimatedSprite *sprite); - - void eraseIcon(int index); - - void drawIcons(Graphics *graphics); - - void event(Mana::Channels channel, const Mana::Event &event); - - void updateStatus(); - - void logic(); // Updates icons - - void draw(gcn::Graphics *graphics); - - void mouseMoved(gcn::MouseEvent &mouseEvent); - - void mousePressed(gcn::MouseEvent &event); - - void mouseExited(gcn::MouseEvent &event); - - void showBar(std::string name, bool isVisible); - - void updateBars(); - - void updateArrows(); - - void slotsChanged(Inventory* inventory); - - std::vector &getBars() - { return mBars; } - - private: - bool isInBar(ProgressBar *bar, int x, int y) const; - - ProgressBar *createBar(float progress, int width, int height, - int color, std::string name, - std::string description); - - void loadBars(); - - void saveBars(); - - /* - * Mini Status Bars - */ - ProgressBar *mHpBar; - ProgressBar *mMpBar; - ProgressBar *mXpBar; - ProgressBar *mJobBar; - ProgressBar *mWeightBar; - ProgressBar *mInvSlotsBar; - ProgressBar *mMoneyBar; - ProgressBar *mArrowsBar; - ProgressBar *mStatusBar; - TextPopup *mTextPopup; - StatusPopup *mStatusPopup; - std::vector mBars; - std::map mBarNames; - - std::vector mIcons; -}; - -extern MiniStatusWindow *miniStatusWindow; - -#endif diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp new file mode 100644 index 000000000..08e3d0053 --- /dev/null +++ b/src/gui/ministatuswindow.cpp @@ -0,0 +1,473 @@ +/* + * The ManaPlus Client + * Copyright (C) 2004-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "gui/ministatuswindow.h" + +#include "animatedsprite.h" +#include "configuration.h" +#include "graphics.h" +#include "playerinfo.h" + +#include "gui/chatwindow.h" +#include "gui/gui.h" +#include "gui/statuswindow.h" +#include "gui/statuspopup.h" +#include "gui/textpopup.h" +#include "gui/theme.h" +#include "gui/viewport.h" + +#include "gui/widgets/chattab.h" +#include "gui/widgets/label.h" +#include "gui/widgets/progressbar.h" + +#include "net/net.h" +#include "net/playerhandler.h" +#include "net/gamehandler.h" + +#include "utils/dtor.h" +#include "utils/gettext.h" +#include "utils/stringutils.h" + +#include "debug.h" + +extern volatile int tick_time; + +MiniStatusWindow::MiniStatusWindow(): + Popup("MiniStatus") +{ + listen(Mana::CHANNEL_ATTRIBUTES); + + mHpBar = createBar(0, 100, 20, Theme::PROG_HP, "hp bar", _("health bar")); + StatusWindow::updateHPBar(mHpBar); + + if (Net::getGameHandler()->canUseMagicBar()) + { + mMpBar = createBar(0, 100, 20, Net::getPlayerHandler()->canUseMagic() + ? Theme::PROG_MP : Theme::PROG_NO_MP, "mp bar", _("mana bar")); + StatusWindow::updateMPBar(mMpBar); + } + else + { + mMpBar = 0; + } + + int job = Net::getPlayerHandler()->getJobLocation() + && serverConfig.getValueBool("showJob", false); + + mXpBar = createBar(0, 100, 20, Theme::PROG_EXP, + "xp bar", _("experience bar")); + StatusWindow::updateXPBar(mXpBar); + + if (job) + { + mJobBar = createBar(0, 100, 20, Theme::PROG_JOB, "job bar", + _("job bar")); + StatusWindow::updateJobBar(mJobBar); + } + else + { + mJobBar = 0; + } + + mWeightBar = createBar(0, 140, 20, Theme::PROG_WEIGHT, + "weight bar", _("weight bar")); + + mInvSlotsBar = createBar(0, 45, 20, Theme::PROG_INVY_SLOTS, + "inventory slots bar", _("inventory slots bar")); + + mMoneyBar = createBar(0, 130, 20, Theme::PROG_INVY_SLOTS, + "money bar", _("money bar")); + + mArrowsBar = createBar(0, 50, 20, Theme::PROG_INVY_SLOTS, + "arrows bar", _("arrows bar")); + + mStatusBar = createBar(100, 150, 20, Theme::PROG_EXP, + "status bar", _("status bar")); + + loadBars(); + updateBars(); + + setVisible(config.getValueBool(getPopupName() + "Visible", true)); + + mStatusPopup = new StatusPopup(); + mTextPopup = new TextPopup(); + + addMouseListener(this); + Inventory *inv = PlayerInfo::getInventory(); + if (inv) + inv->addInventoyListener(this); + + StatusWindow::updateMoneyBar(mMoneyBar); + StatusWindow::updateArrowsBar(mArrowsBar); + updateStatus(); +} + +MiniStatusWindow::~MiniStatusWindow() +{ + delete mTextPopup; + mTextPopup = 0; + delete mStatusPopup; + mStatusPopup = 0; + delete_all(mIcons); + mIcons.clear(); + + Inventory *inv = PlayerInfo::getInventory(); + if (inv) + inv->removeInventoyListener(this); + + std::vector ::iterator it, it_end; + for (it = mBars.begin(), it_end = mBars.end(); it != it_end; ++it) + { + ProgressBar *bar = *it; + if (!bar) + continue; + if (!bar->isVisible()) + delete bar; + } +} + +ProgressBar *MiniStatusWindow::createBar(float progress, int width, int height, + int color, std::string name, + std::string description) +{ + ProgressBar *bar = new ProgressBar(progress, width, height, color); + bar->setActionEventId(name); + bar->setId(description); + mBars.push_back(bar); + mBarNames[name] = bar; + return bar; +} + +void MiniStatusWindow::updateBars() +{ + int x = 0; + std::vector ::iterator it, it_end; + ProgressBar* lastBar = 0; + for (it = mBars.begin(), it_end = mBars.end(); it != it_end; ++it) + safeRemove(*it); + for (it = mBars.begin(), it_end = mBars.end(); it != it_end; ++it) + { + ProgressBar *bar = *it; + if (!bar) + continue; + if (bar->isVisible()) + { + bar->setPosition(x, 3); + add(bar); + x += bar->getWidth() + 3; + lastBar = bar; + } + } + + if (lastBar) + { + setContentSize(lastBar->getX() + lastBar->getWidth(), + lastBar->getY() + lastBar->getHeight()); + } +} + +void MiniStatusWindow::setIcon(int index, AnimatedSprite *sprite) +{ + if (index >= static_cast(mIcons.size())) + mIcons.resize(index + 1, 0); + + delete mIcons[index]; + + mIcons[index] = sprite; +} + +void MiniStatusWindow::eraseIcon(int index) +{ + if (index < static_cast(mIcons.size())) + { + delete mIcons[index]; + mIcons.erase(mIcons.begin() + index); + } +} + +void MiniStatusWindow::drawIcons(Graphics *graphics) +{ + // Draw icons + int icon_x = mStatusBar->getX() + mStatusBar->getWidth() + 4; + for (unsigned int i = 0; i < mIcons.size(); i++) + { + if (mIcons[i]) + { + mIcons[i]->draw(graphics, icon_x, 3); + icon_x += 2 + mIcons[i]->getWidth(); + } + } +} + +void MiniStatusWindow::event(Mana::Channels channel A_UNUSED, + const Mana::Event &event) +{ + if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) + { + int id = event.getInt("id"); + if (id == HP || id == MAX_HP) + StatusWindow::updateHPBar(mHpBar); + else if (id == MP || id == MAX_MP) + StatusWindow::updateMPBar(mMpBar); + else if (id == EXP || id == EXP_NEEDED) + StatusWindow::updateXPBar(mXpBar); + else if (id == TOTAL_WEIGHT || id == MAX_WEIGHT) + StatusWindow::updateWeightBar(mWeightBar); + else if (id == MONEY) + StatusWindow::updateMoneyBar(mMoneyBar); + } + else if (event.getName() == Mana::EVENT_UPDATESTAT) + { + StatusWindow::updateMPBar(mMpBar); + StatusWindow::updateJobBar(mJobBar); + } +} + +void MiniStatusWindow::updateStatus() +{ + StatusWindow::updateStatusBar(mStatusBar); + if (mStatusPopup && mStatusPopup->isVisible()) + mStatusPopup->update(); +} + +void MiniStatusWindow::logic() +{ + Popup::logic(); + + for (unsigned int i = 0; i < mIcons.size(); i++) + { + if (mIcons[i]) + mIcons[i]->update(tick_time * 10); + } +} + +void MiniStatusWindow::draw(gcn::Graphics *graphics) +{ + drawChildren(graphics); +} + +void MiniStatusWindow::mouseMoved(gcn::MouseEvent &event) +{ + Popup::mouseMoved(event); + + const int x = event.getX(); + const int y = event.getY(); + + if (event.getSource() == mStatusBar) + { + mStatusPopup->view(x + getX(), y + getY()); + mTextPopup->hide(); + } + else if (event.getSource() == mXpBar) + { + if (PlayerInfo::getAttribute(EXP) + > PlayerInfo::getAttribute(EXP_NEEDED)) + { + mTextPopup->show(x + getX(), y + getY(), + event.getSource()->getId(), + strprintf("%u/%u", PlayerInfo::getAttribute(EXP), + PlayerInfo::getAttribute(EXP_NEEDED))); + } + else + { + mTextPopup->show(x + getX(), y + getY(), + event.getSource()->getId(), + strprintf("%u/%u", PlayerInfo::getAttribute(EXP), + PlayerInfo::getAttribute(EXP_NEEDED)), + strprintf("%s: %u", _("Need"), + PlayerInfo::getAttribute(EXP_NEEDED) + - PlayerInfo::getAttribute(EXP))); + } + mStatusPopup->hide(); + } + else if (event.getSource() == mHpBar) + { + mTextPopup->show(x + getX(), y + getY(), + event.getSource()->getId(), + strprintf("%u/%u", PlayerInfo::getAttribute(HP), + PlayerInfo::getAttribute(MAX_HP))); + mStatusPopup->hide(); + } + else if (event.getSource() == mMpBar) + { + mTextPopup->show(x + getX(), y + getY(), + event.getSource()->getId(), + strprintf("%u/%u", PlayerInfo::getAttribute(MP), + PlayerInfo::getAttribute(MAX_MP))); + mStatusPopup->hide(); + } + else if (event.getSource() == mJobBar) + { + std::pair exp = PlayerInfo::getStatExperience( + Net::getPlayerHandler()->getJobLocation()); + + if (exp.first > exp.second) + { + mTextPopup->show(x + getX(), y + getY(), + event.getSource()->getId(), + strprintf("%u/%u", exp.first, + exp.second)); + } + else + { + mTextPopup->show(x + getX(), y + getY(), + event.getSource()->getId(), + strprintf("%u/%u", exp.first, + exp.second), + strprintf("%s: %u", _("Need"), + exp.second + - exp.first)); + } + mStatusPopup->hide(); + } + else if (event.getSource() == mWeightBar) + { + mTextPopup->show(x + getX(), y + getY(), + event.getSource()->getId(), + strprintf("%u/%u", PlayerInfo::getAttribute(TOTAL_WEIGHT), + PlayerInfo::getAttribute(MAX_WEIGHT))); + mStatusPopup->hide(); + } + else if (event.getSource() == mInvSlotsBar) + { + Inventory *inv = PlayerInfo::getInventory(); + if (inv) + { + const int usedSlots = inv->getNumberOfSlotsUsed(); + const int maxSlots = inv->getSize(); + + mTextPopup->show(x + getX(), y + getY(), + event.getSource()->getId(), + strprintf("%u/%u", usedSlots, maxSlots)); + } + mStatusPopup->hide(); + } + else if (event.getSource() == mMoneyBar) + { + mTextPopup->show(x + getX(), y + getY(), + event.getSource()->getId(), + toString(PlayerInfo::getAttribute(MONEY))); + } + else + { + mTextPopup->hide(); + mStatusPopup->hide(); + } +} + +void MiniStatusWindow::mousePressed(gcn::MouseEvent &event) +{ + if (!viewport) + return; + + if (event.getButton() == gcn::MouseEvent::RIGHT) + { + ProgressBar *bar = dynamic_cast(event.getSource()); + if (!bar) + return; + if (viewport) + { + viewport->showPopup(getX() + event.getX(), + getY() + event.getY(), bar); + } + } +} + +void MiniStatusWindow::mouseExited(gcn::MouseEvent &event) +{ + Popup::mouseExited(event); + + mTextPopup->hide(); + mStatusPopup->hide(); +} + +void MiniStatusWindow::showBar(std::string name, bool isVisible) +{ + ProgressBar *bar = mBarNames[name]; + if (!bar) + return; + bar->setVisible(isVisible); + updateBars(); + saveBars(); +} + +void MiniStatusWindow::loadBars() +{ + if (!config.getValue("ministatussaved", 0)) + { + if (mWeightBar) + mWeightBar->setVisible(false); + if (mInvSlotsBar) + mInvSlotsBar->setVisible(false); + if (mMoneyBar) + mMoneyBar->setVisible(false); + if (mArrowsBar) + mArrowsBar->setVisible(false); + return; + } + + for (int f = 0; f < 10; f ++) + { + std::string str = config.getValue("ministatus" + toString(f), ""); + if (str == "" || str == "status bar") + continue; + ProgressBar *bar = mBarNames[str]; + if (!bar) + continue; + bar->setVisible(false); + } +} + +void MiniStatusWindow::saveBars() +{ + std::vector ::iterator it, it_end; + int i = 0; + for (it = mBars.begin(), it_end = mBars.end(); + it != it_end; ++it) + { + ProgressBar *bar = *it; + if (!bar->isVisible()) + { + config.setValue("ministatus" + toString(i), + bar->getActionEventId()); + i ++; + } + } + for (int f = i; f < 10; f ++) + config.deleteKey("ministatus" + toString(f)); + + config.setValue("ministatussaved", true); +} + +void MiniStatusWindow::slotsChanged(Inventory* inventory) +{ + if (!inventory) + return; + + if (inventory->getType() == Inventory::INVENTORY) + StatusWindow::updateInvSlotsBar(mInvSlotsBar); +} + +void MiniStatusWindow::updateArrows() +{ + StatusWindow::updateArrowsBar(mArrowsBar); +} diff --git a/src/gui/ministatuswindow.h b/src/gui/ministatuswindow.h new file mode 100644 index 000000000..19517326b --- /dev/null +++ b/src/gui/ministatuswindow.h @@ -0,0 +1,127 @@ +/* + * The ManaPlus Client + * Copyright (C) 2004-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef MINISTATUSWINDOW_H +#define MINISTATUSWINDOW_H + +#include "inventory.h" +#include "listener.h" + +#include "gui/widgets/popup.h" +#include "gui/widgets/window.h" + +#include + +#ifdef __GNUC__ +#define A_UNUSED __attribute__ ((unused)) +#else +#define A_UNUSED +#endif + +class AnimatedSprite; +class Graphics; +class ProgressBar; +class StatusPopup; +class TextPopup; + +/** + * The player mini-status dialog. + * + * \ingroup Interface + */ +class MiniStatusWindow : public Popup, + public InventoryListener, + public Mana::Listener +{ + public: + MiniStatusWindow(); + + ~MiniStatusWindow(); + + /** + * Sets one of the icons. + */ + void setIcon(int index, AnimatedSprite *sprite); + + void eraseIcon(int index); + + void drawIcons(Graphics *graphics); + + void event(Mana::Channels channel, const Mana::Event &event); + + void updateStatus(); + + void logic(); // Updates icons + + void draw(gcn::Graphics *graphics); + + void mouseMoved(gcn::MouseEvent &mouseEvent); + + void mousePressed(gcn::MouseEvent &event); + + void mouseExited(gcn::MouseEvent &event); + + void showBar(std::string name, bool isVisible); + + void updateBars(); + + void updateArrows(); + + void slotsChanged(Inventory* inventory); + + std::vector &getBars() + { return mBars; } + + private: + bool isInBar(ProgressBar *bar, int x, int y) const; + + ProgressBar *createBar(float progress, int width, int height, + int color, std::string name, + std::string description); + + void loadBars(); + + void saveBars(); + + /* + * Mini Status Bars + */ + ProgressBar *mHpBar; + ProgressBar *mMpBar; + ProgressBar *mXpBar; + ProgressBar *mJobBar; + ProgressBar *mWeightBar; + ProgressBar *mInvSlotsBar; + ProgressBar *mMoneyBar; + ProgressBar *mArrowsBar; + ProgressBar *mStatusBar; + TextPopup *mTextPopup; + StatusPopup *mStatusPopup; + std::vector mBars; + std::map mBarNames; + + std::vector mIcons; +}; + +extern MiniStatusWindow *miniStatusWindow; + +#endif diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 86ddfda53..c95864396 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -44,7 +44,7 @@ #include "gui/equipmentwindow.h" #include "gui/inventorywindow.h" #include "gui/itemamountwindow.h" -#include "gui/ministatus.h" +#include "gui/ministatuswindow.h" #include "gui/outfitwindow.h" #include "gui/selldialog.h" #include "gui/socialwindow.h" diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 2ca59f524..70d02b016 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -36,7 +36,7 @@ #include "gui/beingpopup.h" #include "gui/chatwindow.h" #include "gui/gui.h" -#include "gui/ministatus.h" +#include "gui/ministatuswindow.h" #include "gui/popupmenu.h" #include "gui/statuspopup.h" #include "gui/textpopup.h" diff --git a/src/localplayer.cpp b/src/localplayer.cpp index a9e9d1f21..9f0a7c5f3 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -46,7 +46,7 @@ #include "gui/gui.h" #include "gui/inventorywindow.h" #include "gui/killstats.h" -#include "gui/ministatus.h" +#include "gui/ministatuswindow.h" #include "gui/okdialog.h" #include "gui/outfitwindow.h" #include "gui/palette.h" diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index d921b5e2a..01000f8f1 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -26,7 +26,7 @@ #include "localplayer.h" #include "logger.h" -#include "gui/ministatus.h" +#include "gui/ministatuswindow.h" #include "net/messagein.h" -- cgit v1.2.3-70-g09d2 From 34e386d0c2d4ae844d50185f70bba945960bad62 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 15 Aug 2011 02:52:07 +0300 Subject: Add warp menu item for gms in navigation items. --- src/gui/popupmenu.cpp | 13 +++++++++++++ src/net/adminhandler.h | 1 + src/net/ea/adminhandler.cpp | 6 ++++++ src/net/ea/adminhandler.h | 2 ++ src/net/manaserv/adminhandler.cpp | 5 +++++ src/net/manaserv/adminhandler.h | 2 ++ 6 files changed, 29 insertions(+) (limited to 'src/net') diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index c95864396..a7c008684 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -502,6 +502,11 @@ void PopupMenu::showPopup(int x, int y, MapItem *mapItem) mBrowserBox->addRow(strprintf("@@rename map|%s@@", _("Rename"))); mBrowserBox->addRow(strprintf("@@remove map|%s@@", _("Remove"))); + if (player_node && player_node->isGM()) + { + mBrowserBox->addRow("##3---"); + mBrowserBox->addRow(strprintf("@@warp map|%s@@", _("Warp"))); + } mBrowserBox->addRow("##3---"); mBrowserBox->addRow(strprintf("@@cancel|%s@@", _("Cancel"))); @@ -1144,6 +1149,14 @@ void PopupMenu::handleLink(const std::string &link, if (chatWindow) chatWindow->clearTab(); } + else if (link == "warp map" && mMapItem) + { + if (Game::instance()) + { + Net::getAdminHandler()->warp(Game::instance()->getCurrentMapName(), + mMapItem->getX(), mMapItem->getY()); + } + } else if (link == "remove map" && mMapItem) { if (viewport) diff --git a/src/net/adminhandler.h b/src/net/adminhandler.h index 2d7eccebf..d063c4eb1 100644 --- a/src/net/adminhandler.h +++ b/src/net/adminhandler.h @@ -53,6 +53,7 @@ class AdminHandler virtual void mute(int playerId, int type, int limit) = 0; + virtual void warp(std::string map, int x, int y) = 0; // TODO }; diff --git a/src/net/ea/adminhandler.cpp b/src/net/ea/adminhandler.cpp index 5440d14d0..bdd43b3f8 100644 --- a/src/net/ea/adminhandler.cpp +++ b/src/net/ea/adminhandler.cpp @@ -63,4 +63,10 @@ void AdminHandler::mute(int playerId A_UNUSED, int type A_UNUSED, return; // Still looking into this } +void AdminHandler::warp(std::string map, int x, int y) +{ + Net::getChatHandler()->talk(strprintf( + "@warp %s %d %d", map.c_str(), x, y)); +} + } // namespace Ea diff --git a/src/net/ea/adminhandler.h b/src/net/ea/adminhandler.h index 6f77c0e18..fcf1e25b2 100644 --- a/src/net/ea/adminhandler.h +++ b/src/net/ea/adminhandler.h @@ -51,6 +51,8 @@ class AdminHandler : public Net::AdminHandler virtual void unban(const std::string &name); virtual void mute(int playerId, int type, int limit); + + virtual void warp(std::string map, int x, int y); }; } // namespace Ea diff --git a/src/net/manaserv/adminhandler.cpp b/src/net/manaserv/adminhandler.cpp index 72e7c7ca8..2c76e99a3 100644 --- a/src/net/manaserv/adminhandler.cpp +++ b/src/net/manaserv/adminhandler.cpp @@ -91,4 +91,9 @@ void AdminHandler::mute(int playerId A_UNUSED, int type A_UNUSED, // TODO } +void AdminHandler::warp(std::string map, int x, int y) +{ + // TODO +} + } // namespace ManaServ diff --git a/src/net/manaserv/adminhandler.h b/src/net/manaserv/adminhandler.h index a91841085..65e9ea2b0 100644 --- a/src/net/manaserv/adminhandler.h +++ b/src/net/manaserv/adminhandler.h @@ -58,6 +58,8 @@ class AdminHandler : public Net::AdminHandler void unban(const std::string &name); void mute(int playerId, int type, int limit); + + void warp(std::string map, int x, int y); }; } // namespace ManaServ -- cgit v1.2.3-70-g09d2 From 07c2eb8ffd62fe69f410cc045efc837441a6b6d4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 22 Aug 2011 00:42:03 +0300 Subject: Replace typo dont to don't. --- src/gui/popupmenu.cpp | 2 +- src/gui/statuswindow.cpp | 4 ++-- src/gui/widgets/button.cpp | 2 +- src/gui/widgets/scrollarea.cpp | 2 +- src/map.cpp | 2 +- src/net/tmwa/beinghandler.cpp | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/net') diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index eefa83500..61769bc7e 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -574,7 +574,7 @@ void PopupMenu::showChatPopup(int x, int y, ChatTab *tab) if (tab->getRemoveNames()) { mBrowserBox->addRow(strprintf("@@dont remove name|%s@@", - _("Dont remove name"))); + _("Don't remove name"))); } else { diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index fcc324730..a60707f4c 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -356,7 +356,7 @@ void StatusWindow::event(Mana::Channels channel A_UNUSED, if (!lvl) { - // possible server broken and dont send job level, + // possible server broken and don't send job level, // then we fixing it :) if (exp.second < 20000) { @@ -372,7 +372,7 @@ void StatusWindow::event(Mana::Channels channel A_UNUSED, } if (exp.first < oldExp && exp.second >= 20000) - { // possible job level up. but server broken and dont send + { // possible job level up. but server broken and don't send // new job exp limit, we fixing it lvl ++; blocked = true; diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 2d9678a53..41fbc1093 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -202,7 +202,7 @@ void Button::draw(gcn::Graphics *graphics) } else { - // because we dont know where parent windows was moved, + // because we don't know where parent windows was moved, // need recalc vertexes gcn::ClipRectangle &rect = static_cast( graphics)->getTopClip(); diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 08f0b5a70..03f5f8c4c 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -336,7 +336,7 @@ void ScrollArea::drawFrame(gcn::Graphics *graphics) } else { - // because we dont know where parent windows was moved, + // because we don't know where parent windows was moved, // need recalc vertexes gcn::ClipRectangle &rect = static_cast( graphics)->getTopClip(); diff --git a/src/map.cpp b/src/map.cpp index 700f6d0d2..721967b25 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -918,7 +918,7 @@ void Map::draw(Graphics *graphics, int scrollX, int scrollY) } } - // Dont draw if gui opacity == 1 + // Don't draw if gui opacity == 1 if (mBeingOpacity && mOpacity != 1.0f) { // Draws beings with a lower opacity to make them visible diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 17503a406..5016b2f8c 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -552,7 +552,7 @@ void BeingHandler::processPlayerMoveUpdate(Net::MessageIn &msg, int msgType) dstBeing->setTileCoords(srcX, srcY); dstBeing->setDestination(dstX, dstY); - // because server dont send direction in move packet, + // because server don't send direction in move packet, // we fixing it if (srcX != dstX || srcY != dstY) -- cgit v1.2.3-70-g09d2