From ac3ccda23ac4b5c69e15147b8082d90df2ac23de Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 13 Dec 2015 22:45:52 +0300 Subject: Move spells and graphics related constants into separate files. --- src/CMakeLists.txt | 2 ++ src/Makefile.am | 3 ++- src/actions/actions.cpp | 2 ++ src/being/actorsprite.cpp | 2 ++ src/being/being.cpp | 4 ++++ src/being/being.h | 7 ------- src/being/playerrelations.cpp | 2 ++ src/client.cpp | 1 + src/const/render/graphics.h | 31 +++++++++++++++++++++++++++++ src/const/spells.h | 32 ++++++++++++++++++++++++++++++ src/defaults.cpp | 2 ++ src/dyetool/gui/viewport.h | 3 --- src/game.cpp | 2 ++ src/gui/popups/popupmenu.cpp | 2 ++ src/gui/viewport.h | 3 --- src/gui/widgets/itemshortcutcontainer.cpp | 3 +++ src/gui/widgets/spellshortcutcontainer.cpp | 3 +++ src/gui/windowmanager.cpp | 1 + src/gui/windows/chatwindow.cpp | 1 + src/itemshortcut.cpp | 2 ++ src/render/graphics.h | 3 --- src/resources/ambientlayer.cpp | 2 ++ src/spellmanager.cpp | 2 ++ src/spellmanager.h | 4 ---- src/spellshortcut.cpp | 4 ++++ src/spellshortcut.h | 5 +---- 26 files changed, 103 insertions(+), 25 deletions(-) create mode 100644 src/const/render/graphics.h create mode 100644 src/const/spells.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3c6346036..86f918062 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -909,6 +909,8 @@ SET(SRCS game.h gamemodifiers.cpp gamemodifiers.h + const/spells.h + const/render/graphics.h render/graphics.cpp render/graphics.h graphicsmanager.cpp diff --git a/src/Makefile.am b/src/Makefile.am index e9a7818ce..8304e97b5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -109,7 +109,6 @@ SRC += events/actionevent.h \ listeners/guitableactionlistener.h \ listeners/tooltiplistener.cpp \ listeners/tooltiplistener.h \ - render/graphics.h \ events/inputguievent.h \ input/key.h \ events/keyevent.h \ @@ -472,6 +471,8 @@ SRC += events/actionevent.h \ dirs.h \ eventsmanager.cpp \ eventsmanager.h \ + const/spells.h \ + const/render/graphics.h \ render/graphics.cpp \ render/graphics.h \ graphicsmanager.cpp \ diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index 465200a5b..a1f19eb32 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -36,6 +36,8 @@ #include "being/localplayer.h" #include "being/playerinfo.h" +#include "const/spells.h" + #include "gui/gui.h" #include "gui/popupmanager.h" #include "gui/sdlinput.h" diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp index 11099af01..122f4ecac 100644 --- a/src/being/actorsprite.cpp +++ b/src/being/actorsprite.cpp @@ -54,6 +54,8 @@ #define end_foreach } +static const unsigned int STATUS_EFFECTS = 32; + AnimatedSprite *ActorSprite::targetCursor [static_cast(TargetCursorType::NUM_TCT)] [static_cast(TargetCursorSize::NUM_TC)]; diff --git a/src/being/being.cpp b/src/being/being.cpp index ae0491372..69af6bd9f 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -126,6 +126,10 @@ std::list beingInfoCache; typedef std::map::const_iterator GuildsMapCIter; typedef std::map::const_iterator IntMapCIter; +static const unsigned int SPEECH_TIME = 500; +static const unsigned int SPEECH_MIN_TIME = 200; +static const unsigned int SPEECH_MAX_TIME = 800; + #define for_each_badges() \ for (int f = 0; f < BadgeIndex::BadgeIndexSize; f++) diff --git a/src/being/being.h b/src/being/being.h index bab1cc254..0f094c908 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -44,13 +44,6 @@ #include "localconsts.h" -static const unsigned int FIRST_IGNORE_EMOTE = 14; -static const unsigned int STATUS_EFFECTS = 32; - -static const unsigned int SPEECH_TIME = 500; -static const unsigned int SPEECH_MIN_TIME = 200; -static const unsigned int SPEECH_MAX_TIME = 800; - static const int DEFAULT_BEING_WIDTH = 32; static const int DEFAULT_BEING_HEIGHT = 32; diff --git a/src/being/playerrelations.cpp b/src/being/playerrelations.cpp index 4bd7b637e..3c5dd2d06 100644 --- a/src/being/playerrelations.cpp +++ b/src/being/playerrelations.cpp @@ -37,6 +37,8 @@ #include "debug.h" +static const unsigned int FIRST_IGNORE_EMOTE = 14; + typedef std::map PlayerRelations; typedef PlayerRelations::const_iterator PlayerRelationsCIter; typedef std::list PlayerRelationListeners; diff --git a/src/client.cpp b/src/client.cpp index 1eb5363a3..d97ae9742 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -34,6 +34,7 @@ #include "party.h" #include "settings.h" #include "soundmanager.h" +#include "spellmanager.h" #include "spellshortcut.h" #include "statuseffect.h" #include "units.h" diff --git a/src/const/render/graphics.h b/src/const/render/graphics.h new file mode 100644 index 000000000..abafd00cc --- /dev/null +++ b/src/const/render/graphics.h @@ -0,0 +1,31 @@ +/* + * The ManaPlus Client + * Copyright (C) 2004-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011-2015 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 CONST_RENDER_GRAPHICS_H +#define CONST_RENDER_GRAPHICS_H + +#include "localconsts.h" + +static const int defaultScreenWidth = 800; +static const int defaultScreenHeight = 600; + +#endif // CONST_RENDER_GRAPHICS_H diff --git a/src/const/spells.h b/src/const/spells.h new file mode 100644 index 000000000..3f75fbe5d --- /dev/null +++ b/src/const/spells.h @@ -0,0 +1,32 @@ +/* + * The ManaPlus Client + * Copyright (C) 2009-2010 Andrei Karas + * Copyright (C) 2011-2015 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 CONST_SPELLMINID_H +#define CONST_SPELLMINID_H + +#include "localconsts.h" + +const int SPELL_MIN_ID = 100000; +const unsigned int SPELL_SHORTCUT_ITEMS = 49; +const unsigned int SPELL_SHORTCUT_TABS = 5; +const unsigned int SPELLS_SIZE = SPELL_SHORTCUT_ITEMS * SPELL_SHORTCUT_TABS; + +#endif // CONST_SPELLMINID_H diff --git a/src/defaults.cpp b/src/defaults.cpp index 16cab02a6..2dce71236 100644 --- a/src/defaults.cpp +++ b/src/defaults.cpp @@ -26,6 +26,8 @@ #include "being/beingspeech.h" +#include "const/render/graphics.h" + #include "enums/screendensity.h" #include "enums/input/inputaction.h" diff --git a/src/dyetool/gui/viewport.h b/src/dyetool/gui/viewport.h index f3b042bd3..4f7ef58e2 100644 --- a/src/dyetool/gui/viewport.h +++ b/src/dyetool/gui/viewport.h @@ -36,9 +36,6 @@ class Graphics; class Map; class MapItem; -/** Delay between two mouse calls when dragging mouse and move the player */ -const int walkingMouseDelay = 500; - /** * The viewport on the map. Displays the current map and handles mouse input * and the popup menu. diff --git a/src/game.cpp b/src/game.cpp index 29c35a6dc..94bb4a8fd 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -41,6 +41,8 @@ #include "being/localplayer.h" #include "being/playerinfo.h" +#include "const/spells.h" + #include "enums/being/beingdirection.h" #include "particle/particle.h" diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 10712d354..cc1cf0726 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -34,6 +34,8 @@ #include "being/playerrelation.h" #include "being/playerrelations.h" +#include "const/spells.h" + #include "enums/resources/map/mapitemtype.h" #include "input/inputmanager.h" diff --git a/src/gui/viewport.h b/src/gui/viewport.h index 61fb87c02..a3434b00d 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -43,9 +43,6 @@ class Graphics; class Map; class MapItem; -/** Delay between two mouse calls when dragging mouse and move the player */ -const int walkingMouseDelay = 500; - /** * The viewport on the map. Displays the current map and handles mouse input * and the popup menu. diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index e1f6bafee..4e14fa8c5 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -25,10 +25,13 @@ #include "dragdrop.h" #include "itemshortcut.h" #include "settings.h" +#include "spellmanager.h" #include "spellshortcut.h" #include "being/playerinfo.h" +#include "const/spells.h" + #include "input/inputmanager.h" #include "gui/viewport.h" diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 5a3a568f8..c5ef083b0 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -25,8 +25,11 @@ #include "dragdrop.h" #include "itemshortcut.h" #include "settings.h" +#include "spellmanager.h" #include "spellshortcut.h" +#include "const/spells.h" + #include "gui/viewport.h" #include "gui/fonts/font.h" diff --git a/src/gui/windowmanager.cpp b/src/gui/windowmanager.cpp index 72cc677e8..4be7c3600 100644 --- a/src/gui/windowmanager.cpp +++ b/src/gui/windowmanager.cpp @@ -26,6 +26,7 @@ #include "configuration.h" #include "game.h" #include "settings.h" +#include "spellmanager.h" #include "spellshortcut.h" #include "touchmanager.h" diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 713db36fa..c08454623 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -27,6 +27,7 @@ #include "guild.h" #include "party.h" #include "settings.h" +#include "spellmanager.h" #include "spellshortcut.h" #include "being/localplayer.h" diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp index 7c980ad02..5d11ae148 100644 --- a/src/itemshortcut.cpp +++ b/src/itemshortcut.cpp @@ -29,6 +29,8 @@ #include "being/playerinfo.h" +#include "const/spells.h" + #include "gui/windows/skilldialog.h" #include "resources/skillconsts.h" diff --git a/src/render/graphics.h b/src/render/graphics.h index 3989f0b16..6b4b224aa 100644 --- a/src/render/graphics.h +++ b/src/render/graphics.h @@ -99,9 +99,6 @@ class ImageVertexes; struct SDL_Window; -static const int defaultScreenWidth = 800; -static const int defaultScreenHeight = 600; - /** * A central point of control for graphics. */ diff --git a/src/resources/ambientlayer.cpp b/src/resources/ambientlayer.cpp index e03068a2b..5b215ff87 100644 --- a/src/resources/ambientlayer.cpp +++ b/src/resources/ambientlayer.cpp @@ -21,6 +21,8 @@ #include "resources/ambientlayer.h" +#include "const/render/graphics.h" + #include "render/graphics.h" #include "resources/image.h" diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp index 50530e059..88c28f0e6 100644 --- a/src/spellmanager.cpp +++ b/src/spellmanager.cpp @@ -27,6 +27,8 @@ #include "being/localplayer.h" #include "being/playerinfo.h" +#include "const/spells.h" + #include "gui/windows/chatwindow.h" #include "net/playerhandler.h" diff --git a/src/spellmanager.h b/src/spellmanager.h index b80ff77cc..eb0396aaa 100644 --- a/src/spellmanager.h +++ b/src/spellmanager.h @@ -27,10 +27,6 @@ #include "being/being.h" -const int SPELL_MIN_ID = 100000; -const unsigned int SPELL_SHORTCUT_ITEMS = 49; -const unsigned int SPELL_SHORTCUT_TABS = 5; - class SpellManager final { public: diff --git a/src/spellshortcut.cpp b/src/spellshortcut.cpp index 4330b395f..c0afd2b20 100644 --- a/src/spellshortcut.cpp +++ b/src/spellshortcut.cpp @@ -22,6 +22,10 @@ #include "spellshortcut.h" +#include "spellmanager.h" + +#include "const/spells.h" + #include "debug.h" SpellShortcut *spellShortcut = nullptr; diff --git a/src/spellshortcut.h b/src/spellshortcut.h index fc567bea3..88d2541ef 100644 --- a/src/spellshortcut.h +++ b/src/spellshortcut.h @@ -23,9 +23,7 @@ #ifndef SPELLSHORTCUT_H #define SPELLSHORTCUT_H -#include "spellmanager.h" - -const unsigned int SPELLS_SIZE = SPELL_SHORTCUT_ITEMS * SPELL_SHORTCUT_TABS; +#include "const/spells.h" /** * The class which keeps track of the item shortcuts. @@ -86,6 +84,5 @@ class SpellShortcut final }; extern SpellShortcut *spellShortcut; -extern SpellManager *spellManager; #endif // SPELLSHORTCUT_H -- cgit v1.2.3-60-g2f50