From 7af4c5b5c561362cb1135ab504095ae667a9270a Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Fri, 27 Jun 2014 19:16:45 -0700 Subject: This is more reliable --- src/mmo/config_parse.hpp | 9 +++------ src/mmo/consts.hpp | 25 +++++++++++-------------- src/mmo/core.hpp | 11 ++++------- src/mmo/enums.hpp | 11 ++++------- src/mmo/extract.hpp | 23 ++++++++++------------- src/mmo/fwd.hpp | 19 ++++++++----------- src/mmo/human_time_diff.hpp | 13 +++++-------- src/mmo/ids.hpp | 13 +++++-------- src/mmo/md5more.hpp | 13 +++++-------- src/mmo/mmo.hpp | 11 ++++------- src/mmo/strs.hpp | 21 +++++++++------------ src/mmo/utils.hpp | 29 +++++++++++++---------------- src/mmo/version.hpp | 21 +++++++++------------ 13 files changed, 90 insertions(+), 129 deletions(-) (limited to 'src/mmo') diff --git a/src/mmo/config_parse.hpp b/src/mmo/config_parse.hpp index 5389b5d..50a115e 100644 --- a/src/mmo/config_parse.hpp +++ b/src/mmo/config_parse.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_CONFIG_PARSE_HPP -#define TMWA_MMO_CONFIG_PARSE_HPP +#pragma once // config_parse.hpp - Framework for per-server config parsers. // // Copyright © 2014 Ben Longbons @@ -19,9 +18,9 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -# include "fwd.hpp" +#include "fwd.hpp" -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" namespace tmwa @@ -36,5 +35,3 @@ bool config_split(XString line, XString *key, XString *value); /// Then it defers to the inferior parser for a line it does not understand. bool load_config_file(ZString filename, ConfigItemParser slave); } // namespace tmwa - -#endif // TMWA_MMO_CONFIG_PARSE_HPP diff --git a/src/mmo/consts.hpp b/src/mmo/consts.hpp index 0fdd7de..2a20cff 100644 --- a/src/mmo/consts.hpp +++ b/src/mmo/consts.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_CONSTS_HPP -#define TMWA_MMO_CONSTS_HPP +#pragma once // consts.hpp - Huge mess of constants. // // Copyright © ????-2004 Athena Dev Teams @@ -21,12 +20,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -# include "fwd.hpp" +#include "fwd.hpp" -# include "../net/timer.t.hpp" +#include "../net/timer.t.hpp" -# include "ids.hpp" -# include "strs.hpp" +#include "ids.hpp" +#include "strs.hpp" namespace tmwa @@ -48,12 +47,12 @@ 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 +#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 @@ -65,5 +64,3 @@ struct PartyMember struct map_session_data *sd; }; } // namespace tmwa - -#endif // TMWA_MMO_CONSTS_HPP diff --git a/src/mmo/core.hpp b/src/mmo/core.hpp index e9ffab6..5b2dbbb 100644 --- a/src/mmo/core.hpp +++ b/src/mmo/core.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_CORE_HPP -#define TMWA_MMO_CORE_HPP +#pragma once // core.hpp - The main loop. // // Copyright © ????-2004 Athena Dev Teams @@ -21,11 +20,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -# include "fwd.hpp" +#include "fwd.hpp" -# include "../range/slice.hpp" +#include "../range/slice.hpp" -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" namespace tmwa @@ -44,5 +43,3 @@ extern int do_init(Slice); /// or when if we manage to exit() gracefully. extern void term_func(void); } // namespace tmwa - -#endif // TMWA_MMO_CORE_HPP diff --git a/src/mmo/enums.hpp b/src/mmo/enums.hpp index 62ce8ee..bf8a75c 100644 --- a/src/mmo/enums.hpp +++ b/src/mmo/enums.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_ENUMS_HPP -#define TMWA_MMO_ENUMS_HPP +#pragma once // enums.hpp - Common enumerated types // // Copyright © ????-2004 Athena Dev Teams @@ -21,11 +20,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -# include "fwd.hpp" +#include "fwd.hpp" -# include +#include -# include "../generic/enum.hpp" +#include "../generic/enum.hpp" namespace tmwa @@ -161,5 +160,3 @@ bool network_to_native(SEX *native, char network) return true; } } // namespace tmwa - -#endif // TMWA_MMO_ENUMS_HPP diff --git a/src/mmo/extract.hpp b/src/mmo/extract.hpp index 16b3cf1..355e2da 100644 --- a/src/mmo/extract.hpp +++ b/src/mmo/extract.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_EXTRACT_HPP -#define TMWA_MMO_EXTRACT_HPP +#pragma once // extract.hpp - a simple, hierarchical, tokenizer // // Copyright © 2012-2013 Ben Longbons @@ -19,21 +18,21 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -# include "fwd.hpp" +#include "fwd.hpp" -# include -# include +#include +#include -# include -# include +#include +#include -# include "../ints/wrap.hpp" +#include "../ints/wrap.hpp" -# include "../strings/xstring.hpp" +#include "../strings/xstring.hpp" -# include "../generic/enum.hpp" +#include "../generic/enum.hpp" -# include "utils.hpp" +#include "utils.hpp" namespace tmwa @@ -231,5 +230,3 @@ bool extract(XString str, Wrapped *w) return extract(str, &w->_value); } } // namespace tmwa - -#endif // TMWA_MMO_EXTRACT_HPP diff --git a/src/mmo/fwd.hpp b/src/mmo/fwd.hpp index 379b370..3b56bfb 100644 --- a/src/mmo/fwd.hpp +++ b/src/mmo/fwd.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_FWD_HPP -#define TMWA_MMO_FWD_HPP +#pragma once // mmo/fwd.hpp - list of type names for mmo lib // // Copyright © 2014 Ben Longbons @@ -19,7 +18,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -# include "../sanity.hpp" +#include "../sanity.hpp" namespace tmwa @@ -49,23 +48,21 @@ class MapName; class CharName; class Item; -# if 0 +#if 0 class Point; class SkillValue; -# endif +#endif class GlobalReg; -# if 0 +#if 0 class CharKey; class CharData; class CharPair; -# endif +#endif class Storage; -# if 0 +#if 0 class GM_Account; class PartyMember; -# endif +#endif class PartyMost; class PartyPair; } // namespace tmwa - -#endif // TMWA_MMO_FWD_HPP diff --git a/src/mmo/human_time_diff.hpp b/src/mmo/human_time_diff.hpp index 3fd044d..b5c19fb 100644 --- a/src/mmo/human_time_diff.hpp +++ b/src/mmo/human_time_diff.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_HUMAN_TIME_DIFF_HPP -#define TMWA_MMO_HUMAN_TIME_DIFF_HPP +#pragma once // human_time_diff.hpp - broken deltas // // Copyright © 2013 Ben Longbons @@ -19,13 +18,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -# include "fwd.hpp" +#include "fwd.hpp" -# include +#include -# include "../strings/xstring.hpp" +#include "../strings/xstring.hpp" -# include "extract.hpp" +#include "extract.hpp" namespace tmwa @@ -88,5 +87,3 @@ bool extract(XString str, HumanTimeDiff *iv) return true; } } // namespace tmwa - -#endif // TMWA_MMO_HUMAN_TIME_DIFF_HPP diff --git a/src/mmo/ids.hpp b/src/mmo/ids.hpp index 4225103..4e2b97c 100644 --- a/src/mmo/ids.hpp +++ b/src/mmo/ids.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_IDS_HPP -#define TMWA_MMO_IDS_HPP +#pragma once // ids.hpp - special integer classes for various object IDs // // Copyright © 2014 Ben Longbons @@ -19,12 +18,12 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -# include "fwd.hpp" +#include "fwd.hpp" -# include "../ints/little.hpp" -# include "../ints/wrap.hpp" +#include "../ints/little.hpp" +#include "../ints/wrap.hpp" -# include "extract.hpp" +#include "extract.hpp" namespace tmwa @@ -167,5 +166,3 @@ uint32_t convert_for_printf(GmLevel g) return g.get_all_bits(); } } // namespace tmwa - -#endif // TMWA_MMO_IDS_HPP diff --git a/src/mmo/md5more.hpp b/src/mmo/md5more.hpp index f2bc9d0..7d50713 100644 --- a/src/mmo/md5more.hpp +++ b/src/mmo/md5more.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_MD5MORE_HPP -#define TMWA_MMO_MD5MORE_HPP +#pragma once // md5more.hpp - Non-basic MD5 functions. // // Copyright © ????-2004 Athena Dev Teams @@ -21,13 +20,13 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -# include "fwd.hpp" +#include "fwd.hpp" -# include "../generic/md5.hpp" +#include "../generic/md5.hpp" -# include "../io/fwd.hpp" +#include "../io/fwd.hpp" -# include "../net/fwd.hpp" +#include "../net/fwd.hpp" namespace tmwa @@ -47,5 +46,3 @@ bool pass_ok(AccountPass password, AccountCrypt crypted); /// This returns an IP4Address because it is configurable whether it gets called at all IP4Address MD5_ip(IP4Address ip); } // namespace tmwa - -#endif // TMWA_MMO_MD5MORE_HPP diff --git a/src/mmo/mmo.hpp b/src/mmo/mmo.hpp index 8e92ecb..cfa278d 100644 --- a/src/mmo/mmo.hpp +++ b/src/mmo/mmo.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_MMO_HPP -#define TMWA_MMO_MMO_HPP +#pragma once // mmo.hpp - Huge mess of structures. // // Copyright © ????-2004 Athena Dev Teams @@ -21,11 +20,11 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -# include "fwd.hpp" +#include "fwd.hpp" -# include "../compat/memory.hpp" +#include "../compat/memory.hpp" -# include "../proto2/types.hpp" +#include "../proto2/types.hpp" namespace tmwa @@ -68,5 +67,3 @@ struct PartyPair PartyMost *operator->() const { return party_most; } }; } // namespace tmwa - -#endif // TMWA_MMO_MMO_HPP diff --git a/src/mmo/strs.hpp b/src/mmo/strs.hpp index 16e524a..fea0c98 100644 --- a/src/mmo/strs.hpp +++ b/src/mmo/strs.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_STRS_HPP -#define TMWA_MMO_STRS_HPP +#pragma once // strs.hpp - common string types // // Copyright © ????-2004 Athena Dev Teams @@ -21,15 +20,15 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -# include "fwd.hpp" +#include "fwd.hpp" -# include "../strings/vstring.hpp" +#include "../strings/vstring.hpp" namespace tmwa { // affects CharName -# define NAME_IGNORING_CASE 1 +#define NAME_IGNORING_CASE 1 struct AccountName : VString<23> {}; struct AccountPass : VString<23> {}; @@ -39,7 +38,7 @@ struct ServerName : VString<19> {}; struct PartyName : VString<23> {}; struct VarName : VString<31> {}; -# define DEFAULT_EMAIL stringish("a@a.com"_s) +#define DEFAULT_EMAIL stringish("a@a.com"_s) // It is decreed: a mapname shall not contain an extension class MapName : public strings::_crtp_string @@ -94,12 +93,12 @@ public: } VString<23> to__canonical() const { -# if NAME_IGNORING_CASE == 0 +#if NAME_IGNORING_CASE == 0 return to__actual(); -# endif -# if NAME_IGNORING_CASE == 1 +#endif +#if NAME_IGNORING_CASE == 1 return to__lower(); -# endif +#endif } friend bool operator == (const CharName& l, const CharName& r) @@ -125,5 +124,3 @@ CharName stringish(VString<23> iv) return CharName(iv); } } // namespace tmwa - -#endif // TMWA_MMO_STRS_HPP diff --git a/src/mmo/utils.hpp b/src/mmo/utils.hpp index 95c89fc..fc3ea74 100644 --- a/src/mmo/utils.hpp +++ b/src/mmo/utils.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_UTILS_HPP -#define TMWA_MMO_UTILS_HPP +#pragma once // utils.hpp - Useful stuff that hasn't been categorized. // // Copyright © ????-2004 Athena Dev Teams @@ -21,21 +20,21 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -# include "fwd.hpp" +#include "fwd.hpp" -# include -# include +#include +#include -# include +#include -# include "../ints/little.hpp" +#include "../ints/little.hpp" -# include "../strings/fwd.hpp" -# include "../strings/vstring.hpp" +#include "../strings/fwd.hpp" +#include "../strings/vstring.hpp" -# include "../generic/operators.hpp" +#include "../generic/operators.hpp" -# include "../io/fwd.hpp" +#include "../io/fwd.hpp" namespace tmwa @@ -149,16 +148,16 @@ void stamp_time(timestamp_milliseconds_buffer&); void log_with_timestamp(io::WriteFile& out, XString line); // TODO VString? -# define TIMESTAMP_DUMMY "YYYY-MM-DD HH:MM:SS" +#define TIMESTAMP_DUMMY "YYYY-MM-DD HH:MM:SS" static_assert(sizeof(TIMESTAMP_DUMMY) == sizeof(timestamp_seconds_buffer), "timestamp size"); -# define WITH_TIMESTAMP(str) str TIMESTAMP_DUMMY +#define WITH_TIMESTAMP(str) str TIMESTAMP_DUMMY // str: prefix: YYYY-MM-DD HH:MM:SS // sizeof: 01234567890123456789012345678 // str + sizeof: ^ // -1: ^ // there's probably a better way to do this now -# define REPLACE_TIMESTAMP(str, t) \ +#define REPLACE_TIMESTAMP(str, t) \ stamp_time( \ reinterpret_cast( \ str + sizeof(str) \ @@ -166,5 +165,3 @@ static_assert(sizeof(TIMESTAMP_DUMMY) == sizeof(timestamp_seconds_buffer), &t \ ) } // namespace tmwa - -#endif // TMWA_MMO_UTILS_HPP diff --git a/src/mmo/version.hpp b/src/mmo/version.hpp index 634c27f..440dce6 100644 --- a/src/mmo/version.hpp +++ b/src/mmo/version.hpp @@ -1,5 +1,4 @@ -#ifndef TMWA_MMO_VERSION_HPP -#define TMWA_MMO_VERSION_HPP +#pragma once // version.hpp - Prevent mass rebuild when conf/version.hpp changes. // // Copyright © ????-2004 Athena Dev Teams @@ -21,22 +20,22 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -# include "fwd.hpp" +#include "fwd.hpp" -# include +#include -# include "../strings/fwd.hpp" +#include "../strings/fwd.hpp" namespace tmwa { // TODO make these bitwise enums -# define TMWA_FLAG_REGISTRATION 0x01 +#define TMWA_FLAG_REGISTRATION 0x01 -# define TMWA_SERVER_LOGIN 0x01 -# define TMWA_SERVER_CHAR 0x02 -# define TMWA_SERVER_INTER 0x04 -# define TMWA_SERVER_MAP 0x08 +#define TMWA_SERVER_LOGIN 0x01 +#define TMWA_SERVER_CHAR 0x02 +#define TMWA_SERVER_INTER 0x04 +#define TMWA_SERVER_MAP 0x08 // TODO now that I generate the protocol, split 'flags' out of the struct struct Version @@ -92,5 +91,3 @@ extern LString CURRENT_VERSION_STRING; bool extract(XString str, Version *vers); } // namespace tmwa - -#endif // TMWA_MMO_VERSION_HPP -- cgit v1.2.3-60-g2f50