summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2013-01-21 21:50:36 -0800
committerBen Longbons <b.r.longbons@gmail.com>2013-02-01 12:36:51 -0800
commit90f2d2aeffdb345e9fdfc5c3e56fffa71281f2ee (patch)
tree42667ee8211853727c14645c05280e2500a7a994
parentb3ca4bccc4fa6b7f5d637bdecb4fac6ca9649f3c (diff)
downloadtmwa-90f2d2aeffdb345e9fdfc5c3e56fffa71281f2ee.tar.gz
tmwa-90f2d2aeffdb345e9fdfc5c3e56fffa71281f2ee.tar.bz2
tmwa-90f2d2aeffdb345e9fdfc5c3e56fffa71281f2ee.tar.xz
tmwa-90f2d2aeffdb345e9fdfc5c3e56fffa71281f2ee.zip
Remove unnecessary includes, speeding up recompilation
-rw-r--r--GNUmakefile10
-rw-r--r--src/char/char.cpp13
-rw-r--r--src/char/int_party.cpp1
-rw-r--r--src/char/int_storage.cpp14
-rw-r--r--src/char/inter.cpp3
-rw-r--r--src/common/const_array.hpp1
-rw-r--r--src/common/core.cpp4
-rw-r--r--src/common/core.hpp2
-rw-r--r--src/common/cxxstdio.cpp33
-rw-r--r--src/common/cxxstdio.hpp16
-rw-r--r--src/common/db.cpp1
-rw-r--r--src/common/db.hpp1
-rw-r--r--src/common/extract.cpp68
-rw-r--r--src/common/extract.hpp60
-rw-r--r--src/common/grfio.cpp2
-rw-r--r--src/common/lock.hpp4
-rw-r--r--src/common/mmo.hpp2
-rw-r--r--src/common/nullpo.cpp1
-rw-r--r--src/common/nullpo.hpp2
-rw-r--r--src/common/socket.cpp10
-rw-r--r--src/common/socket.hpp3
-rw-r--r--src/common/timer.cpp4
-rw-r--r--src/common/utils.cpp4
-rw-r--r--src/common/utils2.hpp2
-rw-r--r--src/ladmin/ladmin.cpp20
-rw-r--r--src/ladmin/ladmin.hpp6
-rw-r--r--src/login/login.cpp48
-rw-r--r--src/login/login.hpp36
-rw-r--r--src/map/atcommand.cpp15
-rw-r--r--src/map/atcommand.hpp4
-rw-r--r--src/map/battle.cpp6
-rw-r--r--src/map/battle.hpp8
-rw-r--r--src/map/battle.t.hpp2
-rw-r--r--src/map/chat.cpp3
-rw-r--r--src/map/chat.hpp4
-rw-r--r--src/map/chrif.cpp12
-rw-r--r--src/map/chrif.hpp10
-rw-r--r--src/map/clif.cpp31
-rw-r--r--src/map/clif.hpp40
-rw-r--r--src/map/intif.cpp14
-rw-r--r--src/map/intif.hpp6
-rw-r--r--src/map/itemdb.cpp8
-rw-r--r--src/map/itemdb.hpp4
-rw-r--r--src/map/magic-expr-eval.hpp8
-rw-r--r--src/map/magic-expr.cpp6
-rw-r--r--src/map/magic-expr.hpp1
-rw-r--r--src/map/magic-interpreter-base.cpp10
-rw-r--r--src/map/magic-interpreter-lexer.lpp5
-rw-r--r--src/map/magic-interpreter-parser.ypp5
-rw-r--r--src/map/magic-interpreter.hpp27
-rw-r--r--src/map/magic-interpreter.t.hpp2
-rw-r--r--src/map/magic-stmt.cpp7
-rw-r--r--src/map/magic.cpp6
-rw-r--r--src/map/magic.hpp3
-rw-r--r--src/map/map.cpp6
-rw-r--r--src/map/map.hpp23
-rw-r--r--src/map/map.t.hpp2
-rw-r--r--src/map/mob.cpp5
-rw-r--r--src/map/mob.hpp21
-rw-r--r--src/map/npc.cpp6
-rw-r--r--src/map/npc.hpp10
-rw-r--r--src/map/party.cpp4
-rw-r--r--src/map/party.hpp12
-rw-r--r--src/map/path.cpp5
-rw-r--r--src/map/pc.cpp16
-rw-r--r--src/map/pc.hpp15
-rw-r--r--src/map/script.cpp10
-rw-r--r--src/map/skill-pools.cpp18
-rw-r--r--src/map/skill.cpp7
-rw-r--r--src/map/skill.hpp17
-rw-r--r--src/map/skill.t.hpp2
-rw-r--r--src/map/storage.cpp4
-rw-r--r--src/map/storage.hpp2
-rw-r--r--src/map/tmw.cpp14
-rw-r--r--src/map/tmw.hpp2
-rw-r--r--src/map/trade.cpp4
-rw-r--r--src/map/trade.hpp2
-rw-r--r--src/tool/eathena-monitor.cpp2
78 files changed, 335 insertions, 492 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 087d4f8..676adfa 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -44,7 +44,7 @@ all: ${PROGS}
most: ${MOSTPROGS}
clean:
rm -rf ${PROGS} ${BUILD_DIR}/
-common: ${BUILD_DIR}/common/core.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/grfio.o ${BUILD_DIR}/common/lock.o ${BUILD_DIR}/common/md5calc.o ${BUILD_DIR}/common/mt_rand.o ${BUILD_DIR}/common/nullpo.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/common/utils.o
+common: ${BUILD_DIR}/common/core.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/grfio.o ${BUILD_DIR}/common/lock.o ${BUILD_DIR}/common/md5calc.o ${BUILD_DIR}/common/mt_rand.o ${BUILD_DIR}/common/nullpo.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/common/utils.o ${BUILD_DIR}/common/cxxstdio.o ${BUILD_DIR}/common/extract.o
# Top level programs
login-server: ${BUILD_DIR}/login/login
@@ -59,10 +59,10 @@ eathena-monitor: ${BUILD_DIR}/tool/eathena-monitor
cp -f $< $@
# Executable dependencies - generated by hand
-${BUILD_DIR}/char/char: ${BUILD_DIR}/char/char.o ${BUILD_DIR}/char/inter.o ${BUILD_DIR}/char/int_party.o ${BUILD_DIR}/char/int_storage.o ${BUILD_DIR}/common/core.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/lock.o ${BUILD_DIR}/common/mt_rand.o ${BUILD_DIR}/common/utils.o
-${BUILD_DIR}/ladmin/ladmin: ${BUILD_DIR}/ladmin/ladmin.o ${BUILD_DIR}/common/md5calc.o ${BUILD_DIR}/common/core.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/mt_rand.o ${BUILD_DIR}/common/utils.o
-${BUILD_DIR}/login/login: ${BUILD_DIR}/login/login.o ${BUILD_DIR}/common/core.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/lock.o ${BUILD_DIR}/common/mt_rand.o ${BUILD_DIR}/common/md5calc.o ${BUILD_DIR}/common/utils.o
-${BUILD_DIR}/map/map: ${BUILD_DIR}/map/map.o ${BUILD_DIR}/map/tmw.o ${BUILD_DIR}/map/magic-interpreter-lexer.o ${BUILD_DIR}/map/magic-interpreter-parser.o ${BUILD_DIR}/map/magic-interpreter-base.o ${BUILD_DIR}/map/magic-expr.o ${BUILD_DIR}/map/magic-stmt.o ${BUILD_DIR}/map/magic.o ${BUILD_DIR}/map/map.o ${BUILD_DIR}/map/chrif.o ${BUILD_DIR}/map/clif.o ${BUILD_DIR}/map/pc.o ${BUILD_DIR}/map/npc.o ${BUILD_DIR}/map/chat.o ${BUILD_DIR}/map/path.o ${BUILD_DIR}/map/itemdb.o ${BUILD_DIR}/map/mob.o ${BUILD_DIR}/map/script.o ${BUILD_DIR}/map/storage.o ${BUILD_DIR}/map/skill.o ${BUILD_DIR}/map/skill-pools.o ${BUILD_DIR}/map/atcommand.o ${BUILD_DIR}/map/battle.o ${BUILD_DIR}/map/intif.o ${BUILD_DIR}/map/trade.o ${BUILD_DIR}/map/party.o ${BUILD_DIR}/common/core.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/common/grfio.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/lock.o ${BUILD_DIR}/common/nullpo.o ${BUILD_DIR}/common/mt_rand.o ${BUILD_DIR}/common/md5calc.o ${BUILD_DIR}/common/utils.o
+${BUILD_DIR}/char/char: ${BUILD_DIR}/char/char.o ${BUILD_DIR}/char/inter.o ${BUILD_DIR}/char/int_party.o ${BUILD_DIR}/char/int_storage.o ${BUILD_DIR}/common/core.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/lock.o ${BUILD_DIR}/common/mt_rand.o ${BUILD_DIR}/common/utils.o ${BUILD_DIR}/common/cxxstdio.o ${BUILD_DIR}/common/extract.o
+${BUILD_DIR}/ladmin/ladmin: ${BUILD_DIR}/ladmin/ladmin.o ${BUILD_DIR}/common/md5calc.o ${BUILD_DIR}/common/core.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/mt_rand.o ${BUILD_DIR}/common/utils.o ${BUILD_DIR}/common/cxxstdio.o
+${BUILD_DIR}/login/login: ${BUILD_DIR}/login/login.o ${BUILD_DIR}/common/core.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/lock.o ${BUILD_DIR}/common/mt_rand.o ${BUILD_DIR}/common/md5calc.o ${BUILD_DIR}/common/utils.o ${BUILD_DIR}/common/cxxstdio.o ${BUILD_DIR}/common/extract.o
+${BUILD_DIR}/map/map: ${BUILD_DIR}/map/map.o ${BUILD_DIR}/map/tmw.o ${BUILD_DIR}/map/magic-interpreter-lexer.o ${BUILD_DIR}/map/magic-interpreter-parser.o ${BUILD_DIR}/map/magic-interpreter-base.o ${BUILD_DIR}/map/magic-expr.o ${BUILD_DIR}/map/magic-stmt.o ${BUILD_DIR}/map/magic.o ${BUILD_DIR}/map/map.o ${BUILD_DIR}/map/chrif.o ${BUILD_DIR}/map/clif.o ${BUILD_DIR}/map/pc.o ${BUILD_DIR}/map/npc.o ${BUILD_DIR}/map/chat.o ${BUILD_DIR}/map/path.o ${BUILD_DIR}/map/itemdb.o ${BUILD_DIR}/map/mob.o ${BUILD_DIR}/map/script.o ${BUILD_DIR}/map/storage.o ${BUILD_DIR}/map/skill.o ${BUILD_DIR}/map/skill-pools.o ${BUILD_DIR}/map/atcommand.o ${BUILD_DIR}/map/battle.o ${BUILD_DIR}/map/intif.o ${BUILD_DIR}/map/trade.o ${BUILD_DIR}/map/party.o ${BUILD_DIR}/common/core.o ${BUILD_DIR}/common/socket.o ${BUILD_DIR}/common/timer.o ${BUILD_DIR}/common/grfio.o ${BUILD_DIR}/common/db.o ${BUILD_DIR}/common/lock.o ${BUILD_DIR}/common/nullpo.o ${BUILD_DIR}/common/mt_rand.o ${BUILD_DIR}/common/md5calc.o ${BUILD_DIR}/common/utils.o ${BUILD_DIR}/common/cxxstdio.o ${BUILD_DIR}/common/extract.o
${BUILD_DIR}/tool/eathena-monitor: ${BUILD_DIR}/tool/eathena-monitor.o
# silence build warnings for code beyond my control
diff --git a/src/char/char.cpp b/src/char/char.cpp
index 093edc3..a45592d 100644
--- a/src/char/char.cpp
+++ b/src/char/char.cpp
@@ -1,31 +1,23 @@
#include "char.hpp"
#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/ioctl.h>
#include <sys/socket.h>
-#include <sys/time.h>
-#include <sys/types.h>
#include <sys/wait.h>
-#include <fcntl.h>
#include <netdb.h>
#include <unistd.h>
-#include <cstdio>
#include <cstdlib>
-#include <csignal>
#include <cstring>
#include <ctime>
#include <fstream>
-#include <algorithm>
#include "../common/core.hpp"
#include "../common/cxxstdio.hpp"
+#include "../common/db.hpp"
#include "../common/extract.hpp"
#include "../common/lock.hpp"
-#include "../common/mmo.hpp"
#include "../common/socket.hpp"
#include "../common/timer.hpp"
#include "../common/version.hpp"
@@ -1279,7 +1271,6 @@ void parse_tologin(int fd)
fd);
login_fd = -1;
}
- close(fd);
delete_session(fd);
return;
}
@@ -1762,7 +1753,6 @@ void parse_frommap(int fd)
online_chars[j] = -1;
create_online_files(); // update online players files (to remove all online players of this server)
}
- close(fd);
delete_session(fd);
return;
}
@@ -2424,7 +2414,6 @@ void parse_char(int fd)
{ // disconnect any player (already connected to char-server or coming back from map-server) if login-server is diconnected.
if (fd == login_fd)
login_fd = -1;
- close(fd);
delete_session(fd);
return;
}
diff --git a/src/char/int_party.cpp b/src/char/int_party.cpp
index fccb0c2..065398a 100644
--- a/src/char/int_party.cpp
+++ b/src/char/int_party.cpp
@@ -1,6 +1,5 @@
#include "int_party.hpp"
-#include <cstdio>
#include <cstdlib>
#include <cstring>
diff --git a/src/char/int_storage.cpp b/src/char/int_storage.cpp
index 6568d10..9ca841f 100644
--- a/src/char/int_storage.cpp
+++ b/src/char/int_storage.cpp
@@ -1,5 +1,11 @@
#include "int_storage.hpp"
+#include <cstdlib>
+#include <cstring>
+
+#include <functional>
+#include <fstream>
+
#include "../common/cxxstdio.hpp"
#include "../common/db.hpp"
#include "../common/extract.hpp"
@@ -7,14 +13,6 @@
#include "../common/mmo.hpp"
#include "../common/socket.hpp"
-#include "char.hpp"
-#include "inter.hpp"
-
-#include <cstdlib>
-#include <cstring>
-
-#include <fstream>
-
#include "../poison.hpp"
// ファイル名のデフォルト
diff --git a/src/char/inter.cpp b/src/char/inter.cpp
index fe82ac3..8015ae9 100644
--- a/src/char/inter.cpp
+++ b/src/char/inter.cpp
@@ -4,14 +4,15 @@
#include <cstring>
#include <fstream>
+#include <vector>
#include "../common/cxxstdio.hpp"
#include "../common/db.hpp"
#include "../common/extract.hpp"
#include "../common/lock.hpp"
-#include "../common/mmo.hpp"
#include "../common/socket.hpp"
#include "../common/timer.hpp"
+#include "../common/utils.hpp"
#include "char.hpp"
#include "int_party.hpp"
diff --git a/src/common/const_array.hpp b/src/common/const_array.hpp
index db8416d..93ae337 100644
--- a/src/common/const_array.hpp
+++ b/src/common/const_array.hpp
@@ -33,6 +33,7 @@
# define constexpr /* nothing */
#endif
+// TODO see if I ever actually use this, and not the subclass
template<class T>
class const_array
{
diff --git a/src/common/core.cpp b/src/common/core.cpp
index 7da1b27..300f1cc 100644
--- a/src/common/core.cpp
+++ b/src/common/core.cpp
@@ -5,14 +5,12 @@
#include <unistd.h>
#include <csignal>
-#include <cstdio>
#include <cstdlib>
+#include <ctime>
#include "mt_rand.hpp"
-#include "nullpo.hpp"
#include "socket.hpp"
#include "timer.hpp"
-#include "version.hpp"
#include "../poison.hpp"
diff --git a/src/common/core.hpp b/src/common/core.hpp
index 2d68eaf..0c11efb 100644
--- a/src/common/core.hpp
+++ b/src/common/core.hpp
@@ -1,6 +1,8 @@
#ifndef CORE_HPP
#define CORE_HPP
+#include "sanity.hpp"
+
/// core.c contains a server-independent main() function
/// and then runs a do_sendrecv loop
diff --git a/src/common/cxxstdio.cpp b/src/common/cxxstdio.cpp
new file mode 100644
index 0000000..8f4001f
--- /dev/null
+++ b/src/common/cxxstdio.cpp
@@ -0,0 +1,33 @@
+#include "cxxstdio.hpp"
+// cxxstdio.cpp - pass C++ types through scanf/printf
+//
+// Copyright © 2013 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 <cstdlib>
+
+namespace cxxstdio
+{
+StringConverter::~StringConverter()
+{
+ if (mid)
+ {
+ out = mid;
+ free(mid);
+ }
+}
+} // namespace cxxstdio
diff --git a/src/common/cxxstdio.hpp b/src/common/cxxstdio.hpp
index 866947c..96c3ca2 100644
--- a/src/common/cxxstdio.hpp
+++ b/src/common/cxxstdio.hpp
@@ -2,7 +2,7 @@
#define CXXSTDIO_HPP
// cxxstdio.hpp - pass C++ types through scanf/printf
//
-// Copyright © 2011-2012 Ben Longbons <b.r.longbons@gmail.com>
+// Copyright © 2011-2013 Ben Longbons <b.r.longbons@gmail.com>
//
// This file is part of The Mana World (Athena server)
//
@@ -19,15 +19,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 "utils2.hpp"
+#include "sanity.hpp"
#include <cstdarg>
#include <cstdio>
-#include <cstdlib>
#include <string>
#include "const_array.hpp"
+#include "utils2.hpp"
+
namespace cxxstdio
{
@@ -213,14 +214,7 @@ namespace cxxstdio
StringConverter(std::string& s)
: out(s), mid(nullptr)
{}
- ~StringConverter()
- {
- if (mid)
- {
- out = mid;
- free(mid);
- }
- }
+ ~StringConverter();
char **operator &()
{
return &mid;
diff --git a/src/common/db.cpp b/src/common/db.cpp
index 6558ed0..970e054 100644
--- a/src/common/db.cpp
+++ b/src/common/db.cpp
@@ -1,6 +1,5 @@
#include "db.hpp"
-#include <cstdio>
#include <cstdlib>
#include <cstring>
diff --git a/src/common/db.hpp b/src/common/db.hpp
index 63ce7fa..d04f318 100644
--- a/src/common/db.hpp
+++ b/src/common/db.hpp
@@ -1,6 +1,7 @@
// WARNING: there is a system header by this name
#ifndef DB_HPP
#define DB_HPP
+
# include "sanity.hpp"
# include <functional>
diff --git a/src/common/extract.cpp b/src/common/extract.cpp
new file mode 100644
index 0000000..5e89e19
--- /dev/null
+++ b/src/common/extract.cpp
@@ -0,0 +1,68 @@
+#include "extract.hpp"
+// extract.cpp - a simple, hierarchical, tokenizer
+//
+// Copyright © 2013 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/>.
+
+bool extract(const_string str, const_string *rv)
+{
+ *rv = str;
+ return true;
+}
+
+bool extract(const_string str, std::string *rv)
+{
+ *rv = std::string(str.begin(), str.end());
+ return true;
+}
+
+bool extract(const_string str, struct global_reg *var)
+{
+ return extract(str,
+ record<','>(&var->str, &var->value));
+}
+
+bool extract(const_string str, struct item *it)
+{
+ return extract(str,
+ record<','>(
+ &it->id,
+ &it->nameid,
+ &it->amount,
+ &it->equip,
+ &it->identify,
+ &it->refine,
+ &it->attribute,
+ &it->card[0],
+ &it->card[1],
+ &it->card[2],
+ &it->card[3],
+ &it->broken))
+ || extract(str,
+ record<','>(
+ &it->id,
+ &it->nameid,
+ &it->amount,
+ &it->equip,
+ &it->identify,
+ &it->refine,
+ &it->attribute,
+ &it->card[0],
+ &it->card[1],
+ &it->card[2],
+ &it->card[3]));
+}
diff --git a/src/common/extract.hpp b/src/common/extract.hpp
index 24456be..c60ce2a 100644
--- a/src/common/extract.hpp
+++ b/src/common/extract.hpp
@@ -1,8 +1,8 @@
#ifndef EXTRACT_HPP
#define EXTRACT_HPP
-// extract.hpp - a simple, heirarchail, tokenizer
+// extract.hpp - a simple, hierarchical, tokenizer
//
-// Copyright © 2012 Ben Longbons <b.r.longbons@gmail.com>
+// Copyright © 2012-2013 Ben Longbons <b.r.longbons@gmail.com>
//
// This file is part of The Mana World (Athena server)
//
@@ -19,6 +19,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 "sanity.hpp"
+
#include <algorithm>
#include "const_array.hpp"
@@ -70,19 +72,9 @@ bool extract(const_string str, T *iv)
return true;
}
-inline
-bool extract(const_string str, const_string *rv)
-{
- *rv = str;
- return true;
-}
+bool extract(const_string str, const_string *rv);
-inline
-bool extract(const_string str, std::string *rv)
-{
- *rv = std::string(str.begin(), str.end());
- return true;
-}
+bool extract(const_string str, std::string *rv);
template<size_t N>
__attribute__((deprecated))
@@ -160,42 +152,8 @@ bool extract(const_string str, VRecord<split, T> rec)
&& extract(const_string(s + 1, str.end()), rec);
}
-inline
-bool extract(const_string str, struct global_reg *var)
-{
- return extract(str,
- record<','>(&var->str, &var->value));
-}
+bool extract(const_string str, struct global_reg *var);
+
+bool extract(const_string str, struct item *it);
-inline
-bool extract(const_string str, struct item *it)
-{
- return extract(str,
- record<','>(
- &it->id,
- &it->nameid,
- &it->amount,
- &it->equip,
- &it->identify,
- &it->refine,
- &it->attribute,
- &it->card[0],
- &it->card[1],
- &it->card[2],
- &it->card[3],
- &it->broken))
- || extract(str,
- record<','>(
- &it->id,
- &it->nameid,
- &it->amount,
- &it->equip,
- &it->identify,
- &it->refine,
- &it->attribute,
- &it->card[0],
- &it->card[1],
- &it->card[2],
- &it->card[3]));
-}
#endif // EXTRACT_HPP
diff --git a/src/common/grfio.cpp b/src/common/grfio.cpp
index bbf073a..1ed5c3e 100644
--- a/src/common/grfio.cpp
+++ b/src/common/grfio.cpp
@@ -4,11 +4,9 @@
#include <sys/stat.h>
#include <cstdio>
-#include <cstdlib>
#include <cstring>
#include "cxxstdio.hpp"
-#include "mmo.hpp"
#include "socket.hpp"
#include "utils.hpp"
diff --git a/src/common/lock.hpp b/src/common/lock.hpp
index 8b444f4..f7ce2d8 100644
--- a/src/common/lock.hpp
+++ b/src/common/lock.hpp
@@ -1,8 +1,12 @@
#ifndef LOCK_HPP
#define LOCK_HPP
+#include "sanity.hpp"
+
#include <cstdio>
+// TODO replace with a class
+
/// Locked FILE I/O
// Changes are made in a separate file until lock_fclose
FILE *lock_fopen(const char *filename, int *info);
diff --git a/src/common/mmo.hpp b/src/common/mmo.hpp
index 7ed2548..db150ba 100644
--- a/src/common/mmo.hpp
+++ b/src/common/mmo.hpp
@@ -2,7 +2,7 @@
#ifndef MMO_HPP
#define MMO_HPP
-# include <ctime>
+# include "sanity.hpp"
# include "utils.hpp"
diff --git a/src/common/nullpo.cpp b/src/common/nullpo.cpp
index c18231a..d7d489c 100644
--- a/src/common/nullpo.cpp
+++ b/src/common/nullpo.cpp
@@ -1,7 +1,6 @@
#include "nullpo.hpp"
#include <cstdio>
-#include <cstring>
#include "../poison.hpp"
diff --git a/src/common/nullpo.hpp b/src/common/nullpo.hpp
index 7d12033..ad1084a 100644
--- a/src/common/nullpo.hpp
+++ b/src/common/nullpo.hpp
@@ -25,7 +25,7 @@
/// Used by macros in this header
bool nullpo_chk(const char *file, int line, const char *func,
- const void *target);
+ const void *target);
/// Used only by map/battle.c
void nullpo_info(const char *file, int line, const char *func);
diff --git a/src/common/socket.cpp b/src/common/socket.cpp
index c877b2b..50c08a0 100644
--- a/src/common/socket.cpp
+++ b/src/common/socket.cpp
@@ -1,21 +1,19 @@
#include "socket.hpp"
-#include <netinet/in.h>
+#include <arpa/inet.h>
#include <netinet/tcp.h>
#include <sys/socket.h>
-#include <sys/time.h>
-#include <sys/types.h>
+//#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
-#include <cerrno>
-#include <cstdio>
#include <cstdlib>
#include <cstring>
+#include <ctime>
#include "cxxstdio.hpp"
-#include "mmo.hpp"
+//#include "mmo.hpp"
#include "utils.hpp"
#include "../poison.hpp"
diff --git a/src/common/socket.hpp b/src/common/socket.hpp
index 975b7f4..b9b80b3 100644
--- a/src/common/socket.hpp
+++ b/src/common/socket.hpp
@@ -4,11 +4,8 @@
# include "sanity.hpp"
# include <netinet/in.h>
-# include <sys/socket.h>
-# include <sys/types.h>
# include <cstdio>
-# include <ctime>
// Struct declaration
diff --git a/src/common/timer.cpp b/src/common/timer.cpp
index abc885d..65f04e0 100644
--- a/src/common/timer.cpp
+++ b/src/common/timer.cpp
@@ -1,11 +1,7 @@
#include "timer.hpp"
-#include <sys/socket.h>
#include <sys/time.h>
-#include <sys/types.h>
-#include <cstdio>
-#include <cstdlib>
#include <cstring>
#include "cxxstdio.hpp"
diff --git a/src/common/utils.cpp b/src/common/utils.cpp
index 9a19244..bd82180 100644
--- a/src/common/utils.cpp
+++ b/src/common/utils.cpp
@@ -3,10 +3,6 @@
#include <netinet/in.h>
#include <sys/time.h>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-
#include <algorithm>
#include "../poison.hpp"
diff --git a/src/common/utils2.hpp b/src/common/utils2.hpp
index 3b652d5..973a445 100644
--- a/src/common/utils2.hpp
+++ b/src/common/utils2.hpp
@@ -1,6 +1,8 @@
#ifndef UTILS2_HPP
#define UTILS2_HPP
+#include "sanity.hpp"
+
#include <iterator>
#include <type_traits>
diff --git a/src/ladmin/ladmin.cpp b/src/ladmin/ladmin.cpp
index 72726b5..1af83e1 100644
--- a/src/ladmin/ladmin.cpp
+++ b/src/ladmin/ladmin.cpp
@@ -1,34 +1,21 @@
-#include "ladmin.hpp"
-
#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <fcntl.h>
#include <netdb.h>
#include <unistd.h>
-#include <cctype>
-#include <csignal>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <ctime>
-
#include <fstream>
#include "../common/cxxstdio.hpp"
#include "../common/core.hpp"
#include "../common/md5calc.hpp"
-#include "../common/mmo.hpp"
#include "../common/socket.hpp"
#include "../common/version.hpp"
+#include "../common/utils.hpp"
#include "../poison.hpp"
+#define LADMIN_CONF_NAME "conf/ladmin_athena.conf"
+
static
int eathena_interactive_session;
#define Iprintf if (eathena_interactive_session) PRINTF
@@ -2716,7 +2703,6 @@ void parse_fromlogin(int fd)
loginserverip, loginserverport);
LADMIN_LOG("Impossible to have a connection with the login-server [%s:%d] !\n",
loginserverip, loginserverport);
- close(fd);
delete_session(fd);
exit(0);
}
diff --git a/src/ladmin/ladmin.hpp b/src/ladmin/ladmin.hpp
deleted file mode 100644
index 9675644..0000000
--- a/src/ladmin/ladmin.hpp
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef LADMIN_HPP
-#define LADMIN_HPP
-
-#define LADMIN_CONF_NAME "conf/ladmin_athena.conf"
-
-#endif // LADMIN_HPP
diff --git a/src/login/login.cpp b/src/login/login.cpp
index 29b9954..7af76f8 100644
--- a/src/login/login.cpp
+++ b/src/login/login.cpp
@@ -1,26 +1,18 @@
-#include "login.hpp"
-
#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
#include <sys/stat.h>
-#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
-#include <fcntl.h>
#include <netdb.h>
#include <unistd.h>
-#include <csignal>
-#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <algorithm>
#include <fstream>
+#include <type_traits>
#include "../common/core.hpp"
#include "../common/cxxstdio.hpp"
@@ -33,13 +25,44 @@
#include "../common/socket.hpp"
#include "../common/timer.hpp"
#include "../common/version.hpp"
-
-#include <type_traits>
+#include "../common/utils.hpp"
#include "../poison.hpp"
static_assert(std::is_same<time_t, long>::value, "much code assumes time_t is a long (sorry)");
+#define MAX_SERVERS 30
+
+#define LOGIN_CONF_NAME "conf/login_athena.conf"
+#define LAN_CONF_NAME "conf/lan_support.conf"
+
+#define START_ACCOUNT_NUM 2000000
+#define END_ACCOUNT_NUM 100000000
+
+struct mmo_account
+{
+ char userid[24];
+ char passwd[24];
+ int passwdenc;
+
+ long account_id;
+ long login_id1;
+ long login_id2;
+ long char_id;
+ char lastlogin[24];
+ int sex;
+};
+
+struct mmo_char_server
+{
+ char name[20];
+ long ip;
+ short port;
+ int users;
+ int maintenance;
+ int is_new;
+};
+
static
int account_id_count = START_ACCOUNT_NUM;
static
@@ -1084,7 +1107,6 @@ void parse_fromchar(int fd)
server_fd[id] = -1;
memset(&server[id], 0, sizeof(struct mmo_char_server));
}
- close(fd);
delete_session(fd);
return;
}
@@ -1773,7 +1795,6 @@ void parse_admin(int fd)
if (session[fd]->eof)
{
- close(fd);
delete_session(fd);
PRINTF("Remote administration has disconnected (session #%d).\n",
fd);
@@ -3029,7 +3050,6 @@ void parse_login(int fd)
if (session[fd]->eof)
{
- close(fd);
delete_session(fd);
return;
}
diff --git a/src/login/login.hpp b/src/login/login.hpp
deleted file mode 100644
index 4d018de..0000000
--- a/src/login/login.hpp
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef LOGIN_HPP
-#define LOGIN_HPP
-
-#define MAX_SERVERS 30
-
-#define LOGIN_CONF_NAME "conf/login_athena.conf"
-#define LAN_CONF_NAME "conf/lan_support.conf"
-
-#define START_ACCOUNT_NUM 2000000
-#define END_ACCOUNT_NUM 100000000
-
-struct mmo_account
-{
- char userid[24];
- char passwd[24];
- int passwdenc;
-
- long account_id;
- long login_id1;
- long login_id2;
- long char_id;
- char lastlogin[24];
- int sex;
-};
-
-struct mmo_char_server
-{
- char name[20];
- long ip;
- short port;
- int users;
- int maintenance;
- int is_new;
-};
-
-#endif // LOGIN_HPP
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp
index 968e428..211baac 100644
--- a/src/map/atcommand.cpp
+++ b/src/map/atcommand.cpp
@@ -1,26 +1,16 @@
#include "atcommand.hpp"
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <cctype>
#include <cmath>
-#include <cstdio>
-#include <cstdlib>
#include <cstring>
#include <ctime>
-#include <array>
-
#include "../common/core.hpp"
#include "../common/cxxstdio.hpp"
+#include "../common/mmo.hpp"
#include "../common/mt_rand.hpp"
#include "../common/nullpo.hpp"
#include "../common/socket.hpp"
-#include "../common/timer.hpp"
+#include "../common/utils2.hpp"
#include "battle.hpp"
#include "chrif.hpp"
@@ -34,6 +24,7 @@
#include "pc.hpp"
#include "script.hpp"
#include "skill.hpp"
+#include "storage.hpp"
#include "tmw.hpp"
#include "trade.hpp"
diff --git a/src/map/atcommand.hpp b/src/map/atcommand.hpp
index 4d3b592..5db9287 100644
--- a/src/map/atcommand.hpp
+++ b/src/map/atcommand.hpp
@@ -1,7 +1,7 @@
#ifndef ATCOMMAND_HPP
#define ATCOMMAND_HPP
-#include "map.hpp"
+#include "../common/const_array.hpp"
enum AtCommandType
{
@@ -187,7 +187,7 @@ typedef struct AtCommandInfo
const char *command;
int level;
int(*proc)(const int, struct map_session_data *,
- const char *command, const char *message);
+ const char *command, const char *message);
} AtCommandInfo;
bool is_atcommand(const int fd, struct map_session_data *sd,
diff --git a/src/map/battle.cpp b/src/map/battle.cpp
index 9d51486..33941f6 100644
--- a/src/map/battle.cpp
+++ b/src/map/battle.cpp
@@ -1,16 +1,12 @@
#include "battle.hpp"
-#include <cmath>
-#include <cstdio>
-#include <cstdlib>
#include <cstring>
#include <fstream>
+#include "../common/cxxstdio.hpp"
#include "../common/mt_rand.hpp"
#include "../common/nullpo.hpp"
-#include "../common/socket.hpp"
-#include "../common/timer.hpp"
#include "clif.hpp"
#include "itemdb.hpp"
diff --git a/src/map/battle.hpp b/src/map/battle.hpp
index 04ca656..56b3a9f 100644
--- a/src/map/battle.hpp
+++ b/src/map/battle.hpp
@@ -3,8 +3,6 @@
#include "battle.t.hpp"
-#include "../common/utils.hpp"
-
#include "map.t.hpp"
#include "skill.t.hpp"
@@ -31,9 +29,9 @@ struct Damage battle_calc_attack(BF attack_type,
// 実際にHPを増減
int battle_damage(struct block_list *bl, struct block_list *target,
- int damage, int flag);
+ int damage, int flag);
int battle_heal(struct block_list *bl, struct block_list *target, int hp,
- int sp, int flag);
+ int sp, int flag);
// 攻撃や移動を止める
int battle_stopattack(struct block_list *bl);
@@ -83,7 +81,7 @@ int battle_check_undead(int race, int element);
int battle_check_target(struct block_list *src, struct block_list *target,
BCT flag);
int battle_check_range(struct block_list *src, struct block_list *bl,
- int range);
+ int range);
extern struct Battle_Config
{
diff --git a/src/map/battle.t.hpp b/src/map/battle.t.hpp
index b84d1f2..f88fb71 100644
--- a/src/map/battle.t.hpp
+++ b/src/map/battle.t.hpp
@@ -1,7 +1,7 @@
#ifndef BATTLE_T_HPP
#define BATTLE_T_HPP
-#include "../common/utils.hpp"
+#include "../common/utils2.hpp"
namespace e
{
diff --git a/src/map/chat.cpp b/src/map/chat.cpp
index dcb6e51..1f9f433 100644
--- a/src/map/chat.cpp
+++ b/src/map/chat.cpp
@@ -1,13 +1,10 @@
#include "chat.hpp"
-#include <cstdio>
#include <cstdlib>
#include <cstring>
-#include "../common/db.hpp"
#include "../common/nullpo.hpp"
-#include "clif.hpp"
#include "map.hpp"
#include "npc.hpp"
#include "pc.hpp"
diff --git a/src/map/chat.hpp b/src/map/chat.hpp
index 28cc623..ead7b49 100644
--- a/src/map/chat.hpp
+++ b/src/map/chat.hpp
@@ -1,12 +1,10 @@
#ifndef CHAT_HPP
#define CHAT_HPP
-#include "map.hpp"
-
int chat_leavechat(struct map_session_data *);
int chat_createnpcchat(struct npc_data *nd, int limit, int pub, int trigger,
- const char *title, int titlelen, const char *ev);
+ const char *title, int titlelen, const char *ev);
int chat_deletenpcchat(struct npc_data *nd);
int chat_enableevent(struct chat_data *cd);
int chat_disableevent(struct chat_data *cd);
diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp
index 1f70a02..018c659 100644
--- a/src/map/chrif.cpp
+++ b/src/map/chrif.cpp
@@ -1,21 +1,13 @@
#include "chrif.hpp"
#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <cstdio>
-#include <cstdlib>
#include <cstring>
-#include <ctime>
#include "../common/cxxstdio.hpp"
#include "../common/nullpo.hpp"
#include "../common/socket.hpp"
-#include "../common/timer.hpp"
+#include "../common/utils.hpp"
#include "battle.hpp"
#include "clif.hpp"
@@ -24,6 +16,7 @@
#include "map.hpp"
#include "npc.hpp"
#include "pc.hpp"
+#include "storage.hpp"
#include "../poison.hpp"
@@ -1056,7 +1049,6 @@ void chrif_parse(int fd)
fd);
char_fd = -1;
}
- close(fd);
delete_session(fd);
return;
}
diff --git a/src/map/chrif.hpp b/src/map/chrif.hpp
index dce1ae3..2816e9f 100644
--- a/src/map/chrif.hpp
+++ b/src/map/chrif.hpp
@@ -14,16 +14,16 @@ int chrif_authreq(struct map_session_data *);
int chrif_save(struct map_session_data *);
int chrif_charselectreq(struct map_session_data *);
-int chrif_changemapserver(struct map_session_data *sd, char *name, int x,
- int y, struct in_addr ip, short port);
+int chrif_changemapserver(struct map_session_data *sd,
+ char *name, int x, int y,
+ struct in_addr ip, short port);
int chrif_searchcharid(int char_id);
int chrif_changegm(int id, const char *pass, int len);
int chrif_changeemail(int id, const char *actual_email,
- const char *new_email);
+ const char *new_email);
int chrif_char_ask_name(int id, char *character_name, short operation_type,
- int year, int month, int day, int hour, int minute,
- int second);
+ int year, int month, int day, int hour, int minute, int second);
int chrif_saveaccountreg2(struct map_session_data *sd);
int chrif_reloadGMdb(void);
int chrif_send_divorce(int char_id);
diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index e26e64e..99447ea 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -1,14 +1,7 @@
#include "clif.hpp"
#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#include <cctype>
-#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
@@ -18,22 +11,18 @@
#include "../common/mt_rand.hpp"
#include "../common/nullpo.hpp"
#include "../common/socket.hpp"
-#include "../common/timer.hpp"
#include "../common/version.hpp"
#include "atcommand.hpp"
#include "battle.hpp"
-#include "chat.hpp"
#include "chrif.hpp"
#include "intif.hpp"
#include "itemdb.hpp"
#include "magic.hpp"
#include "map.hpp"
-#include "mob.hpp"
#include "npc.hpp"
#include "party.hpp"
#include "pc.hpp"
-#include "script.hpp"
#include "skill.hpp"
#include "storage.hpp"
#include "tmw.hpp"
@@ -6140,8 +6129,6 @@ void clif_parse(int fd)
map_deliddb(&sd->bl); // account_id has been included in the DB before auth answer
}
if (fd)
- close(fd);
- if (fd)
delete_session(fd);
return;
}
@@ -6297,24 +6284,8 @@ void clif_parse(int fd)
*/
int do_init_clif (void)
{
- int i;
-
set_defaultparse(clif_parse);
- for (i = 0; i < 10; i++)
- {
- if (make_listen_port(map_port))
- break;
-#ifdef LCCWIN32
- Sleep(20000);
-#else
- sleep(20);
-#endif
- }
- if (i == 10)
- {
- PRINTF("cant bind game port\n");
- exit(1);
- }
+ make_listen_port(map_port);
return 0;
}
diff --git a/src/map/clif.hpp b/src/map/clif.hpp
index 75dc73d..51ee4aa 100644
--- a/src/map/clif.hpp
+++ b/src/map/clif.hpp
@@ -1,17 +1,13 @@
#ifndef CLIF_HPP
#define CLIF_HPP
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
-#include <sys/types.h>
+#include <functional>
#include "../common/const_array.hpp"
+#include "map.t.hpp"
#include "pc.t.hpp"
-
-#include "map.hpp"
-#include "storage.hpp"
+#include "skill.t.hpp"
void clif_setip(const char *);
void clif_setport(int);
@@ -33,7 +29,7 @@ int clif_clearchar_id(int, int, int);
int clif_spawnpc(struct map_session_data *); //area
int clif_spawnnpc(struct npc_data *); // area
int clif_spawn_fake_npc_for_player(struct map_session_data *sd,
- int fake_npc_id);
+ int fake_npc_id);
int clif_spawnmob(struct mob_data *); // area
int clif_walkok(struct map_session_data *); // self
int clif_movechar(struct map_session_data *); // area
@@ -77,9 +73,9 @@ void clif_sitting(int fd, struct map_session_data *sd);
int clif_traderequest(struct map_session_data *sd, const char *name);
int clif_tradestart(struct map_session_data *sd, int type);
int clif_tradeadditem(struct map_session_data *sd,
- struct map_session_data *tsd, int index, int amount);
+ struct map_session_data *tsd, int index, int amount);
int clif_tradeitemok(struct map_session_data *sd, int index, int amount,
- int fail);
+ int fail);
int clif_tradedeal_lock(struct map_session_data *sd, int fail);
int clif_tradecancelled(struct map_session_data *sd);
int clif_tradecompleted(struct map_session_data *sd, int fail);
@@ -87,13 +83,13 @@ int clif_tradecompleted(struct map_session_data *sd, int fail);
// storage
int clif_storageitemlist(struct map_session_data *sd, struct storage *stor);
int clif_storageequiplist(struct map_session_data *sd,
- struct storage *stor);
+ struct storage *stor);
int clif_updatestorageamount(struct map_session_data *sd,
- struct storage *stor);
+ struct storage *stor);
int clif_storageitemadded(struct map_session_data *sd, struct storage *stor,
- int index, int amount);
+ int index, int amount);
int clif_storageitemremoved(struct map_session_data *sd, int index,
- int amount);
+ int amount);
int clif_storageclose(struct map_session_data *sd);
// map_forallinmovearea callbacks
@@ -103,16 +99,16 @@ void clif_mobinsight(struct block_list *, struct mob_data *);
void clif_moboutsight(struct block_list *, struct mob_data *);
int clif_skillinfo(struct map_session_data *sd, SkillID skillid, int type,
- int range);
+ int range);
int clif_skillinfoblock(struct map_session_data *sd);
int clif_skillup(struct map_session_data *sd, SkillID skill_num);
int clif_skillcastcancel(struct block_list *bl);
int clif_skill_fail(struct map_session_data *sd, SkillID skill_id, int type,
- int btype);
+ int btype);
int clif_skill_damage(struct block_list *src, struct block_list *dst,
- unsigned int tick, int sdelay, int ddelay, int damage,
- int div, SkillID skill_id, int skill_lv, int type);
+ unsigned int tick, int sdelay, int ddelay, int damage,
+ int div, SkillID skill_id, int skill_lv, int type);
int clif_status_change(struct block_list *bl,
StatusChange type, int flag);
@@ -131,12 +127,12 @@ int clif_movetoattack(struct map_session_data *sd, struct block_list *bl);
int clif_party_created(struct map_session_data *sd, int flag);
int clif_party_info(struct party *p, int fd);
int clif_party_invite(struct map_session_data *sd,
- struct map_session_data *tsd);
+ struct map_session_data *tsd);
int clif_party_inviteack(struct map_session_data *sd, const char *nick, int flag);
int clif_party_option(struct party *p, struct map_session_data *sd,
- int flag);
+ int flag);
int clif_party_leaved(struct party *p, struct map_session_data *sd,
- int account_id, const char *name, int flag);
+ int account_id, const char *name, int flag);
int clif_party_message(struct party *p, int account_id, const char *mes, int len);
int clif_party_xy(struct party *p, struct map_session_data *sd);
int clif_party_hp(struct party *p, struct map_session_data *sd);
@@ -150,7 +146,7 @@ int clif_specialeffect(struct block_list *bl, int type, int flag); // special
int clif_message(struct block_list *bl, const char *msg); // messages (from mobs/npcs) [Valaris]
int clif_GM_kick(struct map_session_data *sd, struct map_session_data *tsd,
- int type);
+ int type);
int clif_foreachclient(std::function<void(struct map_session_data *)>);
diff --git a/src/map/intif.cpp b/src/map/intif.cpp
index 7c42cfc..8a869e1 100644
--- a/src/map/intif.cpp
+++ b/src/map/intif.cpp
@@ -1,23 +1,11 @@
#include "intif.hpp"
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-#include <sys/types.h>
-
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <csignal>
-#include <cstdio>
#include <cstdlib>
#include <cstring>
+#include "../common/cxxstdio.hpp"
#include "../common/nullpo.hpp"
#include "../common/socket.hpp"
-#include "../common/timer.hpp"
#include "battle.hpp"
#include "chrif.hpp"
diff --git a/src/map/intif.hpp b/src/map/intif.hpp
index 7a03483..25f69e3 100644
--- a/src/map/intif.hpp
+++ b/src/map/intif.hpp
@@ -8,9 +8,9 @@ int intif_parse(int fd);
void intif_GMmessage(const_string mes, int flag);
int intif_wis_message(struct map_session_data *sd, const char *nick, const char *mes,
- int mes_len);
+ int mes_len);
int intif_wis_message_to_gm(const char *Wisp_name, int min_gm_level, const char *mes,
- int mes_len);
+ int mes_len);
int intif_saveaccountreg(struct map_session_data *sd);
int intif_request_accountreg(struct map_session_data *sd);
@@ -22,7 +22,7 @@ int intif_create_party(struct map_session_data *sd, const char *name);
int intif_request_partyinfo(int party_id);
int intif_party_addmember(int party_id, int account_id);
int intif_party_changeoption(int party_id, int account_id, int exp,
- int item);
+ int item);
int intif_party_leave(int party_id, int accound_id);
int intif_party_changemap(struct map_session_data *sd, int online);
int intif_party_message(int party_id, int account_id, const char *mes, int len);
diff --git a/src/map/itemdb.cpp b/src/map/itemdb.cpp
index 7ca6055..b6a841e 100644
--- a/src/map/itemdb.cpp
+++ b/src/map/itemdb.cpp
@@ -1,20 +1,14 @@
#include "itemdb.hpp"
-#include <cstdio>
#include <cstdlib>
#include <cstring>
+#include "../common/cxxstdio.hpp"
#include "../common/db.hpp"
-#include "../common/grfio.hpp"
#include "../common/mt_rand.hpp"
#include "../common/nullpo.hpp"
#include "../common/socket.hpp"
-#include "battle.hpp"
-#include "map.hpp"
-#include "pc.hpp"
-#include "script.hpp"
-
#include "../poison.hpp"
#define MAX_RANDITEM 2000
diff --git a/src/map/itemdb.hpp b/src/map/itemdb.hpp
index e503d9a..540fced 100644
--- a/src/map/itemdb.hpp
+++ b/src/map/itemdb.hpp
@@ -1,7 +1,9 @@
#ifndef ITEMDB_HPP
#define ITEMDB_HPP
-#include "map.hpp"
+#include "../common/mmo.hpp"
+
+#include "map.t.hpp"
#include "script.hpp"
struct item_data
diff --git a/src/map/magic-expr-eval.hpp b/src/map/magic-expr-eval.hpp
index 0bf9ee4..ae9699d 100644
--- a/src/map/magic-expr-eval.hpp
+++ b/src/map/magic-expr-eval.hpp
@@ -1,6 +1,10 @@
#ifndef MAGIC_EXPR_EVAL_HPP
#define MAGIC_EXPR_EVAL_HPP
+#include "../common/utils2.hpp"
+
+#include "magic-interpreter.hpp"
+
/* Helper definitions for dealing with functions and operations */
static
@@ -11,10 +15,10 @@ earray<int, DIR, DIR::COUNT> heading_y //=
{{ 1, 1, 0, -1, -1, -1, 0, 1 }};
int magic_signature_check(const char *opname, const char *funname, const char *signature,
- int args_nr, val_t *args, int line, int column);
+ int args_nr, val_t *args, int line, int column);
void magic_area_rect(int *m, int *x, int *y, int *width, int *height,
- area_t *area);
+ area_t *area);
#define ARGINT(x) args[x].v.v_int
#define ARGDIR(x) args[x].v.v_dir
diff --git a/src/map/magic-expr.cpp b/src/map/magic-expr.cpp
index def1ece..6ad2cef 100644
--- a/src/map/magic-expr.cpp
+++ b/src/map/magic-expr.cpp
@@ -1,12 +1,16 @@
+#include "magic-expr-eval.hpp"
#include "magic-expr.hpp"
+#include "magic-interpreter-aux.hpp"
#include <cmath>
#include "../common/cxxstdio.hpp"
#include "../common/mt_rand.hpp"
+#include "battle.hpp"
+#include "npc.hpp"
+#include "pc.hpp"
#include "itemdb.hpp"
-#include "magic-expr-eval.hpp"
#include "../poison.hpp"
diff --git a/src/map/magic-expr.hpp b/src/map/magic-expr.hpp
index 4fd6041..4d2ea3c 100644
--- a/src/map/magic-expr.hpp
+++ b/src/map/magic-expr.hpp
@@ -2,7 +2,6 @@
#define MAGIC_EXPR_HPP
#include "magic-interpreter.hpp"
-#include "magic-interpreter-aux.hpp"
/*
* Argument types:
diff --git a/src/map/magic-interpreter-base.cpp b/src/map/magic-interpreter-base.cpp
index 79f77da..0ddc4fd 100644
--- a/src/map/magic-interpreter-base.cpp
+++ b/src/map/magic-interpreter-base.cpp
@@ -1,7 +1,11 @@
-#include "magic.hpp"
-#include "magic-expr.hpp"
-#include "magic-interpreter.hpp"
#include "magic-interpreter-aux.hpp"
+#include "magic-interpreter.hpp"
+
+#include "../common/cxxstdio.hpp"
+
+#include "magic-expr.hpp"
+
+#include "pc.hpp"
#include "../poison.hpp"
diff --git a/src/map/magic-interpreter-lexer.lpp b/src/map/magic-interpreter-lexer.lpp
index 34461f5..ba3372e 100644
--- a/src/map/magic-interpreter-lexer.lpp
+++ b/src/map/magic-interpreter-lexer.lpp
@@ -1,9 +1,10 @@
%{
-#include "magic-interpreter.hpp"
#include "magic-interpreter-parser.hpp"
+#include "../common/cxxstdio.hpp"
+
#ifdef HEADING
-# undef HEADING
+# error "what platform is this? please tell me who #defined HEADING"
#endif
#define FIXLOC magic_frontend_lloc.first_line = magic_frontend_lineno
diff --git a/src/map/magic-interpreter-parser.ypp b/src/map/magic-interpreter-parser.ypp
index 3cabf24..b6486f1 100644
--- a/src/map/magic-interpreter-parser.ypp
+++ b/src/map/magic-interpreter-parser.ypp
@@ -1,5 +1,5 @@
%code requires {
-#include "magic-expr.hpp"
+#include "magic-interpreter.hpp"
}
%code{
#include "magic-interpreter-parser.hpp"
@@ -8,7 +8,8 @@
#include "../common/cxxstdio.hpp"
-#include "magic-interpreter.hpp"
+#include "itemdb.hpp"
+#include "magic-expr.hpp"
#define YYLEX_PARAM 0, 0
diff --git a/src/map/magic-interpreter.hpp b/src/map/magic-interpreter.hpp
index e79f0ab..9b7a035 100644
--- a/src/map/magic-interpreter.hpp
+++ b/src/map/magic-interpreter.hpp
@@ -3,31 +3,10 @@
#include "magic-interpreter.t.hpp"
-#include <cmath>
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-
-#include "../common/nullpo.hpp"
-#include "../common/socket.hpp"
-#include "../common/timer.hpp"
-
-#include "battle.hpp"
-#include "chat.hpp"
-#include "chrif.hpp"
-#include "clif.hpp"
-#include "intif.hpp"
-#include "itemdb.hpp"
#include "magic.hpp"
#include "map.hpp"
-#include "mob.hpp"
-#include "npc.hpp"
-#include "party.hpp"
-#include "pc.hpp"
#include "script.hpp"
-#include "skill.hpp"
-#include "storage.hpp"
-#include "trade.hpp"
+#include "skill.t.hpp"
struct expr;
struct val;
@@ -371,7 +350,7 @@ teleport_anchor_t *magic_find_anchor(char *name);
* The parameter `param' must have been dynamically allocated; ownership is transferred to the resultant env_t.
*/
env_t *spell_create_env(magic_conf_t *conf, spell_t *spell,
- character_t *caster, int spellpower, char *param);
+ character_t *caster, int spellpower, char *param);
void magic_free_env(env_t *env);
@@ -379,7 +358,7 @@ void magic_free_env(env_t *env);
* near_miss is set to nonzero iff the spell only failed due to ephemereal issues (spell delay in effect, out of mana, out of components)
*/
effect_set_t *spell_trigger(spell_t *spell, character_t *caster,
- env_t *env, int *near_miss);
+ env_t *env, int *near_miss);
invocation_t *spell_instantiate(effect_set_t *effect, env_t *env);
diff --git a/src/map/magic-interpreter.t.hpp b/src/map/magic-interpreter.t.hpp
index f5cb309..49fd3e1 100644
--- a/src/map/magic-interpreter.t.hpp
+++ b/src/map/magic-interpreter.t.hpp
@@ -1,7 +1,7 @@
#ifndef MAGIC_INTERPRETER_T_HPP
#define MAGIC_INTERPRETER_T_HPP
-#include "../common/utils.hpp"
+#include "../common/utils2.hpp"
enum class SPELLARG : uint8_t
{
diff --git a/src/map/magic-stmt.cpp b/src/map/magic-stmt.cpp
index b89b3c4..f39fc1f 100644
--- a/src/map/magic-stmt.cpp
+++ b/src/map/magic-stmt.cpp
@@ -5,6 +5,13 @@
#include "magic-interpreter.hpp"
#include "magic-interpreter-aux.hpp"
+#include "battle.hpp"
+#include "clif.hpp"
+#include "mob.hpp"
+#include "npc.hpp"
+#include "pc.hpp"
+#include "skill.hpp"
+
#include "../poison.hpp"
#define INVISIBLE_NPC 127 /* used for local spell effects */
diff --git a/src/map/magic.cpp b/src/map/magic.cpp
index 09b1928..5e08d30 100644
--- a/src/map/magic.cpp
+++ b/src/map/magic.cpp
@@ -1,9 +1,9 @@
-#include <cmath>
-#include <cstdio>
-#include <cstdlib>
#include <cstring>
+#include "../common/cxxstdio.hpp"
+
#include "magic-interpreter.hpp"
+#include "pc.hpp"
#include "../poison.hpp"
diff --git a/src/map/magic.hpp b/src/map/magic.hpp
index 848ba46..4b567ea 100644
--- a/src/map/magic.hpp
+++ b/src/map/magic.hpp
@@ -1,8 +1,7 @@
#ifndef MAGIC_HPP
#define MAGIC_HPP
-#include "clif.hpp"
-#include "intif.hpp"
+#include "skill.t.hpp"
#define MAGIC_CONFIG_FILE "conf/magic.conf"
diff --git a/src/map/map.cpp b/src/map/map.cpp
index 1fd9bb9..5112ec3 100644
--- a/src/map/map.cpp
+++ b/src/map/map.cpp
@@ -1,27 +1,27 @@
#include "map.hpp"
+#include <sys/time.h>
+
#include <netdb.h>
-#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include "../common/core.hpp"
+#include "../common/cxxstdio.hpp"
#include "../common/db.hpp"
#include "../common/grfio.hpp"
#include "../common/mt_rand.hpp"
#include "../common/nullpo.hpp"
#include "../common/socket.hpp"
-#include "../common/timer.hpp"
#include "atcommand.hpp"
#include "battle.hpp"
#include "chat.hpp"
#include "chrif.hpp"
#include "clif.hpp"
-#include "intif.hpp"
#include "itemdb.hpp"
#include "magic.hpp"
#include "mob.hpp"
diff --git a/src/map/map.hpp b/src/map/map.hpp
index 20423ba..32194c0 100644
--- a/src/map/map.hpp
+++ b/src/map/map.hpp
@@ -4,14 +4,10 @@
#include "map.t.hpp"
#include <netinet/in.h>
-#include <sys/time.h>
-#include <cstdio>
-#include <ctime>
+#include <functional>
-#include "../common/cxxstdio.hpp"
#include "../common/db.hpp"
-#include "../common/mmo.hpp"
#include "../common/timer.hpp"
#include "battle.t.hpp"
@@ -686,12 +682,11 @@ void map_log(const_string line);
void map_clearflooritem_timer(timer_id, tick_t, custom_id_t, custom_data_t);
#define map_clearflooritem(id) map_clearflooritem_timer(0,0,id,1)
int map_addflooritem_any(struct item *, int amount, int m, int x, int y,
- struct map_session_data **owners,
- int *owner_protection,
- int lifetime, int dispersal);
+ struct map_session_data **owners, int *owner_protection,
+ int lifetime, int dispersal);
int map_addflooritem(struct item *, int, int, int, int,
- struct map_session_data *, struct map_session_data *,
- struct map_session_data *, int);
+ struct map_session_data *, struct map_session_data *,
+ struct map_session_data *, int);
// キャラid=>キャラ名 変換関連
void map_addchariddb(int charid, const char *name);
@@ -713,10 +708,10 @@ int compare_item(struct item *a, struct item *b);
struct map_session_data *map_get_first_session(void);
struct map_session_data *map_get_last_session(void);
-struct map_session_data *map_get_next_session(struct map_session_data
- *current);
-struct map_session_data *map_get_prev_session(struct map_session_data
- *current);
+struct map_session_data *map_get_next_session(
+ struct map_session_data *current);
+struct map_session_data *map_get_prev_session(
+ struct map_session_data *current);
// gat関連
int map_getcell(int, int, int);
diff --git a/src/map/map.t.hpp b/src/map/map.t.hpp
index 1745ba3..0776788 100644
--- a/src/map/map.t.hpp
+++ b/src/map/map.t.hpp
@@ -2,7 +2,7 @@
#define MAP_T_HPP
#include "../common/mmo.hpp"
-#include "../common/utils.hpp"
+#include "../common/utils2.hpp"
namespace e
{
diff --git a/src/map/mob.cpp b/src/map/mob.cpp
index 46bb71e..3158dc5 100644
--- a/src/map/mob.cpp
+++ b/src/map/mob.cpp
@@ -1,19 +1,16 @@
#include "mob.hpp"
#include <cmath>
-#include <cstdio>
#include <cstdlib>
#include <cstring>
-#include "../common/db.hpp"
+#include "../common/cxxstdio.hpp"
#include "../common/mt_rand.hpp"
#include "../common/nullpo.hpp"
#include "../common/socket.hpp"
-#include "../common/timer.hpp"
#include "battle.hpp"
#include "clif.hpp"
-#include "intif.hpp"
#include "itemdb.hpp"
#include "map.hpp"
#include "npc.hpp"
diff --git a/src/map/mob.hpp b/src/map/mob.hpp
index 357c4fa..8247102 100644
--- a/src/map/mob.hpp
+++ b/src/map/mob.hpp
@@ -3,6 +3,7 @@
#include "mob.t.hpp"
+#include "../common/mmo.hpp"
#include "../common/timer.hpp"
#include "map.hpp"
@@ -61,15 +62,17 @@ extern struct mob_db mob_db[];
int mobdb_searchname(const char *str);
int mobdb_checkid(const int id);
-int mob_once_spawn(struct map_session_data *sd, const char *mapname,
- int x, int y, const char *mobname, int class_, int amount,
- const char *event);
-int mob_once_spawn_area(struct map_session_data *sd, const char *mapname, int x0,
- int y0, int x1, int y1, const char *mobname,
- int class_, int amount, const char *event);
-
-int mob_spawn_guardian(struct map_session_data *sd, const char *mapname, // Spawning Guardians [Valaris]
- int x, int y, const char *mobname, int class_, int amount, const char *event, int guardian); // Spawning Guardians [Valaris]
+int mob_once_spawn(struct map_session_data *sd,
+ const char *mapname, int x, int y,
+ const char *mobname, int class_, int amount, const char *event);
+int mob_once_spawn_area(struct map_session_data *sd,
+ const char *mapname, int x0, int y0, int x1, int y1,
+ const char *mobname, int class_, int amount, const char *event);
+
+int mob_spawn_guardian(struct map_session_data *sd,
+ const char *mapname, int x, int y,
+ const char *mobname, int class_, int amount,
+ const char *event, int guardian); // Spawning Guardians [Valaris]
int mob_target(struct mob_data *md, struct block_list *bl, int dist);
int mob_stop_walking(struct mob_data *md, int type);
diff --git a/src/map/npc.cpp b/src/map/npc.cpp
index 1d10855..c6cab1d 100644
--- a/src/map/npc.cpp
+++ b/src/map/npc.cpp
@@ -1,20 +1,16 @@
#include "npc.hpp"
-#include <cctype>
-#include <cmath>
-#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
+#include "../common/cxxstdio.hpp"
#include "../common/db.hpp"
#include "../common/nullpo.hpp"
#include "../common/socket.hpp"
-#include "../common/timer.hpp"
#include "battle.hpp"
#include "clif.hpp"
-#include "intif.hpp"
#include "itemdb.hpp"
#include "map.hpp"
#include "mob.hpp"
diff --git a/src/map/npc.hpp b/src/map/npc.hpp
index 52758d4..9af2721 100644
--- a/src/map/npc.hpp
+++ b/src/map/npc.hpp
@@ -1,7 +1,7 @@
#ifndef NPC_HPP
#define NPC_HPP
-#include "../common/timer.hpp"
+#include <cstdint>
#define START_NPC_NUM 110000000
@@ -45,10 +45,10 @@ int npc_event_do_oninit(void);
int npc_do_ontimer(int, struct map_session_data *, int);
struct argrec;
-int npc_event_doall_l(const char *name, int rid, int argc,
- struct argrec *argv);
-int npc_event_do_l(const char *name, int rid, int argc,
- struct argrec *argv);
+int npc_event_doall_l(const char *name, int rid,
+ int argc, struct argrec *argv);
+int npc_event_do_l(const char *name, int rid,
+ int argc, struct argrec *argv);
#define npc_event_doall(name) npc_event_doall_l(name, 0, 0, NULL)
#define npc_event_do(name) npc_event_do_l(name, 0, 0, NULL)
diff --git a/src/map/party.cpp b/src/map/party.cpp
index 1b646de..609044a 100644
--- a/src/map/party.cpp
+++ b/src/map/party.cpp
@@ -1,9 +1,8 @@
#include "party.hpp"
-#include <cstdio>
-#include <cstdlib>
#include <cstring>
+#include "../common/cxxstdio.hpp"
#include "../common/db.hpp"
#include "../common/nullpo.hpp"
#include "../common/socket.hpp"
@@ -14,7 +13,6 @@
#include "intif.hpp"
#include "map.hpp"
#include "pc.hpp"
-#include "skill.hpp"
#include "tmw.hpp"
#include "../poison.hpp"
diff --git a/src/map/party.hpp b/src/map/party.hpp
index 8dfd9b5..77e3aaf 100644
--- a/src/map/party.hpp
+++ b/src/map/party.hpp
@@ -18,17 +18,17 @@ int party_invite(struct map_session_data *sd, int account_id);
int party_member_added(int party_id, int account_id, int flag);
int party_leave(struct map_session_data *sd);
int party_removemember(struct map_session_data *sd, int account_id,
- const char *name);
+ const char *name);
int party_member_leaved(int party_id, int account_id, const char *name);
int party_reply_invite(struct map_session_data *sd, int account_id,
- int flag);
+ int flag);
int party_recv_noinfo(int party_id);
int party_recv_info(const struct party *sp);
-int party_recv_movemap(int party_id, int account_id, const char *map, int online,
- int lv);
+int party_recv_movemap(int party_id, int account_id, const char *map,
+ int online, int lv);
int party_broken(int party_id);
int party_optionchanged(int party_id, int account_id, int exp, int item,
- int flag);
+ int flag);
int party_changeoption(struct map_session_data *sd, int exp, int item);
int party_send_movemap(struct map_session_data *sd);
@@ -43,6 +43,6 @@ void party_send_hp_check(struct block_list *bl, int party_id, int *flag);
int party_exp_share(struct party *p, int map, int base_exp, int job_exp);
void party_foreachsamemap(std::function<void(struct block_list *)> func,
- struct map_session_data *sd, int type);
+ struct map_session_data *sd, int type);
#endif // PARTY_HPP
diff --git a/src/map/path.cpp b/src/map/path.cpp
index 1a8b5b9..3766999 100644
--- a/src/map/path.cpp
+++ b/src/map/path.cpp
@@ -1,7 +1,4 @@
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-
+#include "../common/cxxstdio.hpp"
#include "../common/nullpo.hpp"
#include "battle.hpp"
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index c25392a..118aa1f 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -1,16 +1,12 @@
#include "pc.hpp"
-#include <cctype>
-#include <cstdio>
#include <cstdlib>
#include <cstring>
-#include <ctime>
-#include "../common/db.hpp"
+#include "../common/cxxstdio.hpp"
#include "../common/mt_rand.hpp"
#include "../common/nullpo.hpp"
#include "../common/socket.hpp"
-#include "../common/timer.hpp"
#include "atcommand.hpp"
#include "battle.hpp"
@@ -19,6 +15,7 @@
#include "clif.hpp"
#include "intif.hpp"
#include "itemdb.hpp"
+#include "magic.hpp"
#include "map.hpp"
#include "mob.hpp"
#include "npc.hpp"
@@ -215,7 +212,6 @@ earray<EPOS, EQUIP, EQUIP::COUNT> equip_pos //=
EPOS::ARROW,
}};
-//static struct dbt *gm_account_db;
static
struct gm_account *gm_account = NULL;
static
@@ -237,16 +233,10 @@ void pc_setdead(struct map_session_data *sd)
int pc_isGM(struct map_session_data *sd)
{
-// struct gm_account *p;
int i;
nullpo_ret(sd);
-/* p = numdb_search(gm_account_db, sd->status.account_id);
- if (p == NULL)
- return 0;
- return p->level;*/
-
for (i = 0; i < GM_num; i++)
if (gm_account[i].account_id == sd->status.account_id)
return gm_account[i].level;
@@ -6885,8 +6875,6 @@ int do_init_pc(void)
{
pc_calc_sigma();
-// gm_account_db = numdb_init();
-
add_timer_interval((natural_heal_prev_tick =
gettick() + NATURAL_HEAL_INTERVAL), pc_natural_heal,
0, 0, NATURAL_HEAL_INTERVAL);
diff --git a/src/map/pc.hpp b/src/map/pc.hpp
index a775385..6670293 100644
--- a/src/map/pc.hpp
+++ b/src/map/pc.hpp
@@ -47,8 +47,9 @@ bool pc_is90overweight(struct map_session_data *sd)
return sd->weight*10 >= sd->max_weight*9;
}
-void pc_touch_all_relevant_npcs(struct map_session_data *sd); /* Checks all npcs/warps at the same location to see whether they
- ** should do something with the specified player. */
+// Checks all npcs/warps at the same location to see whether they
+// should do something with the specified player.
+void pc_touch_all_relevant_npcs(struct map_session_data *sd);
int pc_isGM(struct map_session_data *sd);
int pc_iskiller(struct map_session_data *src, struct map_session_data *target); // [MouseJstr]
@@ -86,8 +87,8 @@ int pc_getzeny(struct map_session_data *, int);
int pc_delitem(struct map_session_data *, int, int, int);
int pc_checkitem(struct map_session_data *);
int pc_count_all_items(struct map_session_data *player, int item_id);
-int pc_remove_items(struct map_session_data *player, int item_id,
- int count);
+int pc_remove_items(struct map_session_data *player,
+ int item_id, int count);
int pc_takeitem(struct map_session_data *, struct flooritem_data *);
int pc_dropitem(struct map_session_data *, int, int);
@@ -147,17 +148,17 @@ int pc_readaccountreg2(struct map_session_data *, const char *);
int pc_setaccountreg2(struct map_session_data *, const char *, int);
int pc_addeventtimer(struct map_session_data *sd, int tick,
- const char *name);
+ const char *name);
int pc_deleventtimer(struct map_session_data *sd, const char *name);
int pc_cleareventtimer(struct map_session_data *sd);
int pc_addeventtimercount(struct map_session_data *sd, const char *name,
- int tick);
+ int tick);
int pc_calc_pvprank(struct map_session_data *sd);
void pc_calc_pvprank_timer(timer_id, tick_t, custom_id_t, custom_data_t);
int pc_marriage(struct map_session_data *sd,
- struct map_session_data *dstsd);
+ struct map_session_data *dstsd);
int pc_divorce(struct map_session_data *sd);
struct map_session_data *pc_get_partner(struct map_session_data *sd);
int pc_set_gm_level(int account_id, int level);
diff --git a/src/map/script.cpp b/src/map/script.cpp
index 093ced9..4304640 100644
--- a/src/map/script.cpp
+++ b/src/map/script.cpp
@@ -1,31 +1,28 @@
#include "script.hpp"
-#include <sys/time.h>
-
-#include <cassert>
#include <cctype>
#include <cmath>
-#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
+#include "../common/cxxstdio.hpp"
#include "../common/db.hpp"
#include "../common/extract.hpp"
#include "../common/lock.hpp"
#include "../common/mt_rand.hpp"
#include "../common/socket.hpp"
-#include "../common/timer.hpp"
+#include "../common/utils.hpp"
#include "atcommand.hpp"
#include "battle.hpp"
-#include "chat.hpp"
#include "chrif.hpp"
#include "clif.hpp"
#include "intif.hpp"
#include "itemdb.hpp"
+#include "magic.hpp"
#include "map.hpp"
#include "mob.hpp"
#include "npc.hpp"
@@ -211,6 +208,7 @@ int add_str(const char *p)
int i;
char *lowcase;
+ // TODO remove lowcase
lowcase = strdup(p);
for (i = 0; lowcase[i]; i++)
lowcase[i] = tolower(lowcase[i]);
diff --git a/src/map/skill-pools.cpp b/src/map/skill-pools.cpp
index 6f2db8a..78d3f34 100644
--- a/src/map/skill-pools.cpp
+++ b/src/map/skill-pools.cpp
@@ -1,25 +1,9 @@
#include "skill.hpp"
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-#include <ctime>
-
-#include "../common/mt_rand.hpp"
-#include "../common/nullpo.hpp"
-#include "../common/socket.hpp"
-#include "../common/timer.hpp"
+#include "../common/cxxstdio.hpp"
#include "battle.hpp"
-#include "clif.hpp"
-#include "intif.hpp"
-#include "itemdb.hpp"
-#include "magic.hpp"
-#include "map.hpp"
-#include "mob.hpp"
-#include "party.hpp"
#include "pc.hpp"
-#include "script.hpp"
#include "../poison.hpp"
diff --git a/src/map/skill.cpp b/src/map/skill.cpp
index 68ceaff..c07cfca 100644
--- a/src/map/skill.cpp
+++ b/src/map/skill.cpp
@@ -1,25 +1,20 @@
#include "skill.hpp"
-#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
+#include "../common/cxxstdio.hpp"
#include "../common/mt_rand.hpp"
#include "../common/nullpo.hpp"
#include "../common/socket.hpp"
-#include "../common/timer.hpp"
#include "battle.hpp"
#include "clif.hpp"
-#include "intif.hpp"
-#include "itemdb.hpp"
#include "magic.hpp"
#include "map.hpp"
#include "mob.hpp"
-#include "party.hpp"
#include "pc.hpp"
-#include "script.hpp"
#include "../poison.hpp"
diff --git a/src/map/skill.hpp b/src/map/skill.hpp
index e5bae65..7c870a3 100644
--- a/src/map/skill.hpp
+++ b/src/map/skill.hpp
@@ -3,10 +3,7 @@
#include "skill.t.hpp"
-#include "../common/timer.hpp"
-
#include "map.hpp"
-#include "magic.hpp"
#define MAX_SKILL_PRODUCE_DB 150
#define MAX_SKILL_ARROW_DB 150
@@ -80,23 +77,23 @@ int skill_get_blewcount(SkillID id, int lv);
int skill_use_id(struct map_session_data *sd, int target_id,
SkillID skill_num, int skill_lv);
int skill_use_pos(struct map_session_data *sd,
- int skill_x, int skill_y, SkillID skill_num, int skill_lv);
+ int skill_x, int skill_y, SkillID skill_num, int skill_lv);
int skill_castend_map(struct map_session_data *sd, SkillID skill_num,
- const char *map);
+ const char *map);
int skill_cleartimerskill(struct block_list *src);
// 追加効果
int skill_additional_effect(struct block_list *src, struct block_list *bl,
- SkillID skillid, int skilllv, BF attack_type,
- unsigned int tick);
+ SkillID skillid, int skilllv, BF attack_type,
+ unsigned int tick);
int skill_delunit(struct skill_unit *unit);
int skill_clear_unitgroup(struct block_list *src);
int skill_unit_ondamaged(struct skill_unit *src, struct block_list *bl,
- int damage, unsigned int tick);
+ int damage, unsigned int tick);
int skill_castfix(struct block_list *bl, int time);
int skill_delayfix(struct block_list *bl, int time);
@@ -104,8 +101,8 @@ int skill_check_unit_range(int m, int x, int y, int range, SkillID skillid);
int skill_check_unit_range2(int m, int x, int y, int range);
int skill_unit_out_all(struct block_list *bl, unsigned int tick, int range);
int skill_unit_move(struct block_list *bl, unsigned int tick, int range);
-int skill_unit_move_unit_group(struct skill_unit_group *group, int m,
- int dx, int dy);
+int skill_unit_move_unit_group(struct skill_unit_group *group,
+ int m, int dx, int dy);
void skill_stop_dancing(struct block_list *src, int flag);
diff --git a/src/map/skill.t.hpp b/src/map/skill.t.hpp
index 0bdee8f..36090d5 100644
--- a/src/map/skill.t.hpp
+++ b/src/map/skill.t.hpp
@@ -3,7 +3,7 @@
#include <cstdint>
-#include "../common/utils.hpp"
+#include "../common/utils2.hpp"
// TODO remove most of these as their corresponding SkillIDs get deleted.
enum class StatusChange : uint16_t
diff --git a/src/map/storage.cpp b/src/map/storage.cpp
index 151c8b4..0f3cd10 100644
--- a/src/map/storage.cpp
+++ b/src/map/storage.cpp
@@ -3,19 +3,17 @@
#include "storage.hpp"
-#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "../common/db.hpp"
#include "../common/nullpo.hpp"
-#include "atcommand.hpp"
-#include "battle.hpp"
#include "chrif.hpp"
#include "clif.hpp"
#include "intif.hpp"
#include "itemdb.hpp"
+#include "map.hpp"
#include "pc.hpp"
#include "../poison.hpp"
diff --git a/src/map/storage.hpp b/src/map/storage.hpp
index 6dd2178..9daa446 100644
--- a/src/map/storage.hpp
+++ b/src/map/storage.hpp
@@ -4,8 +4,6 @@
#ifndef STORAGE_HPP
#define STORAGE_HPP
-#include "../common/mmo.hpp"
-
int storage_storageopen(struct map_session_data *sd);
int storage_storageadd(struct map_session_data *sd, int index, int amount);
int storage_storageget(struct map_session_data *sd, int index, int amount);
diff --git a/src/map/tmw.cpp b/src/map/tmw.cpp
index 84c84ef..0229f17 100644
--- a/src/map/tmw.cpp
+++ b/src/map/tmw.cpp
@@ -3,28 +3,16 @@
#include <cctype>
#include <cstring>
+#include "../common/cxxstdio.hpp"
#include "../common/nullpo.hpp"
-#include "../common/socket.hpp"
-#include "../common/timer.hpp"
-#include "../common/version.hpp"
#include "atcommand.hpp"
#include "battle.hpp"
-#include "chat.hpp"
#include "chrif.hpp"
#include "clif.hpp"
#include "intif.hpp"
-#include "itemdb.hpp"
-#include "magic.hpp"
#include "map.hpp"
-#include "mob.hpp"
-#include "npc.hpp"
-#include "party.hpp"
#include "pc.hpp"
-#include "script.hpp"
-#include "skill.hpp"
-#include "storage.hpp"
-#include "trade.hpp"
#include "../poison.hpp"
diff --git a/src/map/tmw.hpp b/src/map/tmw.hpp
index a5b198c..d64f45e 100644
--- a/src/map/tmw.hpp
+++ b/src/map/tmw.hpp
@@ -1,7 +1,7 @@
#ifndef TMW_HPP
#define TMW_HPP
-#include "map.hpp"
+#include "../common/const_array.hpp"
int tmw_CheckChatSpam(struct map_session_data *sd, const char *message);
void tmw_GmHackMsg(const_string line);
diff --git a/src/map/trade.cpp b/src/map/trade.cpp
index 8881ea1..b255298 100644
--- a/src/map/trade.cpp
+++ b/src/map/trade.cpp
@@ -1,8 +1,6 @@
#include "trade.hpp"
-#include <cstdio>
-#include <cstring>
-
+#include "../common/cxxstdio.hpp"
#include "../common/nullpo.hpp"
#include "battle.hpp"
diff --git a/src/map/trade.hpp b/src/map/trade.hpp
index a05981f..0edca9c 100644
--- a/src/map/trade.hpp
+++ b/src/map/trade.hpp
@@ -1,8 +1,6 @@
#ifndef TRADE_HPP
#define TRADE_HPP
-#include "map.hpp"
-
void trade_traderequest(struct map_session_data *sd, int target_id);
void trade_tradeack(struct map_session_data *sd, int type);
void trade_tradeadditem(struct map_session_data *sd, int index, int amount);
diff --git a/src/tool/eathena-monitor.cpp b/src/tool/eathena-monitor.cpp
index 69681b6..2d12312 100644
--- a/src/tool/eathena-monitor.cpp
+++ b/src/tool/eathena-monitor.cpp
@@ -7,14 +7,12 @@
* gcc -o eathena-monitor eathena-monitor.c
*/
-#include <sys/types.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <unistd.h>
#include <csignal>
-#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>