From b353ae37eb6d374aec4127f1849a5dce81f812b5 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Tue, 24 Jun 2014 18:52:00 -0700 Subject: No one is .neutral() here (except IPv4 addresses) --- src/mmo/consts.cpp | 21 ++++++++ src/mmo/consts.hpp | 65 +++++++++++++++++++++++ src/mmo/extract.cpp | 4 +- src/mmo/extract.hpp | 4 +- src/mmo/fwd.hpp | 12 +++-- src/mmo/mmo.hpp | 145 ++++------------------------------------------------ 6 files changed, 107 insertions(+), 144 deletions(-) create mode 100644 src/mmo/consts.cpp create mode 100644 src/mmo/consts.hpp (limited to 'src/mmo') diff --git a/src/mmo/consts.cpp b/src/mmo/consts.cpp new file mode 100644 index 0000000..ee59429 --- /dev/null +++ b/src/mmo/consts.cpp @@ -0,0 +1,21 @@ +#include "consts.hpp" +// consts.cpp - empty mess of constants +// +// Copyright © 2014 Ben Longbons +// +// 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 . + +#include "../poison.hpp" diff --git a/src/mmo/consts.hpp b/src/mmo/consts.hpp new file mode 100644 index 0000000..f7dbc36 --- /dev/null +++ b/src/mmo/consts.hpp @@ -0,0 +1,65 @@ +#ifndef TMWA_MMO_CONSTS_HPP +#define TMWA_MMO_CONSTS_HPP +// consts.hpp - Huge mess of constants. +// +// Copyright © ????-2004 Athena Dev Teams +// Copyright © 2004-2011 The Mana World Development Team +// Copyright © 2011-2014 Ben Longbons +// +// 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 . + +# include "fwd.hpp" + +# include "../net/timer.t.hpp" + +# include "ids.hpp" +# include "strs.hpp" + +constexpr int FIFOSIZE_SERVERLINK = 256 * 1024; + +constexpr int MAX_MAP_PER_SERVER = 512; +constexpr int MAX_INVENTORY = 100; +constexpr int MAX_AMOUNT = 30000; +constexpr int MAX_ZENY = 1000000000; // 1G zeny +constexpr int TRADE_MAX = 10; + +constexpr int GLOBAL_REG_NUM = 96; +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(); +constexpr interval_t MAX_WALK_SPEED = std::chrono::seconds(1); +constexpr int MAX_STORAGE = 300; +constexpr int MAX_PARTY = 12; + +# define MIN_HAIR_STYLE battle_config.min_hair_style +# define MAX_HAIR_STYLE battle_config.max_hair_style +# define MIN_HAIR_COLOR battle_config.min_hair_color +# define MAX_HAIR_COLOR battle_config.max_hair_color +# define MIN_CLOTH_COLOR battle_config.min_cloth_color +# define MAX_CLOTH_COLOR battle_config.max_cloth_color + +// WTF is this doing here? +struct PartyMember +{ + AccountId account_id; + CharName name; + MapName map; + int leader, online, lv; + struct map_session_data *sd; +}; + +#endif // TMWA_MMO_CONSTS_HPP diff --git a/src/mmo/extract.cpp b/src/mmo/extract.cpp index b0a01f1..deb3a64 100644 --- a/src/mmo/extract.cpp +++ b/src/mmo/extract.cpp @@ -40,13 +40,13 @@ bool extract(XString str, AString *rv) return true; } -bool extract(XString str, struct global_reg *var) +bool extract(XString str, GlobalReg *var) { return extract(str, record<','>(&var->str, &var->value)); } -bool extract(XString str, struct item *it) +bool extract(XString str, Item *it) { XString ignored; return extract(str, diff --git a/src/mmo/extract.hpp b/src/mmo/extract.hpp index ab65661..1154545 100644 --- a/src/mmo/extract.hpp +++ b/src/mmo/extract.hpp @@ -208,9 +208,9 @@ bool extract(XString str, VRecord rec) && extract(str.xislice_t(s + 1), rec); } -bool extract(XString str, struct global_reg *var); +bool extract(XString str, GlobalReg *var); -bool extract(XString str, struct item *it); +bool extract(XString str, Item *it); bool extract(XString str, MapName *m); diff --git a/src/mmo/fwd.hpp b/src/mmo/fwd.hpp index 3217fc1..7bf766e 100644 --- a/src/mmo/fwd.hpp +++ b/src/mmo/fwd.hpp @@ -45,11 +45,13 @@ class VarName; class MapName; class CharName; +class Item; +# if 0 +class Point; +class SkillValue; +# endif +class GlobalReg; # if 0 -class item; -class point; -class skill_value; -class global_reg; class CharKey; class CharData; class CharPair; @@ -57,7 +59,7 @@ class CharPair; class Storage; # if 0 class GM_Account; -class party_member; +class PartyMember; # endif class PartyMost; class PartyPair; diff --git a/src/mmo/mmo.hpp b/src/mmo/mmo.hpp index 89aef6d..d749daa 100644 --- a/src/mmo/mmo.hpp +++ b/src/mmo/mmo.hpp @@ -1,6 +1,6 @@ #ifndef TMWA_MMO_MMO_HPP #define TMWA_MMO_MMO_HPP -// mmo.hpp - Huge mess of structures and constants. +// mmo.hpp - Huge mess of structures. // // Copyright © ????-2004 Athena Dev Teams // Copyright © 2004-2011 The Mana World Development Team @@ -23,119 +23,20 @@ # include "fwd.hpp" -# include - # include "../compat/memory.hpp" -# include "../generic/array.hpp" - -# include "../net/timer.t.hpp" - -# include "enums.hpp" -# include "ids.hpp" -# include "strs.hpp" - -constexpr int FIFOSIZE_SERVERLINK = 256 * 1024; - -constexpr int MAX_MAP_PER_SERVER = 512; -constexpr int MAX_INVENTORY = 100; -constexpr int MAX_AMOUNT = 30000; -constexpr int MAX_ZENY = 1000000000; // 1G zeny -constexpr int TRADE_MAX = 10; - -constexpr int GLOBAL_REG_NUM = 96; -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(); -constexpr interval_t MAX_WALK_SPEED = std::chrono::seconds(1); -constexpr int MAX_STORAGE = 300; -constexpr int MAX_PARTY = 12; +# include "../proto2/types.hpp" -# define MIN_HAIR_STYLE battle_config.min_hair_style -# define MAX_HAIR_STYLE battle_config.max_hair_style -# define MIN_HAIR_COLOR battle_config.min_hair_color -# define MAX_HAIR_COLOR battle_config.max_hair_color -# define MIN_CLOTH_COLOR battle_config.min_cloth_color -# define MAX_CLOTH_COLOR battle_config.max_cloth_color - -struct item +inline +bool operator == (const SkillValue& l, const SkillValue& r) { - ItemNameId nameid; - short amount; - EPOS equip; -}; - -struct point + return l.lv == r.lv && l.flags == r.flags; +} +inline +bool operator != (const SkillValue& l, const SkillValue& r) { - MapName map_; - short x, y; -}; - -struct skill_value -{ - unsigned short lv; - SkillFlags flags; - - friend bool operator == (const skill_value& l, const skill_value& r) - { - return l.lv == r.lv && l.flags == r.flags; - } - friend bool operator != (const skill_value& l, const skill_value& r) - { - return !(l == r); - } -}; - -struct global_reg -{ - VarName str; - int value; -}; - -struct CharKey -{ - CharName name; - AccountId account_id; - CharId char_id; - unsigned char char_num; -}; - -struct CharData -{ - CharId partner_id; - - int base_exp, job_exp, zeny; - - Species species; - short status_point, skill_point; - int hp, max_hp, sp, max_sp; - Option option; - short karma, manner; - short hair, hair_color, clothes_color; - PartyId party_id; - - ItemLook weapon; - ItemNameId shield; - ItemNameId head_top, head_mid, head_bottom; - - unsigned char base_level, job_level; - earray attrs; - SEX sex; - - unsigned long mapip; - unsigned int mapport; - - struct point last_point, save_point; - Array inventory; - earray skill; - int global_reg_num; - Array global_reg; - int account_reg_num; - Array account_reg; - int account_reg2_num; - Array account_reg2; -}; + return !(l == r); +} struct CharPair { @@ -147,38 +48,12 @@ struct CharPair {} }; -struct Storage -{ - bool dirty; - AccountId account_id; - short storage_status; - short storage_amount; - Array storage_; -}; - struct GM_Account { AccountId account_id; GmLevel level; }; -struct party_member -{ - AccountId account_id; - CharName name; - MapName map; - int leader, online, lv; - struct map_session_data *sd; -}; - -struct PartyMost -{ - PartyName name; - int exp; - int item; - Array member; -}; - struct PartyPair { PartyId party_id = {}; -- cgit v1.2.3-70-g09d2