summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/admin/ladmin.cpp7
-rw-r--r--src/admin/main.cpp3
-rw-r--r--src/char/char.cpp14
-rw-r--r--src/char/char.hpp4
-rw-r--r--src/char/int_party.cpp5
-rw-r--r--src/char/int_storage.cpp7
-rw-r--r--src/char/inter.cpp9
-rw-r--r--src/char/inter.hpp2
-rw-r--r--src/char/main.cpp3
-rw-r--r--src/compat/iter_test.cpp4
-rw-r--r--src/compat/memory.hpp1
-rw-r--r--src/generic/array.cpp (renamed from src/compat/alg.cpp)6
-rw-r--r--src/generic/array.hpp (renamed from src/compat/alg.hpp)36
-rw-r--r--src/generic/enum.hpp2
-rw-r--r--src/generic/intern-pool.hpp1
-rw-r--r--src/generic/intern-pool_test.cpp2
-rw-r--r--src/generic/md5.cpp5
-rw-r--r--src/generic/md5.hpp4
-rw-r--r--src/generic/random.hpp2
-rw-r--r--src/io/cxxstdio.hpp4
-rw-r--r--src/io/fd.hpp2
-rw-r--r--src/io/line.cpp4
-rw-r--r--src/io/line.hpp3
-rw-r--r--src/io/line_test.cpp1
-rw-r--r--src/io/lock.cpp3
-rw-r--r--src/io/read.cpp2
-rw-r--r--src/io/read_test.cpp2
-rw-r--r--src/io/write.cpp7
-rw-r--r--src/io/write_test.cpp1
-rw-r--r--src/login/login.cpp9
-rw-r--r--src/login/main.cpp3
-rw-r--r--src/map/atcommand.cpp8
-rw-r--r--src/map/atcommand.hpp3
-rw-r--r--src/map/battle.cpp4
-rw-r--r--src/map/battle.hpp5
-rw-r--r--src/map/battle.t.hpp2
-rw-r--r--src/map/chrif.cpp7
-rw-r--r--src/map/chrif.hpp5
-rw-r--r--src/map/clif.cpp12
-rw-r--r--src/map/clif.hpp6
-rw-r--r--src/map/fwd.hpp24
-rw-r--r--src/map/grfio.cpp6
-rw-r--r--src/map/grfio.hpp4
-rw-r--r--src/map/intif.cpp5
-rw-r--r--src/map/intif.hpp3
-rw-r--r--src/map/itemdb.cpp7
-rw-r--r--src/map/itemdb.hpp1
-rw-r--r--src/map/magic-expr-eval.hpp4
-rw-r--r--src/map/magic-expr.cpp8
-rw-r--r--src/map/magic-expr.hpp6
-rw-r--r--src/map/magic-interpreter-base.cpp6
-rw-r--r--src/map/magic-interpreter.hpp19
-rw-r--r--src/map/magic-stmt.cpp2
-rw-r--r--src/map/magic-v2.cpp11
-rw-r--r--src/map/magic.cpp6
-rw-r--r--src/map/magic.hpp4
-rw-r--r--src/map/main.cpp3
-rw-r--r--src/map/map.cpp9
-rw-r--r--src/map/map.hpp29
-rw-r--r--src/map/map.t.hpp4
-rw-r--r--src/map/mapflag.hpp4
-rw-r--r--src/map/mob.cpp3
-rw-r--r--src/map/mob.hpp3
-rw-r--r--src/map/npc.cpp6
-rw-r--r--src/map/npc.hpp2
-rw-r--r--src/map/party.cpp6
-rw-r--r--src/map/party.hpp7
-rw-r--r--src/map/path.cpp9
-rw-r--r--src/map/path.hpp2
-rw-r--r--src/map/pc.cpp8
-rw-r--r--src/map/pc.hpp2
-rw-r--r--src/map/script.cpp9
-rw-r--r--src/map/script.hpp5
-rw-r--r--src/map/skill-pools.cpp1
-rw-r--r--src/map/skill.cpp10
-rw-r--r--src/map/skill.hpp7
-rw-r--r--src/map/storage.cpp28
-rw-r--r--src/map/storage.hpp3
-rw-r--r--src/map/tmw.cpp7
-rw-r--r--src/map/tmw.hpp2
-rw-r--r--src/map/trade.hpp2
-rw-r--r--src/mmo/config_parse.cpp2
-rw-r--r--src/mmo/core.cpp6
-rw-r--r--src/mmo/dumb_ptr.hpp7
-rw-r--r--src/mmo/extract.cpp2
-rw-r--r--src/mmo/fwd.hpp16
-rw-r--r--src/mmo/human_time_diff.hpp2
-rw-r--r--src/mmo/ip.cpp2
-rw-r--r--src/mmo/ip.hpp5
-rw-r--r--src/mmo/ip_test.cpp3
-rw-r--r--src/mmo/md5more.cpp6
-rw-r--r--src/mmo/md5more.hpp5
-rw-r--r--src/mmo/mmo.hpp17
-rw-r--r--src/mmo/socket.cpp10
-rw-r--r--src/mmo/socket.hpp7
-rw-r--r--src/mmo/timer.cpp6
-rw-r--r--src/mmo/timer.t.hpp2
-rw-r--r--src/mmo/utils.cpp2
-rw-r--r--src/mmo/utils.hpp3
-rw-r--r--src/monitor/main.cpp1
-rw-r--r--src/range/fwd.hpp2
-rw-r--r--src/range/slice.tcc2
-rw-r--r--src/sexpr/lexer.cpp2
-rw-r--r--src/sexpr/lexer.hpp3
-rw-r--r--src/sexpr/lexer_test.cpp2
-rw-r--r--src/sexpr/parser.cpp3
-rw-r--r--src/sexpr/parser.hpp2
-rw-r--r--src/strings/all.hpp1
-rw-r--r--src/strings/astring.cpp7
-rw-r--r--src/strings/astring.hpp3
-rw-r--r--src/strings/base.hpp2
-rw-r--r--src/strings/base.tcc2
-rw-r--r--src/strings/base_test.cpp1
-rw-r--r--src/strings/literal.hpp2
-rw-r--r--src/strings/mstring.hpp2
-rw-r--r--src/strings/pair.hpp4
-rw-r--r--src/strings/rstring.cpp6
-rw-r--r--src/strings/rstring.hpp1
-rw-r--r--src/strings/sstring.cpp3
-rw-r--r--src/strings/strings2_test.cpp4
-rw-r--r--src/strings/strings_test.cpp3
-rw-r--r--src/strings/tstring.cpp3
-rw-r--r--src/strings/vstring.tcc4
-rw-r--r--src/strings/xstring.cpp7
-rw-r--r--src/strings/xstring.hpp1
-rw-r--r--src/strings/zstring.cpp8
-rw-r--r--src/strings/zstring.hpp3
-rw-r--r--src/strings/zstring.tcc2
-rw-r--r--src/tests/test.cpp3
129 files changed, 369 insertions, 320 deletions
diff --git a/src/admin/ladmin.cpp b/src/admin/ladmin.cpp
index c078104..cf5735b 100644
--- a/src/admin/ladmin.cpp
+++ b/src/admin/ladmin.cpp
@@ -1,4 +1,4 @@
-#include <arpa/inet.h>
+#include "ladmin.hpp"
// ladmin.cpp - Local administration tool.
//
// Copyright © ????-2004 Athena Dev Teams
@@ -26,14 +26,14 @@
#include <cassert>
+#include <algorithm>
+
#include "../strings/mstring.hpp"
#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
#include "../strings/vstring.hpp"
-#include "../generic/md5.hpp"
-
#include "../io/cxxstdio.hpp"
#include "../io/read.hpp"
#include "../io/tty.hpp"
@@ -42,6 +42,7 @@
#include "../mmo/config_parse.hpp"
#include "../mmo/core.hpp"
#include "../mmo/human_time_diff.hpp"
+#include "../mmo/ip.hpp"
#include "../mmo/mmo.hpp"
#include "../mmo/socket.hpp"
#include "../mmo/utils.hpp"
diff --git a/src/admin/main.cpp b/src/admin/main.cpp
index c6f075e..56fd7b4 100644
--- a/src/admin/main.cpp
+++ b/src/admin/main.cpp
@@ -1,4 +1,3 @@
-#include "ladmin.hpp"
// admin/main.cpp - dummy file to make Make dependencies work
//
// Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com>
@@ -18,4 +17,6 @@
// 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 "ladmin.hpp"
+
#include "../poison.hpp"
diff --git a/src/char/char.cpp b/src/char/char.cpp
index 09d4a36..ae7a10a 100644
--- a/src/char/char.cpp
+++ b/src/char/char.cpp
@@ -22,8 +22,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
-#include <arpa/inet.h>
-#include <sys/socket.h>
#include <sys/wait.h>
#include <netdb.h>
@@ -33,14 +31,13 @@
#include <cassert>
#include <cstdlib>
-#include <cstring>
-#include <ctime>
+#include <algorithm>
+#include <array>
#include <bitset>
+#include <chrono>
#include <set>
-#include "../compat/alg.hpp"
-
#include "../ints/cmp.hpp"
#include "../ints/udl.hpp"
@@ -49,19 +46,22 @@
#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
-#include "../generic/db.hpp"
+#include "../generic/array.hpp"
#include "../io/cxxstdio.hpp"
#include "../io/lock.hpp"
#include "../io/read.hpp"
#include "../io/tty.hpp"
+#include "../io/write.hpp"
#include "../mmo/config_parse.hpp"
#include "../mmo/core.hpp"
#include "../mmo/extract.hpp"
#include "../mmo/human_time_diff.hpp"
+#include "../mmo/mmo.hpp"
#include "../mmo/socket.hpp"
#include "../mmo/timer.hpp"
+#include "../mmo/utils.hpp"
#include "../mmo/version.hpp"
#include "inter.hpp"
diff --git a/src/char/char.hpp b/src/char/char.hpp
index 5b4f9b9..64d4254 100644
--- a/src/char/char.hpp
+++ b/src/char/char.hpp
@@ -25,11 +25,11 @@
# include "../strings/fwd.hpp"
+# include "../generic/array.hpp"
+
# include "../mmo/ip.hpp"
# include "../mmo/mmo.hpp"
-struct Session;
-
constexpr int MAX_MAP_SERVERS = 30;
struct mmo_map_server
diff --git a/src/char/int_party.cpp b/src/char/int_party.cpp
index 3afa8a9..1084bed 100644
--- a/src/char/int_party.cpp
+++ b/src/char/int_party.cpp
@@ -20,9 +20,6 @@
// 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 <cstdlib>
-#include <cstring>
-
#include "../ints/udl.hpp"
#include "../strings/mstring.hpp"
@@ -34,8 +31,10 @@
#include "../io/cxxstdio.hpp"
#include "../io/lock.hpp"
#include "../io/read.hpp"
+#include "../io/write.hpp"
#include "../mmo/extract.hpp"
+#include "../mmo/ids.hpp"
#include "../mmo/mmo.hpp"
#include "../mmo/socket.hpp"
diff --git a/src/char/int_storage.cpp b/src/char/int_storage.cpp
index bd87e72..850d99e 100644
--- a/src/char/int_storage.cpp
+++ b/src/char/int_storage.cpp
@@ -20,20 +20,17 @@
// 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 <cstdlib>
-#include <cstring>
-
-#include <functional>
-
#include "../strings/mstring.hpp"
#include "../strings/astring.hpp"
#include "../strings/xstring.hpp"
+#include "../strings/literal.hpp"
#include "../generic/db.hpp"
#include "../io/cxxstdio.hpp"
#include "../io/lock.hpp"
#include "../io/read.hpp"
+#include "../io/write.hpp"
#include "../mmo/extract.hpp"
#include "../mmo/mmo.hpp"
diff --git a/src/char/inter.cpp b/src/char/inter.cpp
index 82704d1..621134f 100644
--- a/src/char/inter.cpp
+++ b/src/char/inter.cpp
@@ -21,8 +21,6 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <cassert>
-#include <cstdlib>
-#include <cstring>
#include <vector>
@@ -30,18 +28,19 @@
#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
+#include "../strings/literal.hpp"
+#include "../generic/array.hpp"
#include "../generic/db.hpp"
#include "../io/cxxstdio.hpp"
#include "../io/lock.hpp"
#include "../io/read.hpp"
+#include "../io/write.hpp"
-#include "../mmo/config_parse.hpp"
#include "../mmo/extract.hpp"
+#include "../mmo/mmo.hpp"
#include "../mmo/socket.hpp"
-#include "../mmo/timer.hpp"
-#include "../mmo/utils.hpp"
#include "char.hpp"
#include "int_party.hpp"
diff --git a/src/char/inter.hpp b/src/char/inter.hpp
index e7a4317..3e48460 100644
--- a/src/char/inter.hpp
+++ b/src/char/inter.hpp
@@ -25,7 +25,7 @@
# include "../strings/fwd.hpp"
-struct Session;
+# include "../mmo/fwd.hpp"
bool inter_config(XString key, ZString value);
void inter_init2();
diff --git a/src/char/main.cpp b/src/char/main.cpp
index 6814574..c2fd038 100644
--- a/src/char/main.cpp
+++ b/src/char/main.cpp
@@ -1,4 +1,3 @@
-#include "char.hpp"
// char/main.cpp - dummy file to make Make dependencies work
//
// Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com>
@@ -18,4 +17,6 @@
// 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 "char.hpp"
+
#include "../poison.hpp"
diff --git a/src/compat/iter_test.cpp b/src/compat/iter_test.cpp
index 99b2e68..2c3cdc8 100644
--- a/src/compat/iter_test.cpp
+++ b/src/compat/iter_test.cpp
@@ -20,9 +20,9 @@
#include <gtest/gtest.h>
-#include "../ints/udl.hpp"
+#include <algorithm>
-#include "../strings/xstring.hpp"
+#include "../ints/udl.hpp"
#include "../poison.hpp"
diff --git a/src/compat/memory.hpp b/src/compat/memory.hpp
index 8cafcb4..3a2af96 100644
--- a/src/compat/memory.hpp
+++ b/src/compat/memory.hpp
@@ -22,6 +22,7 @@
# include "fwd.hpp"
# include <memory>
+# include <type_traits>
template<class T>
diff --git a/src/compat/alg.cpp b/src/generic/array.cpp
index 8cfd00a..96c85ac 100644
--- a/src/compat/alg.cpp
+++ b/src/generic/array.cpp
@@ -1,7 +1,7 @@
-#include "alg.hpp"
-// alg.cpp - Silly math stuff.
+#include "array.hpp"
+// array.cpp - A simple bounds-checked array.
//
-// Copyright © 2012 Ben Longbons <b.r.longbons@gmail.com>
+// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com>
//
// This file is part of The Mana World (Athena server)
//
diff --git a/src/compat/alg.hpp b/src/generic/array.hpp
index 2587f9e..e6fefae 100644
--- a/src/compat/alg.hpp
+++ b/src/generic/array.hpp
@@ -1,8 +1,8 @@
-#ifndef TMWA_COMPAT_ALG_HPP
-#define TMWA_COMPAT_ALG_HPP
-// alg.hpp - Silly math stuff.
+#ifndef TMWA_GENERIC_ARRAY_HPP
+#define TMWA_GENERIC_ARRAY_HPP
+// array.hpp - A simple bounds-checked array.
//
-// Copyright © 2012 Ben Longbons <b.r.longbons@gmail.com>
+// Copyright © 2014 Ben Longbons <b.r.longbons@gmail.com>
//
// This file is part of The Mana World (Athena server)
//
@@ -21,21 +21,21 @@
# include "fwd.hpp"
-# if 0
-# include <type_traits>
+# include <cassert>
+# include <cstddef>
-
-template<class A, class B>
-typename std::common_type<A, B>::type min(A a, B b)
+template<class T, size_t n>
+struct Array
{
- return a < b ? a : b;
-}
+ T data[n];
+public:
+ T& operator [](size_t i) { assert (i < n); return data[i]; }
+ const T& operator [](size_t i) const { assert (i < n); return data[i]; }
-template<class A, class B>
-typename std::common_type<A, B>::type max(A a, B b)
-{
- return b < a ? a : b;
-}
-# endif
+ T *begin() { return data + 0; }
+ T *end() { return data + n; }
+ const T *begin() const { return data + 0; }
+ const T *end() const { return data + n; }
+};
-#endif // TMWA_COMPAT_ALG_HPP
+#endif // TMWA_GENERIC_ARRAY_HPP
diff --git a/src/generic/enum.hpp b/src/generic/enum.hpp
index bf0ac74..5f075bc 100644
--- a/src/generic/enum.hpp
+++ b/src/generic/enum.hpp
@@ -22,6 +22,7 @@
# include "fwd.hpp"
# include <cassert>
+# include <cstddef>
# include <algorithm>
# include <type_traits>
@@ -124,6 +125,7 @@ public:
// std::underlying_type isn't supported until gcc 4.7
// this is a poor man's emulation
+// TODO I'm depending on GCC 4.7 now, this can go away
template<class E>
struct underlying_type
{
diff --git a/src/generic/intern-pool.hpp b/src/generic/intern-pool.hpp
index b9fc38c..62a1d7f 100644
--- a/src/generic/intern-pool.hpp
+++ b/src/generic/intern-pool.hpp
@@ -22,6 +22,7 @@
# include "fwd.hpp"
# include <cassert>
+# include <cstddef>
# include <map>
# include <vector>
diff --git a/src/generic/intern-pool_test.cpp b/src/generic/intern-pool_test.cpp
index 3207792..f53e31d 100644
--- a/src/generic/intern-pool_test.cpp
+++ b/src/generic/intern-pool_test.cpp
@@ -20,7 +20,7 @@
#include <gtest/gtest.h>
-#include "../strings/base.hpp"
+#include "../strings/literal.hpp"
#include "../poison.hpp"
diff --git a/src/generic/md5.cpp b/src/generic/md5.cpp
index b49d36f..38a605c 100644
--- a/src/generic/md5.cpp
+++ b/src/generic/md5.cpp
@@ -18,14 +18,9 @@
// 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 <cstring>
-
#include "../compat/rawmem.hpp"
#include "../strings/xstring.hpp"
-#include "../strings/vstring.hpp"
-
-#include "random.hpp"
#include "../poison.hpp"
diff --git a/src/generic/md5.hpp b/src/generic/md5.hpp
index 071c08b..fd23eca 100644
--- a/src/generic/md5.hpp
+++ b/src/generic/md5.hpp
@@ -21,11 +21,7 @@
# include "fwd.hpp"
-# include <netinet/in.h>
-
# include <cstdint>
-# include <cstddef>
-# include <cstdio>
# include <array>
diff --git a/src/generic/random.hpp b/src/generic/random.hpp
index 2fb2632..3b27b36 100644
--- a/src/generic/random.hpp
+++ b/src/generic/random.hpp
@@ -23,8 +23,6 @@
# include "random.t.hpp"
-# include "fwd.hpp"
-
# include <random>
// This is not namespace random since that collides with a C function,
diff --git a/src/io/cxxstdio.hpp b/src/io/cxxstdio.hpp
index 65d32cd..c040d90 100644
--- a/src/io/cxxstdio.hpp
+++ b/src/io/cxxstdio.hpp
@@ -19,7 +19,7 @@
// 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 "../sanity.hpp"
+# include "fwd.hpp"
# include <cstdarg>
# include <cstdio>
@@ -28,8 +28,6 @@
# include "../generic/enum.hpp"
-# include "fwd.hpp"
-
namespace cxxstdio
{
diff --git a/src/io/fd.hpp b/src/io/fd.hpp
index cf91ed1..a7460a8 100644
--- a/src/io/fd.hpp
+++ b/src/io/fd.hpp
@@ -24,8 +24,6 @@
# include <sys/select.h>
# include <sys/socket.h>
-# include <unistd.h>
-
# include "../strings/fwd.hpp"
diff --git a/src/io/line.cpp b/src/io/line.cpp
index 8451b87..adefe53 100644
--- a/src/io/line.cpp
+++ b/src/io/line.cpp
@@ -18,12 +18,10 @@
// 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 <fcntl.h>
-#include <unistd.h>
-
#include "../strings/astring.hpp"
#include "../strings/mstring.hpp"
#include "../strings/zstring.hpp"
+#include "../strings/xstring.hpp"
#include "cxxstdio.hpp"
diff --git a/src/io/line.hpp b/src/io/line.hpp
index fb1984d..510a8f5 100644
--- a/src/io/line.hpp
+++ b/src/io/line.hpp
@@ -22,10 +22,9 @@
# include "fwd.hpp"
# include "../strings/rstring.hpp"
-# include "../strings/astring.hpp"
# include "../strings/zstring.hpp"
+# include "../strings/literal.hpp"
-# include "fd.hpp"
# include "read.hpp"
diff --git a/src/io/line_test.cpp b/src/io/line_test.cpp
index 921e4c8..6a4a55c 100644
--- a/src/io/line_test.cpp
+++ b/src/io/line_test.cpp
@@ -20,6 +20,7 @@
#include <gtest/gtest.h>
+#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../poison.hpp"
diff --git a/src/io/lock.cpp b/src/io/lock.cpp
index 3f83611..f6bbb01 100644
--- a/src/io/lock.cpp
+++ b/src/io/lock.cpp
@@ -22,9 +22,12 @@
#include <unistd.h>
#include <cerrno>
+#include <cstdio>
#include <cstdlib>
+#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
+#include "../strings/literal.hpp"
#include "cxxstdio.hpp"
#include "fd.hpp"
diff --git a/src/io/read.cpp b/src/io/read.cpp
index 61a6256..803d486 100644
--- a/src/io/read.cpp
+++ b/src/io/read.cpp
@@ -19,11 +19,11 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <fcntl.h>
-#include <unistd.h>
#include "../strings/astring.hpp"
#include "../strings/mstring.hpp"
#include "../strings/zstring.hpp"
+#include "../strings/literal.hpp"
#include "../io/cxxstdio.hpp"
diff --git a/src/io/read_test.cpp b/src/io/read_test.cpp
index 398c01e..77b2286 100644
--- a/src/io/read_test.cpp
+++ b/src/io/read_test.cpp
@@ -20,7 +20,9 @@
#include <gtest/gtest.h>
+#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
+#include "../strings/literal.hpp"
#include "../poison.hpp"
diff --git a/src/io/write.cpp b/src/io/write.cpp
index 817e6c0..18c4f9d 100644
--- a/src/io/write.cpp
+++ b/src/io/write.cpp
@@ -18,13 +18,14 @@
// 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 <sys/uio.h>
-
#include <fcntl.h>
-#include <unistd.h>
+#include <cstdio>
#include <cstdlib>
+#include <algorithm>
+
+#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
#include "../poison.hpp"
diff --git a/src/io/write_test.cpp b/src/io/write_test.cpp
index 5419501..970be42 100644
--- a/src/io/write_test.cpp
+++ b/src/io/write_test.cpp
@@ -26,6 +26,7 @@
#include "../strings/astring.hpp"
#include "../strings/mstring.hpp"
#include "../strings/xstring.hpp"
+#include "../strings/literal.hpp"
#include "../poison.hpp"
diff --git a/src/login/login.cpp b/src/login/login.cpp
index 6831b19..2a1cb89 100644
--- a/src/login/login.cpp
+++ b/src/login/login.cpp
@@ -1,3 +1,4 @@
+#include "login.hpp"
// login.cpp - Core of the login server.
//
// Copyright © ????-2004 Athena Dev Teams
@@ -20,8 +21,6 @@
// 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 <arpa/inet.h>
-#include <sys/types.h>
#include <sys/wait.h>
#include <netdb.h>
@@ -29,14 +28,10 @@
#include <sys/resource.h>
-#include <cstdlib>
-#include <cstring>
#include <ctime>
#include <algorithm>
-#include <array>
#include <set>
-#include <type_traits>
#include "../ints/udl.hpp"
@@ -53,11 +48,13 @@
#include "../io/lock.hpp"
#include "../io/read.hpp"
#include "../io/tty.hpp"
+#include "../io/write.hpp"
#include "../mmo/config_parse.hpp"
#include "../mmo/core.hpp"
#include "../mmo/extract.hpp"
#include "../mmo/human_time_diff.hpp"
+#include "../mmo/ids.hpp"
#include "../mmo/md5more.hpp"
#include "../mmo/mmo.hpp"
#include "../mmo/socket.hpp"
diff --git a/src/login/main.cpp b/src/login/main.cpp
index 5d51212..857d493 100644
--- a/src/login/main.cpp
+++ b/src/login/main.cpp
@@ -1,4 +1,3 @@
-#include "login.hpp"
// login/main.cpp - dummy file to make Make dependencies work
//
// Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com>
@@ -18,4 +17,6 @@
// 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 "login.hpp"
+
#include "../poison.hpp"
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp
index 3cfeb42..2f08627 100644
--- a/src/map/atcommand.cpp
+++ b/src/map/atcommand.cpp
@@ -20,10 +20,10 @@
// 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 <cmath>
-#include <cstring>
#include <ctime>
+#include <algorithm>
+
#include "../conf/version.hpp"
#include "../compat/nullpo.hpp"
@@ -35,6 +35,7 @@
#include "../strings/xstring.hpp"
#include "../strings/vstring.hpp"
+#include "../generic/db.hpp"
#include "../generic/random.hpp"
#include "../io/cxxstdio.hpp"
@@ -45,9 +46,11 @@
#include "../mmo/core.hpp"
#include "../mmo/extract.hpp"
#include "../mmo/human_time_diff.hpp"
+#include "../mmo/ids.hpp"
#include "../mmo/mmo.hpp"
#include "../mmo/socket.hpp"
#include "../mmo/timer.hpp"
+#include "../mmo/utils.hpp"
#include "../mmo/version.hpp"
#include "battle.hpp"
@@ -60,7 +63,6 @@
#include "npc.hpp"
#include "party.hpp"
#include "pc.hpp"
-#include "script.hpp"
#include "skill.hpp"
#include "storage.hpp"
#include "tmw.hpp"
diff --git a/src/map/atcommand.hpp b/src/map/atcommand.hpp
index df3448b..0a24163 100644
--- a/src/map/atcommand.hpp
+++ b/src/map/atcommand.hpp
@@ -25,7 +25,8 @@
# include "../strings/fwd.hpp"
-# include "map.hpp"
+# include "../mmo/fwd.hpp"
+# include "../mmo/dumb_ptr.hpp"
bool is_atcommand(Session *s, dumb_ptr<map_session_data> sd,
ZString message, GmLevel gmlvl);
diff --git a/src/map/battle.cpp b/src/map/battle.cpp
index 09910c6..02f5bdc 100644
--- a/src/map/battle.cpp
+++ b/src/map/battle.cpp
@@ -21,13 +21,13 @@
// 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 <cstring>
+#include <algorithm>
-#include "../compat/alg.hpp"
#include "../compat/nullpo.hpp"
#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
+#include "../strings/xstring.hpp"
#include "../generic/random.hpp"
diff --git a/src/map/battle.hpp b/src/map/battle.hpp
index 94d0b45..6e73e70 100644
--- a/src/map/battle.hpp
+++ b/src/map/battle.hpp
@@ -27,6 +27,7 @@
# include "../strings/fwd.hpp"
+# include "../mmo/dumb_ptr.hpp"
# include "../mmo/timer.t.hpp"
# include "magic-interpreter.t.hpp"
@@ -44,10 +45,6 @@ struct Damage
ATK dmg_lv;
};
-struct map_session_data;
-struct mob_data;
-struct block_list;
-
// ダメージ計算
struct Damage battle_calc_attack(BF attack_type,
diff --git a/src/map/battle.t.hpp b/src/map/battle.t.hpp
index 45d75b8..d0d3389 100644
--- a/src/map/battle.t.hpp
+++ b/src/map/battle.t.hpp
@@ -23,6 +23,8 @@
# include "fwd.hpp"
+# include <cstdint>
+
# include "../generic/enum.hpp"
namespace e
diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp
index 3c2ac63..50c62a8 100644
--- a/src/map/chrif.cpp
+++ b/src/map/chrif.cpp
@@ -20,10 +20,6 @@
// 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 <arpa/inet.h>
-
-#include <cstring>
-
#include "../compat/fun.hpp"
#include "../compat/nullpo.hpp"
@@ -32,6 +28,9 @@
#include "../io/cxxstdio.hpp"
+#include "../mmo/human_time_diff.hpp"
+#include "../mmo/ip.hpp"
+#include "../mmo/mmo.hpp"
#include "../mmo/socket.hpp"
#include "../mmo/timer.hpp"
#include "../mmo/utils.hpp"
diff --git a/src/map/chrif.hpp b/src/map/chrif.hpp
index f3fc152..7ac16e5 100644
--- a/src/map/chrif.hpp
+++ b/src/map/chrif.hpp
@@ -25,11 +25,8 @@
# include "../strings/fwd.hpp"
+# include "../mmo/fwd.hpp"
# include "../mmo/dumb_ptr.hpp"
-# include "../mmo/human_time_diff.hpp"
-# include "../mmo/ip.hpp"
-
-# include "map.hpp"
void chrif_setuserid(AccountName);
void chrif_setpasswd(AccountPass);
diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index bdb8609..b19c7eb 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -20,13 +20,11 @@
// 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 <arpa/inet.h>
-
-#include <cstdlib>
-#include <cstring>
+#include <cassert>
#include <ctime>
-#include "../compat/alg.hpp"
+#include <algorithm>
+
#include "../compat/attr.hpp"
#include "../compat/fun.hpp"
#include "../compat/nullpo.hpp"
@@ -37,14 +35,14 @@
#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
-#include "../generic/random.hpp"
-
#include "../io/cxxstdio.hpp"
#include "../io/write.hpp"
+#include "../mmo/ip.hpp"
#include "../mmo/md5more.hpp"
#include "../mmo/socket.hpp"
#include "../mmo/timer.hpp"
+#include "../mmo/utils.hpp"
#include "../mmo/version.hpp"
#include "atcommand.hpp"
diff --git a/src/map/clif.hpp b/src/map/clif.hpp
index cb84ee9..19d5fd3 100644
--- a/src/map/clif.hpp
+++ b/src/map/clif.hpp
@@ -29,11 +29,13 @@
# include "../strings/fwd.hpp"
-# include "../mmo/ip.hpp"
+# include "../mmo/fwd.hpp"
+# include "../mmo/dumb_ptr.hpp"
+# include "../mmo/mmo.hpp"
# include "../mmo/timer.t.hpp"
# include "battle.t.hpp"
-# include "map.hpp"
+# include "map.t.hpp"
# include "pc.t.hpp"
# include "skill.t.hpp"
diff --git a/src/map/fwd.hpp b/src/map/fwd.hpp
index 9801f5c..b4ced2d 100644
--- a/src/map/fwd.hpp
+++ b/src/map/fwd.hpp
@@ -22,6 +22,30 @@
# include "../sanity.hpp"
// meh, add more when I feel like it
+class BlockId;
+struct block_list;
struct map_session_data;
+struct npc_data;
+struct mob_data;
+struct flooritem_data;
+struct invocation;
+struct map_local;
+class npc_data_script;
+class npc_data_shop;
+class npc_data_warp;
+class npc_data_message;
+struct NpcEvent;
+
+struct item_data;
+
+// magic
+struct fun_t;
+struct op_t;
+struct expr_t;
+struct val_t;
+struct location_t;
+struct area_t;
+struct spell_t;
+struct invocation;
#endif // TMWA_MAP_FWD_HPP
diff --git a/src/map/grfio.cpp b/src/map/grfio.cpp
index b03456c..c5ca9a1 100644
--- a/src/map/grfio.cpp
+++ b/src/map/grfio.cpp
@@ -20,25 +20,23 @@
// 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 <sys/stat.h>
-
#include <fcntl.h>
#include <unistd.h>
#include <cassert>
-#include <cstdio>
-#include <cstring>
#include <map>
#include "../strings/mstring.hpp"
#include "../strings/rstring.hpp"
#include "../strings/astring.hpp"
+#include "../strings/zstring.hpp"
#include "../io/cxxstdio.hpp"
#include "../io/read.hpp"
#include "../mmo/extract.hpp"
+#include "../mmo/mmo.hpp"
#include "../poison.hpp"
diff --git a/src/map/grfio.hpp b/src/map/grfio.hpp
index 3083f8c..d9329d3 100644
--- a/src/map/grfio.hpp
+++ b/src/map/grfio.hpp
@@ -27,7 +27,9 @@
# include <vector>
-# include "../mmo/mmo.hpp"
+# include "../strings/fwd.hpp"
+
+# include "../mmo/fwd.hpp"
bool load_resnametable(ZString filename);
diff --git a/src/map/intif.cpp b/src/map/intif.cpp
index 52ea8b0..d0b1ea0 100644
--- a/src/map/intif.cpp
+++ b/src/map/intif.cpp
@@ -20,17 +20,16 @@
// 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 <cstdlib>
-#include <cstring>
-
#include "../compat/nullpo.hpp"
#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
+#include "../strings/literal.hpp"
#include "../io/cxxstdio.hpp"
+#include "../mmo/mmo.hpp"
#include "../mmo/socket.hpp"
#include "battle.hpp"
diff --git a/src/map/intif.hpp b/src/map/intif.hpp
index 529c42e..e05d00f 100644
--- a/src/map/intif.hpp
+++ b/src/map/intif.hpp
@@ -25,7 +25,8 @@
# include "../strings/fwd.hpp"
-# include "map.hpp"
+# include "../mmo/fwd.hpp"
+# include "../mmo/dumb_ptr.hpp"
int intif_parse(Session *);
diff --git a/src/map/itemdb.cpp b/src/map/itemdb.cpp
index 810c488..c88a201 100644
--- a/src/map/itemdb.cpp
+++ b/src/map/itemdb.cpp
@@ -20,24 +20,19 @@
// 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 <cstdlib>
-#include <cstring>
-
-#include "../compat/nullpo.hpp"
+#include <algorithm>
#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
#include "../generic/db.hpp"
-#include "../generic/random.hpp"
#include "../io/cxxstdio.hpp"
#include "../io/read.hpp"
#include "../mmo/config_parse.hpp"
#include "../mmo/extract.hpp"
-#include "../mmo/socket.hpp"
#include "../poison.hpp"
diff --git a/src/map/itemdb.hpp b/src/map/itemdb.hpp
index 06a4af9..1d132ad 100644
--- a/src/map/itemdb.hpp
+++ b/src/map/itemdb.hpp
@@ -23,6 +23,7 @@
# include "fwd.hpp"
+# include "../mmo/ids.hpp"
# include "../mmo/mmo.hpp"
# include "map.t.hpp"
diff --git a/src/map/magic-expr-eval.hpp b/src/map/magic-expr-eval.hpp
index e19c896..ae86774 100644
--- a/src/map/magic-expr-eval.hpp
+++ b/src/map/magic-expr-eval.hpp
@@ -24,9 +24,10 @@
# include "../range/slice.hpp"
+# include "../strings/fwd.hpp"
# include "../strings/zstring.hpp"
-# include "magic-interpreter.hpp"
+# include "magic-interpreter.t.hpp"
/* Helper definitions for dealing with functions and operations */
@@ -36,6 +37,7 @@ int magic_signature_check(ZString opname, ZString funname, ZString signature,
void magic_area_rect(map_local **m, int *x, int *y, int *width, int *height,
area_t& area);
+// TODO kill this like I killed VAR
# define ARGINT(x) args[x].v.v_int
# define ARGDIR(x) args[x].v.v_dir
# define ARGSTR(x) ZString(args[x].v.v_string)
diff --git a/src/map/magic-expr.cpp b/src/map/magic-expr.cpp
index 6a411b7..9f3f63e 100644
--- a/src/map/magic-expr.cpp
+++ b/src/map/magic-expr.cpp
@@ -22,24 +22,28 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <cassert>
-#include <cmath>
-#include "../compat/alg.hpp"
+#include <algorithm>
#include "../strings/mstring.hpp"
#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../strings/vstring.hpp"
+#include "../strings/literal.hpp"
#include "../generic/random.hpp"
#include "../io/cxxstdio.hpp"
+#include "../mmo/dumb_ptr.hpp"
+
#include "battle.hpp"
#include "npc.hpp"
#include "pc.hpp"
#include "itemdb.hpp"
+#include "magic-interpreter.hpp"
+
#include "../poison.hpp"
static
diff --git a/src/map/magic-expr.hpp b/src/map/magic-expr.hpp
index bbe8bbf..007491c 100644
--- a/src/map/magic-expr.hpp
+++ b/src/map/magic-expr.hpp
@@ -24,10 +24,12 @@
# include "magic-interpreter.hpp"
-# include "../range/slice.hpp"
+# include "../mmo/dumb_ptr.hpp"
+
+# include "../range/fwd.hpp"
-# include "../strings/fwd.hpp"
# include "../strings/zstring.hpp"
+# include "../strings/literal.hpp"
/*
* Argument types:
diff --git a/src/map/magic-interpreter-base.cpp b/src/map/magic-interpreter-base.cpp
index 5d8aa35..a7c5496 100644
--- a/src/map/magic-interpreter-base.cpp
+++ b/src/map/magic-interpreter-base.cpp
@@ -1,4 +1,5 @@
#include "magic-interpreter-base.hpp"
+#include "magic.hpp"
// magic-interpreter-base.cpp - Core of the old magic system.
//
// Copyright © 2004-2011 The Mana World Development Team
@@ -19,7 +20,8 @@
// 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 "magic-interpreter-aux.hpp"
+#include <algorithm>
+
#include "magic-interpreter.hpp"
#include "../strings/astring.hpp"
@@ -296,7 +298,7 @@ int spellguard_can_satisfy(spellguard_check_t *check, dumb_ptr<map_session_data>
interval_t casttime = check->casttime;
if (env->VAR(VAR_MIN_CASTTIME).ty == TYPE::INT)
- casttime = max(casttime, static_cast<interval_t>(env->VAR(VAR_MIN_CASTTIME).v.v_int));
+ casttime = std::max(casttime, static_cast<interval_t>(env->VAR(VAR_MIN_CASTTIME).v.v_int));
caster->cast_tick = tick + casttime; /* Make sure not to cast too frequently */
diff --git a/src/map/magic-interpreter.hpp b/src/map/magic-interpreter.hpp
index 65c64e3..16fc447 100644
--- a/src/map/magic-interpreter.hpp
+++ b/src/map/magic-interpreter.hpp
@@ -26,23 +26,20 @@
# include <cassert>
+# include <memory>
+
# include "../strings/fwd.hpp"
# include "../strings/rstring.hpp"
-# include "magic.hpp"
+# include "../mmo/dumb_ptr.hpp"
+# include "../mmo/ids.hpp"
+# include "../mmo/timer.t.hpp"
+# include "../mmo/utils.hpp"
+
# include "map.hpp"
# include "script.hpp"
# include "skill.t.hpp"
-struct fun_t;
-struct op_t;
-struct expr_t;
-struct val_t;
-struct location_t;
-struct area_t;
-struct spell_t;
-struct invocation;
-
struct location_t
{
map_local *m;
@@ -319,8 +316,6 @@ struct magic_conf_t
# define VAR_SCRIPTTARGET 7
# define VAR_LOCATION 8
-struct magic_config;
-
struct env_t
{
magic_conf_t *base_env;
diff --git a/src/map/magic-stmt.cpp b/src/map/magic-stmt.cpp
index 8e4751d..5710828 100644
--- a/src/map/magic-stmt.cpp
+++ b/src/map/magic-stmt.cpp
@@ -1,4 +1,5 @@
#include "magic-stmt.hpp"
+#include "magic.hpp"
// magic-stmt.cpp - Imperative commands for the magic backend.
//
// Copyright © 2004-2011 The Mana World Development Team
@@ -35,7 +36,6 @@
#include "magic-expr.hpp"
#include "magic-expr-eval.hpp"
#include "magic-interpreter.hpp"
-#include "magic-interpreter-aux.hpp"
#include "battle.hpp"
#include "clif.hpp"
diff --git a/src/map/magic-v2.cpp b/src/map/magic-v2.cpp
index 288e512..0239438 100644
--- a/src/map/magic-v2.cpp
+++ b/src/map/magic-v2.cpp
@@ -18,14 +18,25 @@
// 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 <cstddef>
+
+#include <algorithm>
+#include <map>
#include <set>
+#include "../strings/rstring.hpp"
+#include "../strings/literal.hpp"
+
+#include "../io/cxxstdio.hpp"
+#include "../io/line.hpp"
+
#include "../sexpr/parser.hpp"
#include "../mmo/dumb_ptr.hpp"
#include "itemdb.hpp"
#include "magic-expr.hpp"
+#include "magic-interpreter.hpp"
#include "../poison.hpp"
diff --git a/src/map/magic.cpp b/src/map/magic.cpp
index 4ca5c4f..fec8372 100644
--- a/src/map/magic.cpp
+++ b/src/map/magic.cpp
@@ -18,14 +18,18 @@
// 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 <cstring>
+#include <algorithm>
+#include <utility>
#include "../strings/xstring.hpp"
#include "../io/cxxstdio.hpp"
+#include "../mmo/dumb_ptr.hpp"
+
#include "magic-interpreter.hpp"
+#include "map.hpp"
#include "pc.hpp"
#include "magic-expr.hpp"
diff --git a/src/map/magic.hpp b/src/map/magic.hpp
index 7a1a6e0..642ae21 100644
--- a/src/map/magic.hpp
+++ b/src/map/magic.hpp
@@ -26,11 +26,9 @@
# include "../mmo/dumb_ptr.hpp"
-# include "map.hpp"
+# include "map.t.hpp"
# include "skill.t.hpp"
-struct invocation; /* Spell invocation */
-
/**
* Try to cast magic.
*
diff --git a/src/map/main.cpp b/src/map/main.cpp
index 2db1408..8354f1c 100644
--- a/src/map/main.cpp
+++ b/src/map/main.cpp
@@ -1,4 +1,3 @@
-#include "map.hpp"
// map/main.cpp - dummy file to make Make dependencies work
//
// Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com>
@@ -18,4 +17,6 @@
// 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 "map.hpp"
+
#include "../poison.hpp"
diff --git a/src/map/map.cpp b/src/map/map.cpp
index 8ca0ba7..c98c315 100644
--- a/src/map/map.cpp
+++ b/src/map/map.cpp
@@ -29,7 +29,6 @@
#include <cassert>
#include <cstdlib>
-#include <cstring>
#include "../compat/nullpo.hpp"
#include "../compat/fun.hpp"
@@ -40,6 +39,7 @@
#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
#include "../strings/vstring.hpp"
+#include "../strings/literal.hpp"
#include "../generic/db.hpp"
#include "../generic/random2.hpp"
@@ -54,6 +54,7 @@
#include "../mmo/extract.hpp"
#include "../mmo/socket.hpp"
#include "../mmo/timer.hpp"
+#include "../mmo/utils.hpp"
#include "../mmo/version.hpp"
#include "atcommand.hpp"
@@ -63,7 +64,7 @@
#include "grfio.hpp"
#include "itemdb.hpp"
#include "magic.hpp"
-#include "magic-interpreter.hpp"
+#include "magic-interpreter.hpp" // for is_spell inline body
#include "magic-v2.hpp"
#include "mob.hpp"
#include "npc.hpp"
@@ -114,6 +115,10 @@ void SessionDeleter::operator()(SessionData *sd)
really_delete1 static_cast<map_session_data *>(sd);
}
+VString<49> convert_for_printf(NpcEvent ev)
+{
+ return STRNPRINTF(50, "%s::%s"_fmt, ev.npc, ev.label);
+}
bool extract(XString str, NpcEvent *ev)
{
XString mid;
diff --git a/src/map/map.hpp b/src/map/map.hpp
index 620dc52..2bc8e45 100644
--- a/src/map/map.hpp
+++ b/src/map/map.hpp
@@ -25,8 +25,7 @@
# include "map.t.hpp"
-# include <netinet/in.h>
-
+# include <chrono>
# include <functional>
# include <list>
@@ -40,10 +39,9 @@
# include "../generic/db.hpp"
# include "../generic/matrix.hpp"
-# include "../io/cxxstdio.hpp"
-
# include "../mmo/socket.hpp"
# include "../mmo/timer.t.hpp"
+# include "../mmo/utils.hpp"
# include "battle.t.hpp"
# include "magic-interpreter.t.hpp"
@@ -91,20 +89,10 @@ struct NpcEvent
return l.npc < r.npc || (l.npc == r.npc && l.label < r.label);
}
- friend VString<49> convert_for_printf(NpcEvent ev)
- {
- return STRNPRINTF(50, "%s::%s"_fmt, ev.npc, ev.label);
- }
+ friend VString<49> convert_for_printf(NpcEvent ev);
};
bool extract(XString str, NpcEvent *ev);
-struct map_session_data;
-struct npc_data;
-struct mob_data;
-struct flooritem_data;
-struct invocation;
-struct map_local;
-
struct block_list
{
dumb_ptr<block_list> bl_next, bl_prev;
@@ -146,11 +134,6 @@ struct status_change
BlockId spell_invocation; /* [Fate] If triggered by a spell, record here */
};
-struct invocation;
-
-struct npc_data;
-struct item_data;
-
struct quick_regeneration
{ // [Fate]
int amount; // Amount of HP/SP left to regenerate
@@ -358,14 +341,12 @@ struct npc_item_list
int value;
};
-class npc_data_script;
-class npc_data_shop;
-class npc_data_warp;
-class npc_data_message;
struct npc_data : block_list
{
NpcSubtype npc_subtype;
short n;
+ // TODO This *should* be a Species, but the script files give -1 for
+ // event-only which is not valid unsigned
short npc_class;
DIR dir;
interval_t speed;
diff --git a/src/map/map.t.hpp b/src/map/map.t.hpp
index d90bdab..10aeb75 100644
--- a/src/map/map.t.hpp
+++ b/src/map/map.t.hpp
@@ -23,8 +23,12 @@
# include "fwd.hpp"
+# include <cstdint>
+
# include "../strings/vstring.hpp"
+# include "../generic/enum.hpp"
+
# include "../mmo/ids.hpp"
# include "../mmo/mmo.hpp"
diff --git a/src/map/mapflag.hpp b/src/map/mapflag.hpp
index c8eec1d..5e36055 100644
--- a/src/map/mapflag.hpp
+++ b/src/map/mapflag.hpp
@@ -21,9 +21,9 @@
# include "fwd.hpp"
-# include "../mmo/extract.hpp" // TODO remove this (requires specializing the *other* half)
+# include <cstdint>
-# include "../strings/xstring.hpp"
+# include "../mmo/extract.hpp" // TODO remove this (requires specializing the *other* half)
// originally from script.cpp
// These are part of the script API, so they can't change ever,
diff --git a/src/map/mob.cpp b/src/map/mob.cpp
index 122fa98..923b369 100644
--- a/src/map/mob.cpp
+++ b/src/map/mob.cpp
@@ -23,8 +23,6 @@
#include <cassert>
#include <cmath>
-#include <cstdlib>
-#include <cstring>
#include <algorithm>
@@ -32,6 +30,7 @@
#include "../compat/nullpo.hpp"
#include "../strings/astring.hpp"
+#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
#include "../generic/random.hpp"
diff --git a/src/map/mob.hpp b/src/map/mob.hpp
index d39a2ac..48d7df5 100644
--- a/src/map/mob.hpp
+++ b/src/map/mob.hpp
@@ -26,10 +26,11 @@
# include "mob.t.hpp"
# include "../generic/random.t.hpp"
+# include "../generic/enum.hpp"
-# include "../mmo/mmo.hpp"
# include "../mmo/timer.t.hpp"
+# include "battle.t.hpp"
# include "clif.t.hpp"
# include "map.hpp"
# include "skill.t.hpp"
diff --git a/src/map/npc.cpp b/src/map/npc.cpp
index 9f606de..32711d0 100644
--- a/src/map/npc.cpp
+++ b/src/map/npc.cpp
@@ -21,10 +21,9 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <cassert>
-#include <cstdlib>
-#include <cstring>
#include <ctime>
+#include <algorithm>
#include <list>
#include "../compat/fun.hpp"
@@ -34,6 +33,7 @@
#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
+#include "../strings/literal.hpp"
#include "../generic/db.hpp"
@@ -42,8 +42,8 @@
#include "../mmo/config_parse.hpp"
#include "../mmo/extract.hpp"
-#include "../mmo/socket.hpp"
#include "../mmo/timer.hpp"
+#include "../mmo/utils.hpp"
#include "battle.hpp"
#include "clif.hpp"
diff --git a/src/map/npc.hpp b/src/map/npc.hpp
index 3800fb7..d8930c8 100644
--- a/src/map/npc.hpp
+++ b/src/map/npc.hpp
@@ -23,7 +23,6 @@
# include "fwd.hpp"
-# include <cstddef>
# include <cstdint>
# include "../strings/fwd.hpp"
@@ -34,6 +33,7 @@
constexpr BlockId START_NPC_NUM = wrap<BlockId>(110000000);
+// TODO make these species, see npc_class in npc_data
constexpr int WARP_CLASS = 45;
constexpr int WARP_DEBUG_CLASS = 722;
constexpr int INVISIBLE_CLASS = 32767;
diff --git a/src/map/party.cpp b/src/map/party.cpp
index 7d3c89c..66dc2fa 100644
--- a/src/map/party.cpp
+++ b/src/map/party.cpp
@@ -21,8 +21,6 @@
// 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 <cstring>
-
#include "../compat/nullpo.hpp"
#include "../strings/xstring.hpp"
@@ -31,7 +29,8 @@
#include "../io/cxxstdio.hpp"
-#include "../mmo/socket.hpp"
+#include "../mmo/ids.hpp"
+#include "../mmo/mmo.hpp"
#include "../mmo/timer.hpp"
#include "battle.hpp"
@@ -39,7 +38,6 @@
#include "intif.hpp"
#include "map.hpp"
#include "pc.hpp"
-#include "tmw.hpp"
#include "../poison.hpp"
diff --git a/src/map/party.hpp b/src/map/party.hpp
index bf9777b..4eaffb0 100644
--- a/src/map/party.hpp
+++ b/src/map/party.hpp
@@ -27,11 +27,8 @@
# include "../strings/fwd.hpp"
-# include "map.hpp"
-
-struct party;
-struct map_session_data;
-struct block_list;
+# include "../mmo/fwd.hpp"
+# include "../mmo/dumb_ptr.hpp"
void do_init_party(void);
struct party *party_search(PartyId party_id);
diff --git a/src/map/path.cpp b/src/map/path.cpp
index 5b7ea1f..e0e18b6 100644
--- a/src/map/path.cpp
+++ b/src/map/path.cpp
@@ -22,19 +22,20 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <cassert>
+#include <cstddef>
+#include <cstdlib>
#include "../compat/nullpo.hpp"
-#include "../generic/random.hpp"
+#include "../strings/literal.hpp"
#include "../io/cxxstdio.hpp"
-#include "battle.hpp"
+#include "magic-interpreter.t.hpp"
+#include "map.hpp"
#include "../poison.hpp"
-//#define PATH_STANDALONETEST
-
constexpr int MAX_HEAP = 150;
struct tmp_path
{
diff --git a/src/map/path.hpp b/src/map/path.hpp
index 9bdb520..5f03a90 100644
--- a/src/map/path.hpp
+++ b/src/map/path.hpp
@@ -23,8 +23,6 @@
# include "fwd.hpp"
-# include "map.hpp"
-
int path_search(struct walkpath_data *, map_local *, int, int, int, int, int);
#endif // TMWA_MAP_PATH_HPP
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index 2526f1d..47e45a5 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -23,16 +23,16 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <cassert>
-#include <cstdlib>
-#include <cstring>
-#include "../compat/alg.hpp"
+#include <algorithm>
+
#include "../compat/fun.hpp"
#include "../compat/nullpo.hpp"
#include "../strings/rstring.hpp"
#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
+#include "../strings/literal.hpp"
#include "../generic/random.hpp"
@@ -41,6 +41,7 @@
#include "../mmo/socket.hpp"
#include "../mmo/timer.hpp"
+#include "../mmo/utils.hpp"
#include "atcommand.hpp"
#include "battle.hpp"
@@ -50,7 +51,6 @@
#include "itemdb.hpp"
#include "magic.hpp"
#include "map.hpp"
-#include "mob.hpp"
#include "npc.hpp"
#include "party.hpp"
#include "path.hpp"
diff --git a/src/map/pc.hpp b/src/map/pc.hpp
index b02e5a7..412953d 100644
--- a/src/map/pc.hpp
+++ b/src/map/pc.hpp
@@ -27,6 +27,8 @@
# include "../strings/fwd.hpp"
+# include "../mmo/utils.hpp"
+
# include "clif.t.hpp"
# include "map.hpp"
diff --git a/src/map/script.cpp b/src/map/script.cpp
index f3713df..7abea69 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -23,12 +23,11 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <cassert>
-#include <cctype>
#include <cmath>
#include <cstdlib>
-#include <cstring>
#include <ctime>
+#include <algorithm>
#include <set>
#include "../compat/fun.hpp"
@@ -38,6 +37,7 @@
#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
+#include "../strings/literal.hpp"
#include "../generic/db.hpp"
#include "../generic/intern-pool.hpp"
@@ -46,13 +46,14 @@
#include "../io/cxxstdio.hpp"
#include "../io/lock.hpp"
#include "../io/read.hpp"
+#include "../io/write.hpp"
-#include "../mmo/config_parse.hpp"
#include "../mmo/core.hpp"
#include "../mmo/extract.hpp"
+#include "../mmo/human_time_diff.hpp"
#include "../mmo/socket.hpp"
-#include "../mmo/utils.hpp"
#include "../mmo/timer.hpp"
+#include "../mmo/utils.hpp"
#include "atcommand.hpp"
#include "battle.hpp"
diff --git a/src/map/script.hpp b/src/map/script.hpp
index 9b9c805..11a9289 100644
--- a/src/map/script.hpp
+++ b/src/map/script.hpp
@@ -24,20 +24,16 @@
# include "fwd.hpp"
# include <cstdint>
-# include <cstring> // for inlined get_str - TODO remove
# include <vector>
# include "../range/slice.hpp"
-# include "../strings/rstring.hpp"
-# include "../strings/astring.hpp"
# include "../strings/zstring.hpp"
# include "../generic/db.hpp"
# include "../mmo/dumb_ptr.hpp"
-# include "../mmo/utils.hpp"
# include "map.t.hpp"
@@ -180,7 +176,6 @@ struct argrec_t
int run_script_l(ScriptPointer, BlockId, BlockId, Slice<argrec_t> args);
int run_script(ScriptPointer, BlockId, BlockId);
-struct ScriptLabel;
extern
Map<ScriptLabel, int> scriptlabel_db;
extern
diff --git a/src/map/skill-pools.cpp b/src/map/skill-pools.cpp
index 49496bb..9101d6a 100644
--- a/src/map/skill-pools.cpp
+++ b/src/map/skill-pools.cpp
@@ -1,3 +1,4 @@
+#include "skill-pools.hpp"
#include "skill.hpp"
// skill-pools.cpp - Additional support for focusable skills.
//
diff --git a/src/map/skill.cpp b/src/map/skill.cpp
index f9eeff1..ab14427 100644
--- a/src/map/skill.cpp
+++ b/src/map/skill.cpp
@@ -22,9 +22,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <cassert>
-#include <cstdlib>
-#include <cstring>
-#include <ctime>
+
+#include <algorithm>
#include "../compat/attr.hpp"
#include "../compat/fun.hpp"
@@ -32,7 +31,10 @@
#include "../strings/mstring.hpp"
#include "../strings/rstring.hpp"
+#include "../strings/astring.hpp"
+#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
+#include "../strings/literal.hpp"
#include "../generic/random.hpp"
@@ -40,13 +42,11 @@
#include "../io/read.hpp"
#include "../mmo/extract.hpp"
-#include "../mmo/socket.hpp"
#include "../mmo/timer.hpp"
#include "battle.hpp"
#include "clif.hpp"
#include "magic.hpp"
-#include "map.hpp"
#include "mob.hpp"
#include "pc.hpp"
diff --git a/src/map/skill.hpp b/src/map/skill.hpp
index 87cc576..3c162d5 100644
--- a/src/map/skill.hpp
+++ b/src/map/skill.hpp
@@ -28,7 +28,9 @@
# include "../strings/fwd.hpp"
# include "../strings/rstring.hpp"
-# include "../strings/astring.hpp"
+# include "../strings/literal.hpp"
+
+# include "../generic/array.hpp"
# include "map.hpp"
@@ -76,9 +78,6 @@ extern struct skill_name_db skill_names[];
skill_name_db& skill_lookup_by_id(SkillID id);
skill_name_db& skill_lookup_by_name(XString name);
-struct block_list;
-struct map_session_data;
-
bool skill_readdb(ZString filename);
// スキルデータベースへのアクセサ
diff --git a/src/map/storage.cpp b/src/map/storage.cpp
index 41c31cc..b88c1ea 100644
--- a/src/map/storage.cpp
+++ b/src/map/storage.cpp
@@ -1,14 +1,32 @@
#include "storage.hpp"
-// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
-// For more information, see COPYING in the main folder
-
-#include <cstdlib>
-#include <cstring>
+// storage.cpp - Storage handling.
+//
+// Copyright © ????-2004 Athena Dev Teams
+// Copyright © 2004-2011 The Mana World Development Team
+// Copyright © 2011-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 "../compat/nullpo.hpp"
#include "../generic/db.hpp"
+#include "../mmo/ids.hpp"
+#include "../mmo/mmo.hpp"
+
#include "chrif.hpp"
#include "clif.hpp"
#include "intif.hpp"
diff --git a/src/map/storage.hpp b/src/map/storage.hpp
index bdfc049..4101893 100644
--- a/src/map/storage.hpp
+++ b/src/map/storage.hpp
@@ -23,7 +23,8 @@
# include "fwd.hpp"
-# include "map.hpp"
+# include "../mmo/fwd.hpp"
+# include "../mmo/dumb_ptr.hpp"
int storage_storageopen(dumb_ptr<map_session_data> sd);
int storage_storageadd(dumb_ptr<map_session_data> sd, int index, int amount);
diff --git a/src/map/tmw.cpp b/src/map/tmw.cpp
index 8a1c9f7..38b96ce 100644
--- a/src/map/tmw.cpp
+++ b/src/map/tmw.cpp
@@ -19,17 +19,18 @@
// 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 <cctype>
-#include <cstring>
-
#include "../compat/nullpo.hpp"
#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
+#include "../strings/literal.hpp"
#include "../io/cxxstdio.hpp"
+#include "../mmo/human_time_diff.hpp"
+#include "../mmo/utils.hpp"
+
#include "atcommand.hpp"
#include "battle.hpp"
#include "chrif.hpp"
diff --git a/src/map/tmw.hpp b/src/map/tmw.hpp
index 9b11d64..14bf8cc 100644
--- a/src/map/tmw.hpp
+++ b/src/map/tmw.hpp
@@ -26,8 +26,6 @@
# include "../mmo/dumb_ptr.hpp"
-# include "map.hpp"
-
int tmw_CheckChatSpam(dumb_ptr<map_session_data> sd, XString message);
void tmw_GmHackMsg(ZString line);
diff --git a/src/map/trade.hpp b/src/map/trade.hpp
index da0d2b2..1514999 100644
--- a/src/map/trade.hpp
+++ b/src/map/trade.hpp
@@ -23,7 +23,7 @@
# include "fwd.hpp"
-# include "map.hpp"
+# include "../mmo/dumb_ptr.hpp"
void trade_traderequest(dumb_ptr<map_session_data> sd, BlockId target_id);
void trade_tradeack(dumb_ptr<map_session_data> sd, int type);
diff --git a/src/mmo/config_parse.cpp b/src/mmo/config_parse.cpp
index a6dfd6e..c6ddde2 100644
--- a/src/mmo/config_parse.cpp
+++ b/src/mmo/config_parse.cpp
@@ -18,6 +18,8 @@
// 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 <algorithm>
+
#include "../strings/xstring.hpp"
#include "../strings/zstring.hpp"
diff --git a/src/mmo/core.cpp b/src/mmo/core.cpp
index 8b3690a..68b5863 100644
--- a/src/mmo/core.cpp
+++ b/src/mmo/core.cpp
@@ -22,15 +22,13 @@
#include <sys/wait.h>
-#include <unistd.h>
+#include <alloca.h>
#include <csignal>
#include <cstdlib>
-#include <ctime>
#include "../strings/zstring.hpp"
-
-#include "../generic/random.hpp"
+#include "../strings/literal.hpp"
#include "../io/cxxstdio.hpp"
diff --git a/src/mmo/dumb_ptr.hpp b/src/mmo/dumb_ptr.hpp
index aa17ecd..6501b74 100644
--- a/src/mmo/dumb_ptr.hpp
+++ b/src/mmo/dumb_ptr.hpp
@@ -24,6 +24,7 @@
# include <cstring>
# include <algorithm>
+# include <utility>
# include "../strings/astring.hpp"
# include "../strings/zstring.hpp"
@@ -199,10 +200,6 @@ struct dumb_string
std::copy(b, e, &rv.impl[0]);
return rv;
}
- static dumb_string copy(const char *sz)
- {
- return dumb_string::copy(sz, sz + strlen(sz));
- }
static dumb_string copys(XString s)
{
return dumb_string::copy(&*s.begin(), &*s.end());
@@ -227,7 +224,7 @@ struct dumb_string
dumb_string dup() const
{
- return dumb_string::copy(&impl[0]);
+ return dumb_string::copy(&impl[0], &impl[0] + impl.size());
}
void delete_()
{
diff --git a/src/mmo/extract.cpp b/src/mmo/extract.cpp
index f25126f..b0a01f1 100644
--- a/src/mmo/extract.cpp
+++ b/src/mmo/extract.cpp
@@ -18,6 +18,8 @@
// 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 <algorithm>
+
#include "../strings/astring.hpp"
#include "../strings/xstring.hpp"
#include "../strings/vstring.hpp"
diff --git a/src/mmo/fwd.hpp b/src/mmo/fwd.hpp
index f9c176c..65e8dfe 100644
--- a/src/mmo/fwd.hpp
+++ b/src/mmo/fwd.hpp
@@ -24,9 +24,13 @@
// meh, add more when I feel like it
class MapName;
class CharName;
+class CharPair;
class Session;
+class HumanTimeDiff;
+class IP4Address;
+
class AccountId;
class CharId;
class PartyId;
@@ -34,4 +38,16 @@ class ItemUnkId;
class ItemNameId;
class GmLevel;
+class AccountName;
+class AccountPass;
+class AccountCrypt;
+class AccountEmail;
+class ServerName;
+class PartyName;
+class VarName;
+class MapName;
+class CharName;
+
+class TimerData;
+
#endif // TMWA_MMO_FWD_HPP
diff --git a/src/mmo/human_time_diff.hpp b/src/mmo/human_time_diff.hpp
index 5552e2b..0340a4b 100644
--- a/src/mmo/human_time_diff.hpp
+++ b/src/mmo/human_time_diff.hpp
@@ -21,6 +21,8 @@
# include "fwd.hpp"
+# include <algorithm>
+
# include "../strings/xstring.hpp"
# include "extract.hpp"
diff --git a/src/mmo/ip.cpp b/src/mmo/ip.cpp
index 67d6435..7c243ea 100644
--- a/src/mmo/ip.cpp
+++ b/src/mmo/ip.cpp
@@ -23,6 +23,8 @@
#include "../io/cxxstdio.hpp"
+#include "extract.hpp"
+
#include "../poison.hpp"
bool extract(XString str, IP4Address *rv)
diff --git a/src/mmo/ip.hpp b/src/mmo/ip.hpp
index c765308..88ad965 100644
--- a/src/mmo/ip.hpp
+++ b/src/mmo/ip.hpp
@@ -23,9 +23,10 @@
# include <netinet/in.h>
-# include "../strings/fwd.hpp"
+# include <cstddef>
+# include <cstdint>
-# include "extract.hpp"
+# include "../strings/fwd.hpp"
// TODO - in the long run ports belong here also
// and of course, IPv6 stuff.
diff --git a/src/mmo/ip_test.cpp b/src/mmo/ip_test.cpp
index 01f714e..3c4d2ef 100644
--- a/src/mmo/ip_test.cpp
+++ b/src/mmo/ip_test.cpp
@@ -20,6 +20,9 @@
#include <gtest/gtest.h>
+#include "../strings/vstring.hpp"
+#include "../strings/literal.hpp"
+
#include "../io/cxxstdio.hpp"
#include "../poison.hpp"
diff --git a/src/mmo/md5more.cpp b/src/mmo/md5more.cpp
index cc17d37..c311583 100644
--- a/src/mmo/md5more.cpp
+++ b/src/mmo/md5more.cpp
@@ -20,11 +20,17 @@
// 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 <algorithm>
+
#include "../compat/rawmem.hpp"
#include "../generic/random.hpp"
#include "../io/cxxstdio.hpp"
+#include "../io/read.hpp"
+
+#include "../mmo/ip.hpp"
+#include "../mmo/mmo.hpp"
#include "../poison.hpp"
diff --git a/src/mmo/md5more.hpp b/src/mmo/md5more.hpp
index 6884bee..4b9895d 100644
--- a/src/mmo/md5more.hpp
+++ b/src/mmo/md5more.hpp
@@ -25,10 +25,7 @@
# include "../generic/md5.hpp"
-# include "../io/read.hpp"
-
-# include "ip.hpp"
-# include "mmo.hpp"
+# include "../io/fwd.hpp"
MD5_state MD5_from_FILE(io::ReadFile& in);
diff --git a/src/mmo/mmo.hpp b/src/mmo/mmo.hpp
index fdfc478..15c3fa5 100644
--- a/src/mmo/mmo.hpp
+++ b/src/mmo/mmo.hpp
@@ -23,10 +23,13 @@
# include "fwd.hpp"
+# include <algorithm>
+
# include "../compat/memory.hpp"
# include "../strings/vstring.hpp"
+# include "../generic/array.hpp"
# include "../generic/enum.hpp"
# include "ids.hpp"
@@ -64,20 +67,6 @@ constexpr int MAX_PARTY = 12;
# define MIN_CLOTH_COLOR battle_config.min_cloth_color
# define MAX_CLOTH_COLOR battle_config.max_cloth_color
-template<class T, size_t n>
-struct Array
-{
- T data[n];
-public:
- T& operator [](size_t i) { assert (i < n); return data[i]; }
- const T& operator [](size_t i) const { assert (i < n); return data[i]; }
-
- T *begin() { return data + 0; }
- T *end() { return data + n; }
- const T *begin() const { return data + 0; }
- const T *end() const { return data + n; }
-};
-
struct AccountName : VString<23> {};
struct AccountPass : VString<23> {};
struct AccountCrypt : VString<39> {};
diff --git a/src/mmo/socket.cpp b/src/mmo/socket.cpp
index 8714062..1d6094c 100644
--- a/src/mmo/socket.cpp
+++ b/src/mmo/socket.cpp
@@ -21,25 +21,23 @@
// 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 <arpa/inet.h>
#include <netinet/tcp.h>
#include <sys/socket.h>
-//#include <sys/types.h>
#include <fcntl.h>
-#include <unistd.h>
#include <cstdlib>
-#include <cstring>
-#include <ctime>
+
+#include <array>
#include "../compat/memory.hpp"
#include "../io/cxxstdio.hpp"
+#include "../mmo/utils.hpp"
+
#include "core.hpp"
#include "timer.hpp"
-#include "utils.hpp"
#include "../poison.hpp"
diff --git a/src/mmo/socket.hpp b/src/mmo/socket.hpp
index f62ca7a..ff10c64 100644
--- a/src/mmo/socket.hpp
+++ b/src/mmo/socket.hpp
@@ -23,13 +23,13 @@
# include "fwd.hpp"
-# include <netinet/in.h>
+# include <algorithm>
-# include <cstdio>
+# include <sys/select.h>
-# include <array>
# include <memory>
+# include "../compat/iter.hpp"
# include "../compat/rawmem.hpp"
# include "../strings/astring.hpp"
@@ -52,7 +52,6 @@ struct SessionDeleter
void operator()(SessionData *sd);
};
-struct Session;
struct SessionIO
{
void (*func_recv)(Session *);
diff --git a/src/mmo/timer.cpp b/src/mmo/timer.cpp
index 6e28a12..a85b8be 100644
--- a/src/mmo/timer.cpp
+++ b/src/mmo/timer.cpp
@@ -24,16 +24,12 @@
#include <sys/time.h>
#include <cassert>
-#include <cstring>
+#include <algorithm>
#include <queue>
#include "../strings/zstring.hpp"
-#include "../io/cxxstdio.hpp"
-
-#include "utils.hpp"
-
#include "../poison.hpp"
struct TimerData
diff --git a/src/mmo/timer.t.hpp b/src/mmo/timer.t.hpp
index a1d05ef..549959a 100644
--- a/src/mmo/timer.t.hpp
+++ b/src/mmo/timer.t.hpp
@@ -28,8 +28,6 @@
# include "dumb_ptr.hpp"
-struct TimerData;
-
/// An implementation of the C++ "clock" concept, exposing
/// durations in milliseconds.
class milli_clock
diff --git a/src/mmo/utils.cpp b/src/mmo/utils.cpp
index 5765eaf..30f60b1 100644
--- a/src/mmo/utils.cpp
+++ b/src/mmo/utils.cpp
@@ -20,12 +20,10 @@
// 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 <netinet/in.h>
#include <sys/time.h>
#include <algorithm>
-#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
diff --git a/src/mmo/utils.hpp b/src/mmo/utils.hpp
index ed48ad0..9837358 100644
--- a/src/mmo/utils.hpp
+++ b/src/mmo/utils.hpp
@@ -23,9 +23,6 @@
# include "fwd.hpp"
-# include <sys/types.h>
-
-# include <cstdio>
# include <ctime>
# include <type_traits>
diff --git a/src/monitor/main.cpp b/src/monitor/main.cpp
index 7bc7287..f3db1b6 100644
--- a/src/monitor/main.cpp
+++ b/src/monitor/main.cpp
@@ -30,6 +30,7 @@
#include "../strings/astring.hpp"
#include "../strings/zstring.hpp"
#include "../strings/xstring.hpp"
+#include "../strings/literal.hpp"
#include "../io/cxxstdio.hpp"
#include "../io/fd.hpp"
diff --git a/src/range/fwd.hpp b/src/range/fwd.hpp
index 31263fb..0c22595 100644
--- a/src/range/fwd.hpp
+++ b/src/range/fwd.hpp
@@ -22,5 +22,7 @@
# include "../sanity.hpp"
// meh, add more when I feel like it
+template<class T>
+class Slice;
#endif // TMWA_RANGE_FWD_HPP
diff --git a/src/range/slice.tcc b/src/range/slice.tcc
index 3a1ceb5..f3406ee 100644
--- a/src/range/slice.tcc
+++ b/src/range/slice.tcc
@@ -19,8 +19,6 @@
#include <cassert>
-#include <algorithm>
-
// simple pointer-wrapping iterator
template<class T>
class Slice<T>::iterator
diff --git a/src/sexpr/lexer.cpp b/src/sexpr/lexer.cpp
index cc7087b..a032c92 100644
--- a/src/sexpr/lexer.cpp
+++ b/src/sexpr/lexer.cpp
@@ -19,6 +19,8 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "../strings/mstring.hpp"
+#include "../strings/vstring.hpp"
+#include "../strings/literal.hpp"
#include "../io/cxxstdio.hpp"
diff --git a/src/sexpr/lexer.hpp b/src/sexpr/lexer.hpp
index 89380b7..2fec51a 100644
--- a/src/sexpr/lexer.hpp
+++ b/src/sexpr/lexer.hpp
@@ -23,9 +23,8 @@
# include <vector>
+# include "../strings/fwd.hpp"
# include "../strings/astring.hpp"
-# include "../strings/vstring.hpp"
-# include "../strings/xstring.hpp"
# include "../strings/zstring.hpp"
# include "../io/line.hpp"
diff --git a/src/sexpr/lexer_test.cpp b/src/sexpr/lexer_test.cpp
index fbff0d8..d356f49 100644
--- a/src/sexpr/lexer_test.cpp
+++ b/src/sexpr/lexer_test.cpp
@@ -20,6 +20,8 @@
#include <gtest/gtest.h>
+#include "../strings/vstring.hpp"
+
#include "../poison.hpp"
static
diff --git a/src/sexpr/parser.cpp b/src/sexpr/parser.cpp
index c096649..00d2480 100644
--- a/src/sexpr/parser.cpp
+++ b/src/sexpr/parser.cpp
@@ -20,6 +20,9 @@
#include <cerrno>
+#include "../strings/zstring.hpp"
+#include "../strings/xstring.hpp"
+
#include "../poison.hpp"
namespace sexpr
diff --git a/src/sexpr/parser.hpp b/src/sexpr/parser.hpp
index 4ce7f2d..ad3ad90 100644
--- a/src/sexpr/parser.hpp
+++ b/src/sexpr/parser.hpp
@@ -23,7 +23,7 @@
# include <cstdlib>
-# include "../strings/zstring.hpp"
+# include "../strings/fwd.hpp"
# include "../io/line.hpp"
diff --git a/src/strings/all.hpp b/src/strings/all.hpp
index c87a403..6b67bee 100644
--- a/src/strings/all.hpp
+++ b/src/strings/all.hpp
@@ -29,6 +29,7 @@
# include "sstring.hpp"
# include "zstring.hpp"
# include "xstring.hpp"
+# include "literal.hpp"
# include "vstring.hpp"
#endif // TMWA_STRINGS_ALL_HPP
diff --git a/src/strings/astring.cpp b/src/strings/astring.cpp
index 61c65b2..15d172b 100644
--- a/src/strings/astring.cpp
+++ b/src/strings/astring.cpp
@@ -18,15 +18,20 @@
// 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 <cstdarg>
+#include <cstdio>
#include <cstdlib>
+#include <algorithm>
+
#include "mstring.hpp"
#include "tstring.hpp"
#include "sstring.hpp"
#include "zstring.hpp"
#include "xstring.hpp"
-#include "vstring.hpp"
+#include "literal.hpp"
+// doing sneaky tricks here
//#include "../poison.hpp"
namespace strings
diff --git a/src/strings/astring.hpp b/src/strings/astring.hpp
index 8558a98..e936c4c 100644
--- a/src/strings/astring.hpp
+++ b/src/strings/astring.hpp
@@ -21,9 +21,6 @@
# include "fwd.hpp"
-# include <cstdarg>
-# include <cstring>
-
# include "base.hpp"
# include "rstring.hpp"
diff --git a/src/strings/base.hpp b/src/strings/base.hpp
index ee7480b..b1aff34 100644
--- a/src/strings/base.hpp
+++ b/src/strings/base.hpp
@@ -19,8 +19,6 @@
// 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 "../sanity.hpp"
-
# include "fwd.hpp"
# include "pair.hpp"
diff --git a/src/strings/base.tcc b/src/strings/base.tcc
index a5a57d0..8b7982b 100644
--- a/src/strings/base.tcc
+++ b/src/strings/base.tcc
@@ -17,6 +17,8 @@
// 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 <cstddef>
+
#include <algorithm>
#include "pair.hpp"
diff --git a/src/strings/base_test.cpp b/src/strings/base_test.cpp
index 6b3ba83..c630b5c 100644
--- a/src/strings/base_test.cpp
+++ b/src/strings/base_test.cpp
@@ -23,6 +23,7 @@
#include "vstring.hpp"
#include "xstring.hpp"
#include "rstring.hpp"
+#include "literal.hpp"
#include "../poison.hpp"
diff --git a/src/strings/literal.hpp b/src/strings/literal.hpp
index a3ebecd..6d84ebd 100644
--- a/src/strings/literal.hpp
+++ b/src/strings/literal.hpp
@@ -21,8 +21,6 @@
# include "fwd.hpp"
-# include <cstring>
-
# include "base.hpp"
namespace strings
diff --git a/src/strings/mstring.hpp b/src/strings/mstring.hpp
index 2da6a78..47becc4 100644
--- a/src/strings/mstring.hpp
+++ b/src/strings/mstring.hpp
@@ -23,8 +23,6 @@
# include <deque>
-# include "base.hpp"
-
namespace strings
{
/// An owning string that is still expected to change.
diff --git a/src/strings/pair.hpp b/src/strings/pair.hpp
index 24537de..cd59537 100644
--- a/src/strings/pair.hpp
+++ b/src/strings/pair.hpp
@@ -19,10 +19,6 @@
// 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 "../sanity.hpp"
-
-# include <cstring>
-
# include "fwd.hpp"
namespace strings
diff --git a/src/strings/rstring.cpp b/src/strings/rstring.cpp
index 671e7b0..6ffe79c 100644
--- a/src/strings/rstring.cpp
+++ b/src/strings/rstring.cpp
@@ -18,13 +18,17 @@
// 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 <cstdio>
+
#include "mstring.hpp"
+#include "astring.hpp"
#include "tstring.hpp"
#include "sstring.hpp"
#include "zstring.hpp"
#include "xstring.hpp"
-#include "vstring.hpp"
+#include "literal.hpp"
+// doing sneaky tricks here
//#include "../poison.hpp"
namespace strings
diff --git a/src/strings/rstring.hpp b/src/strings/rstring.hpp
index 1de3e87..ae8b374 100644
--- a/src/strings/rstring.hpp
+++ b/src/strings/rstring.hpp
@@ -22,7 +22,6 @@
# include "fwd.hpp"
# include <cstdarg>
-# include <cstring>
# include "base.hpp"
diff --git a/src/strings/sstring.cpp b/src/strings/sstring.cpp
index 8de8655..35885e8 100644
--- a/src/strings/sstring.cpp
+++ b/src/strings/sstring.cpp
@@ -18,9 +18,12 @@
// 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 "rstring.hpp"
+#include "astring.hpp"
#include "tstring.hpp"
#include "zstring.hpp"
#include "xstring.hpp"
+#include "literal.hpp"
#include "../poison.hpp"
diff --git a/src/strings/strings2_test.cpp b/src/strings/strings2_test.cpp
index 8c4a343..8a7ee66 100644
--- a/src/strings/strings2_test.cpp
+++ b/src/strings/strings2_test.cpp
@@ -1,4 +1,3 @@
-#include "all.hpp"
// strings2_test.cpp - Testsuite part 2 for strings.
//
// Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com>
@@ -18,9 +17,10 @@
// 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 <gtest/gtest.h>
+#include "all.hpp"
+
#include "../poison.hpp"
TEST(StringTests, traits2)
diff --git a/src/strings/strings_test.cpp b/src/strings/strings_test.cpp
index 3abb5e1..b76bde5 100644
--- a/src/strings/strings_test.cpp
+++ b/src/strings/strings_test.cpp
@@ -1,4 +1,3 @@
-#include "all.hpp"
// strings_test.cpp - Testsuite part 1 for strings.
//
// Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com>
@@ -22,6 +21,8 @@
#include <gtest/gtest.h>
+#include "all.hpp"
+
#include "../poison.hpp"
template<typename T>
diff --git a/src/strings/tstring.cpp b/src/strings/tstring.cpp
index 27e8052..77d4b40 100644
--- a/src/strings/tstring.cpp
+++ b/src/strings/tstring.cpp
@@ -18,9 +18,12 @@
// 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 "rstring.hpp"
+#include "astring.hpp"
#include "sstring.hpp"
#include "zstring.hpp"
#include "xstring.hpp"
+#include "literal.hpp"
#include "../poison.hpp"
diff --git a/src/strings/vstring.tcc b/src/strings/vstring.tcc
index bb134b3..577261a 100644
--- a/src/strings/vstring.tcc
+++ b/src/strings/vstring.tcc
@@ -18,16 +18,16 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <cassert>
+#include <cstdarg>
#include <cstdio>
-#include "../compat/cast.hpp"
-
#include "rstring.hpp"
#include "astring.hpp"
#include "tstring.hpp"
#include "sstring.hpp"
#include "zstring.hpp"
#include "xstring.hpp"
+#include "literal.hpp"
namespace strings
{
diff --git a/src/strings/xstring.cpp b/src/strings/xstring.cpp
index 5312445..2f97c01 100644
--- a/src/strings/xstring.cpp
+++ b/src/strings/xstring.cpp
@@ -18,6 +18,13 @@
// 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 "rstring.hpp"
+#include "astring.hpp"
+#include "tstring.hpp"
+#include "sstring.hpp"
+#include "zstring.hpp"
+#include "literal.hpp"
+
#include "../poison.hpp"
namespace strings
diff --git a/src/strings/xstring.hpp b/src/strings/xstring.hpp
index 96929c7..91371c8 100644
--- a/src/strings/xstring.hpp
+++ b/src/strings/xstring.hpp
@@ -22,7 +22,6 @@
# include "fwd.hpp"
# include "base.hpp"
-# include "literal.hpp"
namespace strings
{
diff --git a/src/strings/zstring.cpp b/src/strings/zstring.cpp
index 323ba5f..dd17e66 100644
--- a/src/strings/zstring.cpp
+++ b/src/strings/zstring.cpp
@@ -18,7 +18,13 @@
// 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 "xstring.hpp"
+#include <cstdio>
+#include <cstring>
+
+#include "rstring.hpp"
+#include "astring.hpp"
+#include "tstring.hpp"
+#include "literal.hpp"
#include "../poison.hpp"
diff --git a/src/strings/zstring.hpp b/src/strings/zstring.hpp
index 3b651b9..e4cd1fd 100644
--- a/src/strings/zstring.hpp
+++ b/src/strings/zstring.hpp
@@ -21,10 +21,7 @@
# include "fwd.hpp"
-# include <cstring>
-
# include "base.hpp"
-# include "literal.hpp"
namespace strings
{
diff --git a/src/strings/zstring.tcc b/src/strings/zstring.tcc
index 3ff7374..eb55f5a 100644
--- a/src/strings/zstring.tcc
+++ b/src/strings/zstring.tcc
@@ -17,8 +17,6 @@
// 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 <cstring>
-
#include "vstring.hpp"
namespace strings
diff --git a/src/tests/test.cpp b/src/tests/test.cpp
index d9cba5e..a45eecf 100644
--- a/src/tests/test.cpp
+++ b/src/tests/test.cpp
@@ -1,4 +1,3 @@
-#include <gtest/gtest.h>
// test.cpp - Driver for testwuite
//
// Copyright © 2013 Ben Longbons <b.r.longbons@gmail.com>
@@ -18,6 +17,8 @@
// 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 <gtest/gtest.h>
+
#include "../poison.hpp"
int main(int argc, char **argv)