From af4acff261d579428e8eef042cc5359fa392f725 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Tue, 27 May 2014 13:33:54 -0700 Subject: Generate the char server protocol --- src/mmo/fwd.hpp | 17 +++++++++++++++++ src/mmo/ids.hpp | 16 ++++++++++++++++ src/mmo/mmo.hpp | 18 ++++++++++++++---- 3 files changed, 47 insertions(+), 4 deletions(-) (limited to 'src/mmo') diff --git a/src/mmo/fwd.hpp b/src/mmo/fwd.hpp index eb8bc05..3217fc1 100644 --- a/src/mmo/fwd.hpp +++ b/src/mmo/fwd.hpp @@ -45,4 +45,21 @@ class VarName; class MapName; class CharName; +# if 0 +class item; +class point; +class skill_value; +class global_reg; +class CharKey; +class CharData; +class CharPair; +# endif +class Storage; +# if 0 +class GM_Account; +class party_member; +# endif +class PartyMost; +class PartyPair; + #endif // TMWA_MMO_FWD_HPP diff --git a/src/mmo/ids.hpp b/src/mmo/ids.hpp index ed5ab58..bfd7de9 100644 --- a/src/mmo/ids.hpp +++ b/src/mmo/ids.hpp @@ -115,6 +115,22 @@ public: return true; // LIES. But this code is going away soon anyway } + // TODO kill this code too + friend + bool native_to_network(Little16 *network, GmLevel native) + { + uint16_t tmp = native.bits; + return native_to_network(network, tmp); + } + friend + bool network_to_native(GmLevel *native, Little16 network) + { + uint16_t tmp; + bool rv = network_to_native(&tmp, network); + native->bits = tmp; + return rv; + } + friend bool native_to_network(Little32 *network, GmLevel native) { diff --git a/src/mmo/mmo.hpp b/src/mmo/mmo.hpp index d96e619..89aef6d 100644 --- a/src/mmo/mmo.hpp +++ b/src/mmo/mmo.hpp @@ -44,7 +44,7 @@ constexpr int MAX_ZENY = 1000000000; // 1G zeny constexpr int TRADE_MAX = 10; constexpr int GLOBAL_REG_NUM = 96; -constexpr int ACCOUNT_REG_NUM = 16; +constexpr size_t ACCOUNT_REG_NUM = 16; constexpr size_t ACCOUNT_REG2_NUM = 16; constexpr interval_t DEFAULT_WALK_SPEED = std::chrono::milliseconds(150); constexpr interval_t MIN_WALK_SPEED = interval_t::zero(); @@ -147,7 +147,7 @@ struct CharPair {} }; -struct storage +struct Storage { bool dirty; AccountId account_id; @@ -171,13 +171,23 @@ struct party_member struct map_session_data *sd; }; -struct party +struct PartyMost { - PartyId party_id; PartyName name; int exp; int item; Array member; }; +struct PartyPair +{ + PartyId party_id = {}; + PartyMost *party_most = {}; + + explicit + operator bool() const { return party_most; } + bool operator !() const { return !party_most; } + PartyMost *operator->() const { return party_most; } +}; + #endif // TMWA_MMO_MMO_HPP -- cgit v1.2.3-60-g2f50