From 0ad3a821e42471a052027419336df2132613e9f3 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 20 May 2014 12:47:50 +0300 Subject: Move character into separate file. --- src/CMakeLists.txt | 1 + src/Makefile.am | 1 + src/gui/widgets/characterdisplay.cpp | 2 ++ src/gui/windows/charselectdialog.cpp | 1 + src/net/character.h | 64 +++++++++++++++++++++++++++++++++++ src/net/charserverhandler.h | 24 +------------ src/net/ea/charserverhandler.cpp | 1 + src/net/eathena/charserverhandler.cpp | 1 + src/net/tmwa/charserverhandler.cpp | 1 + 9 files changed, 73 insertions(+), 23 deletions(-) create mode 100644 src/net/character.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b5e0e47b9..a7c41865e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -473,6 +473,7 @@ SET(SRCS gui/windows/worldselectdialog.cpp gui/windows/worldselectdialog.h net/adminhandler.h + net/character.h net/charserverhandler.cpp net/charserverhandler.h net/chathandler.h diff --git a/src/Makefile.am b/src/Makefile.am index 51af85cf9..00b56811a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -585,6 +585,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ net/adminhandler.h \ net/beinghandler.h \ net/buysellhandler.h \ + net/character.h \ net/charserverhandler.cpp \ net/charserverhandler.h \ net/chathandler.h \ diff --git a/src/gui/widgets/characterdisplay.cpp b/src/gui/widgets/characterdisplay.cpp index 6b21dac3b..b56d77f09 100644 --- a/src/gui/widgets/characterdisplay.cpp +++ b/src/gui/widgets/characterdisplay.cpp @@ -39,6 +39,8 @@ #include "utils/gettext.h" #include "utils/stringutils.h" +#include "net/character.h" + #include "debug.h" CharacterDisplay::CharacterDisplay(const Widget2 *const widget, diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp index 4ed5075a6..8dccde964 100644 --- a/src/gui/windows/charselectdialog.cpp +++ b/src/gui/windows/charselectdialog.cpp @@ -44,6 +44,7 @@ #include "gui/widgets/characterviewsmall.h" #include "gui/widgets/containerplacer.h" +#include "net/character.h" #include "net/logindata.h" #include "net/loginhandler.h" #include "net/net.h" diff --git a/src/net/character.h b/src/net/character.h new file mode 100644 index 000000000..89789335c --- /dev/null +++ b/src/net/character.h @@ -0,0 +1,64 @@ +/* + * The ManaPlus Client + * Copyright (C) 2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011-2014 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 NET_CHARACTER_H +#define NET_CHARACTER_H + +#include "utils/delete2.h" + +#include +#include + +class LocalPlayer; + +struct PlayerInfoBackend; + +namespace Net +{ + +/** + * A structure to hold information about a character. + */ +struct Character final +{ + Character() : + slot(0), + dummy(nullptr), + data() + { + } + + A_DELETE_COPY(Character) + + ~Character() + { + delete2(dummy); + } + + int slot; /**< The index in the list of characters */ + LocalPlayer *dummy; /**< A dummy representing this character */ + PlayerInfoBackend data; +}; + +} // namespace Net + +#endif // NET_CHARACTER_H diff --git a/src/net/charserverhandler.h b/src/net/charserverhandler.h index 095558cec..744ee685b 100644 --- a/src/net/charserverhandler.h +++ b/src/net/charserverhandler.h @@ -37,29 +37,7 @@ class CharSelectDialog; namespace Net { -/** - * A structure to hold information about a character. - */ -struct Character final -{ - Character() : - slot(0), - dummy(nullptr), - data() - { - } - - A_DELETE_COPY(Character) - - ~Character() - { - delete2(dummy); - } - - int slot; /**< The index in the list of characters */ - LocalPlayer *dummy; /**< A dummy representing this character */ - PlayerInfoBackend data; -}; +struct Character; typedef std::list Characters; diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp index 067d9119f..2f285269a 100644 --- a/src/net/ea/charserverhandler.cpp +++ b/src/net/ea/charserverhandler.cpp @@ -33,6 +33,7 @@ #include "net/ea/gamehandler.h" #include "net/ea/network.h" +#include "net/character.h" #include "net/messagein.h" #include "net/net.h" diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index fdcf2ed22..cd7496086 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -27,6 +27,7 @@ #include "being/attributes.h" +#include "net/character.h" #include "net/logindata.h" #include "net/net.h" diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index 7bd057231..47a55561e 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -27,6 +27,7 @@ #include "being/attributes.h" +#include "net/character.h" #include "net/logindata.h" #include "net/net.h" -- cgit v1.2.3-70-g09d2