From 261b8ab980d442d0cf1b06df244388d65f431301 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 12 May 2014 17:49:41 +0300 Subject: Move beingspeech into separate file. --- src/CMakeLists.txt | 1 + src/Makefile.am | 1 + src/being/being.cpp | 13 +++++++------ src/being/being.h | 8 -------- src/being/beingspeech.h | 37 +++++++++++++++++++++++++++++++++++++ src/client.cpp | 5 +++-- src/defaults.cpp | 4 ++-- 7 files changed, 51 insertions(+), 18 deletions(-) create mode 100644 src/being/beingspeech.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d98772322..bcc8dae34 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -626,6 +626,7 @@ SET(SRCS being/beingcacheentry.h being/beingdirection.h being/beingflag.h + being/beingspeech.h beingequipbackend.cpp beingequipbackend.h spellmanager.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 5e6b6db6e..89cfedc5f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -715,6 +715,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ being/beingcacheentry.h \ being/beingdirection.h \ being/beingflag.h \ + being/beingspeech.h \ beingequipbackend.cpp \ beingequipbackend.h \ spellmanager.cpp \ diff --git a/src/being/being.cpp b/src/being/being.cpp index 0e06d45fd..8db08bb68 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -35,6 +35,7 @@ #include "being/attributes.h" #include "being/beingcacheentry.h" +#include "being/beingspeech.h" #include "being/playerrelations.h" #include "particle/particle.h" @@ -463,7 +464,7 @@ void Being::setSpeech(const std::string &text, const std::string &channel, } const int speech = mSpeechType; - if (speech == TEXT_OVERHEAD && userPalette) + if (speech == BeingSpeech::TEXT_OVERHEAD && userPalette) { delete mText; mText = new Text(mSpeech, @@ -474,7 +475,7 @@ void Being::setSpeech(const std::string &text, const std::string &channel, } else { - const bool isShowName = (speech == NAME_IN_BUBBLE); + const bool isShowName = (speech == BeingSpeech::NAME_IN_BUBBLE); mSpeechBubble->setCaption(isShowName ? mName : ""); mSpeechBubble->setText(mSpeech, isShowName); } @@ -1674,8 +1675,8 @@ void Being::drawSpeech(const int offsetX, const int offsetY) if (mSpeechBubble->isVisibleLocal()) mSpeechBubble->setVisible(false); } - else if (mSpeechTime > 0 && (speech == NAME_IN_BUBBLE || - speech == NO_NAME_IN_BUBBLE)) + else if (mSpeechTime > 0 && (speech == BeingSpeech::NAME_IN_BUBBLE || + speech == BeingSpeech::NO_NAME_IN_BUBBLE)) { delete2(mText) @@ -1684,7 +1685,7 @@ void Being::drawSpeech(const int offsetX, const int offsetY) mSpeechBubble->setVisible(true); mSpeechBubble->requestMoveToBackground(); } - else if (mSpeechTime > 0 && speech == TEXT_OVERHEAD) + else if (mSpeechTime > 0 && speech == BeingSpeech::TEXT_OVERHEAD) { mSpeechBubble->setVisible(false); @@ -1695,7 +1696,7 @@ void Being::drawSpeech(const int offsetX, const int offsetY) Theme::BUBBLE_TEXT, 255), true); } } - else if (speech == NO_SPEECH) + else if (speech == BeingSpeech::NO_SPEECH) { mSpeechBubble->setVisible(false); delete2(mText) diff --git a/src/being/being.h b/src/being/being.h index 4de35303f..aec735215 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -101,14 +101,6 @@ class Being : public ActorSprite, public ConfigListener SPAWN }; - enum Speech - { - NO_SPEECH = 0, - TEXT_OVERHEAD, - NO_NAME_IN_BUBBLE, - NAME_IN_BUBBLE - }; - enum AttackType { HIT = 0x00, diff --git a/src/being/beingspeech.h b/src/being/beingspeech.h new file mode 100644 index 000000000..7deb2ebdf --- /dev/null +++ b/src/being/beingspeech.h @@ -0,0 +1,37 @@ +/* + * The ManaPlus Client + * Copyright (C) 2004-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 BEING_BEINGSPEECH_H +#define BEING_BEINGSPEECH_H + +namespace BeingSpeech +{ + enum + { + NO_SPEECH = 0, + TEXT_OVERHEAD, + NO_NAME_IN_BUBBLE, + NAME_IN_BUBBLE + }; +} // BeingSpeech + +#endif // BEING_BEINGSPEECH_H diff --git a/src/client.cpp b/src/client.cpp index 1a6863a6d..f3d8371f4 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -42,6 +42,7 @@ #include "units.h" #include "touchmanager.h" +#include "being/beingspeech.h" #include "being/playerrelations.h" #include "input/inputmanager.h" @@ -2936,10 +2937,10 @@ void Client::checkConfigVersion() } if (version < 5) { - if (config.getIntValue("speech") == Being::TEXT_OVERHEAD) + if (config.getIntValue("speech") == BeingSpeech::TEXT_OVERHEAD) { config.setValue("speech", static_cast( - Being::NO_NAME_IN_BUBBLE)); + BeingSpeech::NO_NAME_IN_BUBBLE)); } } if (version < 6) diff --git a/src/defaults.cpp b/src/defaults.cpp index 8d170ab72..a215730c4 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -24,7 +24,7 @@ #include "graphicsmanager.h" #include "variabledata.h" -#include "being/being.h" +#include "being/beingspeech.h" #include "input/keydata.h" @@ -79,7 +79,7 @@ DefaultsData* getConfigDefaults() AddDEF("speechBubbleAlpha", 1.0F); AddDEF("MostUsedServerName0", "server.themanaworld.org"); AddDEF("visiblenames", true); - AddDEF("speech", static_cast(Being::NO_NAME_IN_BUBBLE)); + AddDEF("speech", static_cast(BeingSpeech::NO_NAME_IN_BUBBLE)); AddDEF("showgender", true); AddDEF("showlevel", false); AddDEF("showMonstersTakedDamage", true); -- cgit v1.2.3-60-g2f50