summaryrefslogtreecommitdiff
path: root/src/mmo
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2015-01-10 17:32:49 -0800
committerBen Longbons <b.r.longbons@gmail.com>2015-01-23 01:57:20 -0800
commitb3112bd3f6d0887fdf81610327c9edad08a0cfaf (patch)
treee1b1099468399a3b22852a5947a3cac47da904ca /src/mmo
parentc482e420bcf447073ffe3ff8a106a0561e0baadd (diff)
downloadtmwa-b3112bd3f6d0887fdf81610327c9edad08a0cfaf.tar.gz
tmwa-b3112bd3f6d0887fdf81610327c9edad08a0cfaf.tar.bz2
tmwa-b3112bd3f6d0887fdf81610327c9edad08a0cfaf.tar.xz
tmwa-b3112bd3f6d0887fdf81610327c9edad08a0cfaf.zip
Use generated config for map
Diffstat (limited to 'src/mmo')
-rw-r--r--src/mmo/consts.hpp7
-rw-r--r--src/mmo/cxxstdio_enums.hpp49
-rw-r--r--src/mmo/extract_enums.hpp26
-rw-r--r--src/mmo/strs.cpp32
4 files changed, 86 insertions, 28 deletions
diff --git a/src/mmo/consts.hpp b/src/mmo/consts.hpp
index c1a7eb6..5533446 100644
--- a/src/mmo/consts.hpp
+++ b/src/mmo/consts.hpp
@@ -54,6 +54,11 @@ constexpr int MAX_PARTY = 12;
#define MIN_CLOTH_COLOR battle_config.min_cloth_color
#define MAX_CLOTH_COLOR battle_config.max_cloth_color
+namespace map
+{
+ struct map_session_data;
+}
+
// WTF is this doing here?
struct PartyMember
{
@@ -61,6 +66,6 @@ struct PartyMember
CharName name;
MapName map;
int leader, online, lv;
- struct map_session_data *sd;
+ map::map_session_data *sd;
};
} // namespace tmwa
diff --git a/src/mmo/cxxstdio_enums.hpp b/src/mmo/cxxstdio_enums.hpp
index 6f428e8..28a8a14 100644
--- a/src/mmo/cxxstdio_enums.hpp
+++ b/src/mmo/cxxstdio_enums.hpp
@@ -29,49 +29,58 @@ namespace tmwa
{
namespace e
{
-enum class BF : uint16_t;
enum class EPOS : uint16_t;
-enum class MapCell : uint8_t;
enum class Opt0 : uint16_t;
inline
-auto decay_for_printf(BF v) -> typename remove_enum<decltype(v)>::type { return typename remove_enum<decltype(v)>::type(v); }
-inline
auto decay_for_printf(EPOS v) -> typename remove_enum<decltype(v)>::type { return typename remove_enum<decltype(v)>::type(v); }
inline
-auto decay_for_printf(MapCell v) -> typename remove_enum<decltype(v)>::type { return typename remove_enum<decltype(v)>::type(v); }
-inline
auto decay_for_printf(Opt0 v) -> typename remove_enum<decltype(v)>::type { return typename remove_enum<decltype(v)>::type(v); }
-}
+} // namespace e
+
+enum class ItemLook : uint16_t;
+enum class SP : uint16_t;
+enum class SkillID : uint16_t;
+enum class StatusChange : uint16_t;
+
+inline
+auto decay_for_printf(ItemLook v) -> typename remove_enum<decltype(v)>::type { return typename remove_enum<decltype(v)>::type(v); }
+inline
+auto decay_for_printf(SP v) -> typename remove_enum<decltype(v)>::type { return typename remove_enum<decltype(v)>::type(v); }
+inline
+auto decay_for_printf(SkillID v) -> typename remove_enum<decltype(v)>::type { return typename remove_enum<decltype(v)>::type(v); }
+inline
+auto decay_for_printf(StatusChange v) -> typename remove_enum<decltype(v)>::type { return typename remove_enum<decltype(v)>::type(v); }
+
+namespace map
+{
+namespace e
+{
+enum class BF : uint16_t;
+enum class MapCell : uint8_t;
+inline
+auto decay_for_printf(BF v) -> typename remove_enum<decltype(v)>::type { return typename remove_enum<decltype(v)>::type(v); }
+inline
+auto decay_for_printf(MapCell v) -> typename remove_enum<decltype(v)>::type { return typename remove_enum<decltype(v)>::type(v); }
+} // namespace map::e
namespace magic
{
enum class SPELLARG : uint8_t;
inline
auto decay_for_printf(SPELLARG v) -> typename remove_enum<decltype(v)>::type { return typename remove_enum<decltype(v)>::type(v); }
-}
+} // namespace map::magic
enum class BL : uint8_t;
enum class ByteCode : uint8_t;
-enum class ItemLook : uint16_t;
enum class MS : uint8_t;
-enum class SP : uint16_t;
-enum class SkillID : uint16_t;
-enum class StatusChange : uint16_t;
inline
auto decay_for_printf(BL v) -> typename remove_enum<decltype(v)>::type { return typename remove_enum<decltype(v)>::type(v); }
inline
auto decay_for_printf(ByteCode v) -> typename remove_enum<decltype(v)>::type { return typename remove_enum<decltype(v)>::type(v); }
inline
-auto decay_for_printf(ItemLook v) -> typename remove_enum<decltype(v)>::type { return typename remove_enum<decltype(v)>::type(v); }
-inline
auto decay_for_printf(MS v) -> typename remove_enum<decltype(v)>::type { return typename remove_enum<decltype(v)>::type(v); }
-inline
-auto decay_for_printf(SP v) -> typename remove_enum<decltype(v)>::type { return typename remove_enum<decltype(v)>::type(v); }
-inline
-auto decay_for_printf(SkillID v) -> typename remove_enum<decltype(v)>::type { return typename remove_enum<decltype(v)>::type(v); }
-inline
-auto decay_for_printf(StatusChange v) -> typename remove_enum<decltype(v)>::type { return typename remove_enum<decltype(v)>::type(v); }
+} // namespace map
} // namespace tmwa
diff --git a/src/mmo/extract_enums.hpp b/src/mmo/extract_enums.hpp
index 1aab17e..0e8ac4c 100644
--- a/src/mmo/extract_enums.hpp
+++ b/src/mmo/extract_enums.hpp
@@ -32,7 +32,6 @@ namespace tmwa
namespace e
{
enum class EPOS : uint16_t;
-enum class MobMode : uint16_t;
enum class Opt1 : uint16_t;
enum class Opt2 : uint16_t;
enum class Opt0 : uint16_t;
@@ -40,18 +39,15 @@ enum class Opt0 : uint16_t;
inline
bool impl_extract(XString str, EPOS *iv) { return extract_as_int(str, iv); }
inline
-bool impl_extract(XString str, MobMode *iv) { return extract_as_int(str, iv); }
-inline
bool impl_extract(XString str, Opt1 *iv) { return extract_as_int(str, iv); }
inline
bool impl_extract(XString str, Opt2 *iv) { return extract_as_int(str, iv); }
inline
bool impl_extract(XString str, Opt0 *iv) { return extract_as_int(str, iv); }
-}
+} // namespace e
enum class ItemLook : uint16_t;
enum class ItemType : uint8_t;
-enum class Race : uint8_t;
enum class SEX : uint8_t;
enum class SkillID : uint16_t;
enum class StatusChange : uint16_t;
@@ -61,8 +57,6 @@ bool impl_extract(XString str, ItemLook *iv) { return extract_as_int(str, iv); }
inline
bool impl_extract(XString str, ItemType *iv) { return extract_as_int(str, iv); }
inline
-bool impl_extract(XString str, Race *iv) { return extract_as_int(str, iv); }
-inline
bool impl_extract(XString str, SEX *iv) { return extract_as_int(str, iv); }
inline
bool impl_extract(XString str, SkillID *iv) { return extract_as_int(str, iv); }
@@ -70,4 +64,22 @@ inline
bool impl_extract(XString str, StatusChange *iv) { return extract_as_int(str, iv); }
bool impl_extract(XString, DIR *);
+
+namespace map
+{
+namespace e
+{
+enum class MobMode : uint16_t;
+
+inline
+bool impl_extract(XString str, MobMode *iv) { return extract_as_int(str, iv); }
+} // namespace map::e
+enum class Race : uint8_t;
+enum class ATK;
+
+inline
+bool impl_extract(XString str, Race *iv) { return extract_as_int(str, iv); }
+inline
+bool impl_extract(XString str, ATK *iv) { return extract_as_int(str, iv); }
+} // namespace map
} // namespace tmwa
diff --git a/src/mmo/strs.cpp b/src/mmo/strs.cpp
new file mode 100644
index 0000000..d780702
--- /dev/null
+++ b/src/mmo/strs.cpp
@@ -0,0 +1,32 @@
+#include "strs.hpp"
+// strs.cpp - common string types
+//
+// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com>
+//
+// This file is part of The Mana World (Athena server)
+//
+// 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 3 of the License, or
+// (at your option) 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 <http://www.gnu.org/licenses/>.
+
+#include "../io/cxxstdio.hpp"
+
+#include "../poison.hpp"
+
+
+namespace tmwa
+{
+VString<49> convert_for_printf(NpcEvent ev)
+{
+ return STRNPRINTF(50, "%s::%s"_fmt, ev.npc, ev.label);
+}
+} // namespace tmwa