summaryrefslogtreecommitdiff
path: root/src/mmo
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-04-24 16:13:40 -0700
committerBen Longbons <b.r.longbons@gmail.com>2014-04-24 16:49:05 -0700
commitc093f4cce643e245ab2048e0782237744208eb9f (patch)
treeedcfb0fbdd57acc1df658d30fe4c87663d938044 /src/mmo
parent5cbd4c728046b4b12d289bf9b7edbc2c7b589fca (diff)
downloadtmwa-c093f4cce643e245ab2048e0782237744208eb9f.tar.gz
tmwa-c093f4cce643e245ab2048e0782237744208eb9f.tar.bz2
tmwa-c093f4cce643e245ab2048e0782237744208eb9f.tar.xz
tmwa-c093f4cce643e245ab2048e0782237744208eb9f.zip
Header cleanup
Diffstat (limited to 'src/mmo')
-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
18 files changed, 52 insertions, 51 deletions
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>