From 599551a69be2872c3cf9916c7f9814af73b56203 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 6 Jan 2015 16:26:35 +0300 Subject: Move equip slots enum into separate file. --- src/CMakeLists.txt | 1 + src/Makefile.am | 1 + src/enums/equipslot.h | 59 ++++++++++++++++++++++++++++++++++++ src/equipment.h | 30 ++---------------- src/net/ea/inventoryhandler.cpp | 50 +++++++++++++++--------------- src/net/eathena/inventoryhandler.cpp | 36 +++++++++++----------- src/net/tmwa/inventoryhandler.cpp | 32 ++++++++++--------- 7 files changed, 125 insertions(+), 84 deletions(-) create mode 100644 src/enums/equipslot.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 791be1d14..9d17da0ba 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -884,6 +884,7 @@ SET(SRCS guild.h guildmanager.cpp guildmanager.h + enums/equipslot.h enums/guildpositionflags.h particle/imageparticle.cpp particle/imageparticle.h diff --git a/src/Makefile.am b/src/Makefile.am index c8cfa5c02..921299b8f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1008,6 +1008,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ guild.h \ guildmanager.cpp \ guildmanager.h \ + enums/equipslot.h \ enums/guildpositionflags.h \ particle/imageparticle.cpp \ particle/imageparticle.h \ diff --git a/src/enums/equipslot.h b/src/enums/equipslot.h new file mode 100644 index 000000000..8c6c5abbb --- /dev/null +++ b/src/enums/equipslot.h @@ -0,0 +1,59 @@ +/* + * 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 ENUMS_EQUIPSLOT_H +#define ENUMS_EQUIPSLOT_H + +#include "localconsts.h" + +namespace EquipSlot +{ + enum Type + { + TORSO_SLOT = 0, + GLOVES_SLOT = 1, + HEAD_SLOT = 2, + LEGS_SLOT = 3, + FEET_SLOT = 4, + RING1_SLOT = 5, + RING2_SLOT = 6, + NECK_SLOT = 7, + FIGHT1_SLOT = 8, + FIGHT2_SLOT = 9, + PROJECTILE_SLOT = 10, + EVOL_RING1_SLOT = 11, + EVOL_RING2_SLOT = 12, + COSTUME_ROBE_SLOT = 13, + MISSING1_SLOT = 14, + MISSING2_SLOT = 15, + SHADOW_ARMOR_SLOT = 16, + SHADOW_WEAPON_SLOT = 17, + SHADOW_SHIELD_SLOT = 18, + SHADOW_SHOES_SLOT = 19, + SHADOW_ACCESSORY1_SLOT = 20, + SHADOW_ACCESSORY2_SLOT = 21, + VECTOREND + }; +} + + +#endif // ENUMS_EQUIPSLOT_H diff --git a/src/equipment.h b/src/equipment.h index 12ade8c66..2de7ba33a 100644 --- a/src/equipment.h +++ b/src/equipment.h @@ -35,7 +35,8 @@ class Equipment final /** * Constructor. */ - Equipment(): mBackend(nullptr) + Equipment() : + mBackend(nullptr) { } A_DELETE_COPY(Equipment) @@ -46,33 +47,6 @@ class Equipment final ~Equipment() { mBackend = nullptr; } - enum Slot - { - EQUIP_TORSO_SLOT = 0, - EQUIP_GLOVES_SLOT = 1, - EQUIP_HEAD_SLOT = 2, - EQUIP_LEGS_SLOT = 3, - EQUIP_FEET_SLOT = 4, - EQUIP_RING1_SLOT = 5, - EQUIP_RING2_SLOT = 6, - EQUIP_NECK_SLOT = 7, - EQUIP_FIGHT1_SLOT = 8, - EQUIP_FIGHT2_SLOT = 9, - EQUIP_PROJECTILE_SLOT = 10, - EQUIP_EVOL_RING1_SLOT = 11, - EQUIP_EVOL_RING2_SLOT = 12, - EQUIP_COSTUME_ROBE_SLOT = 13, - EQUIP_MISSING1_SLOT = 14, - EQUIP_MISSING2_SLOT = 15, - EQUIP_SHADOW_ARMOR_SLOT = 16, - EQUIP_SHADOW_WEAPON_SLOT = 17, - EQUIP_SHADOW_SHIELD_SLOT = 18, - EQUIP_SHADOW_SHOES_SLOT = 19, - EQUIP_SHADOW_ACCESSORY1_SLOT = 20, - EQUIP_SHADOW_ACCESSORY2_SLOT = 21, - EQUIP_VECTOREND - }; - class Backend notfinal { public: diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp index 4d6448202..3443e6ce7 100644 --- a/src/net/ea/inventoryhandler.cpp +++ b/src/net/ea/inventoryhandler.cpp @@ -24,6 +24,8 @@ #include "notifymanager.h" +#include "enums/equipslot.h" + #include "being/attributes.h" #include "being/localplayer.h" @@ -39,30 +41,30 @@ #include "debug.h" -const Equipment::Slot EQUIP_POINTS[Equipment::EQUIP_VECTOREND] = +const EquipSlot::Type EQUIP_POINTS[EquipSlot::VECTOREND] = { - Equipment::EQUIP_LEGS_SLOT, // Lower Headgear - Equipment::EQUIP_FIGHT1_SLOT, // Weapon - Equipment::EQUIP_GLOVES_SLOT, // Garment - Equipment::EQUIP_RING2_SLOT, // Accessory 1 - Equipment::EQUIP_RING1_SLOT, // Armor - Equipment::EQUIP_FIGHT2_SLOT, // Shield - Equipment::EQUIP_FEET_SLOT, // Footgear - Equipment::EQUIP_NECK_SLOT, // Accessory 2 - Equipment::EQUIP_HEAD_SLOT, // Upper Headgear - Equipment::EQUIP_TORSO_SLOT, // Middle Headgear - Equipment::EQUIP_EVOL_RING1_SLOT, // Costume Top Headgear - Equipment::EQUIP_EVOL_RING2_SLOT, // Costume Mid Headgear - Equipment::EQUIP_PROJECTILE_SLOT, // Costume Low Headgear - Equipment::EQUIP_COSTUME_ROBE_SLOT, // Costume Garment/Robe - Equipment::EQUIP_MISSING1_SLOT, // Missing slot 1 - Equipment::EQUIP_MISSING2_SLOT, // Missing slot 2 - Equipment::EQUIP_SHADOW_ARMOR_SLOT, // Shadow Armor - Equipment::EQUIP_SHADOW_WEAPON_SLOT, // Shadow Weapon - Equipment::EQUIP_SHADOW_SHIELD_SLOT, // Shadow Shield - Equipment::EQUIP_SHADOW_SHOES_SLOT, // Shadow Shoes - Equipment::EQUIP_SHADOW_ACCESSORY2_SLOT, // Shadow Accessory 2 - Equipment::EQUIP_SHADOW_ACCESSORY1_SLOT, // Shadow Accessory 1 + EquipSlot::LEGS_SLOT, // Lower Headgear + EquipSlot::FIGHT1_SLOT, // Weapon + EquipSlot::GLOVES_SLOT, // Garment + EquipSlot::RING2_SLOT, // Accessory 1 + EquipSlot::RING1_SLOT, // Armor + EquipSlot::FIGHT2_SLOT, // Shield + EquipSlot::FEET_SLOT, // Footgear + EquipSlot::NECK_SLOT, // Accessory 2 + EquipSlot::HEAD_SLOT, // Upper Headgear + EquipSlot::TORSO_SLOT, // Middle Headgear + EquipSlot::EVOL_RING1_SLOT, // Costume Top Headgear + EquipSlot::EVOL_RING2_SLOT, // Costume Mid Headgear + EquipSlot::PROJECTILE_SLOT, // Costume Low Headgear + EquipSlot::COSTUME_ROBE_SLOT, // Costume Garment/Robe + EquipSlot::MISSING1_SLOT, // Missing slot 1 + EquipSlot::MISSING2_SLOT, // Missing slot 2 + EquipSlot::SHADOW_ARMOR_SLOT, // Shadow Armor + EquipSlot::SHADOW_WEAPON_SLOT, // Shadow Weapon + EquipSlot::SHADOW_SHIELD_SLOT, // Shadow Shield + EquipSlot::SHADOW_SHOES_SLOT, // Shadow Shoes + EquipSlot::SHADOW_ACCESSORY2_SLOT, // Shadow Accessory 2 + EquipSlot::SHADOW_ACCESSORY1_SLOT, // Shadow Accessory 1 }; namespace Ea @@ -143,7 +145,7 @@ size_t InventoryHandler::getSize(const int type) const int InventoryHandler::getSlot(const int eAthenaSlot) { if (eAthenaSlot == 0) - return Equipment::EQUIP_VECTOREND; + return EquipSlot::VECTOREND; if (eAthenaSlot & 0x8000) return inventoryHandler->getProjectileSlot(); diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp index 4f0f833b0..f628073f0 100644 --- a/src/net/eathena/inventoryhandler.cpp +++ b/src/net/eathena/inventoryhandler.cpp @@ -24,6 +24,8 @@ #include "notifymanager.h" +#include "enums/equipslot.h" + #include "being/localplayer.h" #include "listeners/arrowslistener.h" @@ -42,24 +44,24 @@ extern Net::InventoryHandler *inventoryHandler; // missing EQUIP_RING1_SLOT -const Equipment::Slot EQUIP_CONVERT[] = +const EquipSlot::Type EQUIP_CONVERT[] = { - Equipment::EQUIP_PROJECTILE_SLOT, // 0 0 - Equipment::EQUIP_FEET_SLOT, // 1 SPRITE_HAIR - Equipment::EQUIP_LEGS_SLOT, // 2 SPRITE_WEAPON - Equipment::EQUIP_TORSO_SLOT, // 3 SPRITE_HEAD_BOTTOM - Equipment::EQUIP_GLOVES_SLOT, // 4 0 - Equipment::EQUIP_EVOL_RING1_SLOT, // 5 - Equipment::EQUIP_PROJECTILE_SLOT, // 6 0 - Equipment::EQUIP_HEAD_SLOT, // 7 SPRITE_CLOTHES_COLOR - Equipment::EQUIP_RING2_SLOT, // 8 0 - Equipment::EQUIP_PROJECTILE_SLOT, // 9 SPRITE_SHOES - Equipment::EQUIP_FIGHT1_SLOT, // 10 SPRITE_BODY - Equipment::EQUIP_FIGHT2_SLOT, // 11 SPRITE_FLOOR - Equipment::EQUIP_EVOL_RING2_SLOT, // 12 - Equipment::EQUIP_PROJECTILE_SLOT, // 13 SPRITE_EVOL2 - Equipment::EQUIP_COSTUME_ROBE_SLOT, // 14 SPRITE_EVOL3 - Equipment::EQUIP_RING1_SLOT, // 15 SPRITE_EVOL4 + EquipSlot::PROJECTILE_SLOT, // 0 0 + EquipSlot::FEET_SLOT, // 1 SPRITE_HAIR + EquipSlot::LEGS_SLOT, // 2 SPRITE_WEAPON + EquipSlot::TORSO_SLOT, // 3 SPRITE_HEAD_BOTTOM + EquipSlot::GLOVES_SLOT, // 4 0 + EquipSlot::EVOL_RING1_SLOT, // 5 + EquipSlot::PROJECTILE_SLOT, // 6 0 + EquipSlot::HEAD_SLOT, // 7 SPRITE_CLOTHES_COLOR + EquipSlot::RING2_SLOT, // 8 0 + EquipSlot::PROJECTILE_SLOT, // 9 SPRITE_SHOES + EquipSlot::FIGHT1_SLOT, // 10 SPRITE_BODY + EquipSlot::FIGHT2_SLOT, // 11 SPRITE_FLOOR + EquipSlot::EVOL_RING2_SLOT, // 12 + EquipSlot::PROJECTILE_SLOT, // 13 SPRITE_EVOL2 + EquipSlot::COSTUME_ROBE_SLOT, // 14 SPRITE_EVOL3 + EquipSlot::RING1_SLOT, // 15 SPRITE_EVOL4 }; namespace EAthena diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 0e855430a..8fa8a497e 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -24,6 +24,8 @@ #include "notifymanager.h" +#include "enums/equipslot.h" + #include "being/localplayer.h" #include "listeners/arrowslistener.h" @@ -42,22 +44,22 @@ extern Net::InventoryHandler *inventoryHandler; // missing EQUIP_RING1_SLOT -const Equipment::Slot EQUIP_CONVERT[] = +const EquipSlot::Type EQUIP_CONVERT[] = { - Equipment::EQUIP_PROJECTILE_SLOT, // 0 0 - Equipment::EQUIP_FEET_SLOT, // 1 SPRITE_HAIR - Equipment::EQUIP_LEGS_SLOT, // 2 SPRITE_WEAPON - Equipment::EQUIP_TORSO_SLOT, // 3 SPRITE_HEAD_BOTTOM - Equipment::EQUIP_PROJECTILE_SLOT, // 4 0 - Equipment::EQUIP_NECK_SLOT, // 5 SPRITE_RING - Equipment::EQUIP_PROJECTILE_SLOT, // 6 0 - Equipment::EQUIP_HEAD_SLOT, // 7 SPRITE_CLOTHES_COLOR - Equipment::EQUIP_RING2_SLOT, // 8 0 - Equipment::EQUIP_GLOVES_SLOT, // 9 SPRITE_SHOES - Equipment::EQUIP_FIGHT1_SLOT, // 10 SPRITE_BODY - Equipment::EQUIP_FIGHT2_SLOT, // 11 SPRITE_FLOOR - Equipment::EQUIP_EVOL_RING1_SLOT, // 12 SPRITE_ROBE - Equipment::EQUIP_EVOL_RING2_SLOT, // 13 SPRITE_EVOL2 + EquipSlot::PROJECTILE_SLOT, // 0 0 + EquipSlot::FEET_SLOT, // 1 SPRITE_HAIR + EquipSlot::LEGS_SLOT, // 2 SPRITE_WEAPON + EquipSlot::TORSO_SLOT, // 3 SPRITE_HEAD_BOTTOM + EquipSlot::PROJECTILE_SLOT, // 4 0 + EquipSlot::NECK_SLOT, // 5 SPRITE_RING + EquipSlot::PROJECTILE_SLOT, // 6 0 + EquipSlot::HEAD_SLOT, // 7 SPRITE_CLOTHES_COLOR + EquipSlot::RING2_SLOT, // 8 0 + EquipSlot::GLOVES_SLOT, // 9 SPRITE_SHOES + EquipSlot::FIGHT1_SLOT, // 10 SPRITE_BODY + EquipSlot::FIGHT2_SLOT, // 11 SPRITE_FLOOR + EquipSlot::EVOL_RING1_SLOT, // 12 SPRITE_ROBE + EquipSlot::EVOL_RING2_SLOT, // 13 SPRITE_EVOL2 }; namespace TmwAthena -- cgit v1.2.3-60-g2f50