summaryrefslogtreecommitdiff
path: root/src/mmo
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2014-08-13 14:55:49 -0700
committerBen Longbons <b.r.longbons@gmail.com>2014-08-27 11:29:45 -0700
commit9951ad78c80e144c166a7d476cad7ffdf84332a9 (patch)
tree9f5498a9a3c23b62dc928288e72081e99f958f46 /src/mmo
parent749fec734c4583153fb2dbc80f1d21db2c2ab457 (diff)
downloadtmwa-9951ad78c80e144c166a7d476cad7ffdf84332a9.tar.gz
tmwa-9951ad78c80e144c166a7d476cad7ffdf84332a9.tar.bz2
tmwa-9951ad78c80e144c166a7d476cad7ffdf84332a9.tar.xz
tmwa-9951ad78c80e144c166a7d476cad7ffdf84332a9.zip
Debug debugging
Diffstat (limited to 'src/mmo')
-rw-r--r--src/mmo/core.cpp4
-rw-r--r--src/mmo/core.hpp4
-rw-r--r--src/mmo/ids.py30
-rw-r--r--src/mmo/strs.py35
4 files changed, 72 insertions, 1 deletions
diff --git a/src/mmo/core.cpp b/src/mmo/core.cpp
index f1a8d07..ff12f17 100644
--- a/src/mmo/core.cpp
+++ b/src/mmo/core.cpp
@@ -106,7 +106,7 @@ void sig_proc(int)
*/
} // namespace tmwa
-int main(int argc, char **argv)
+int tmwa_main(int argc, char **argv)
{
using namespace tmwa;
@@ -156,4 +156,6 @@ int main(int argc, char **argv)
do_sendrecv(next);
do_parsepacket();
}
+
+ return 0;
}
diff --git a/src/mmo/core.hpp b/src/mmo/core.hpp
index 5b2dbbb..259dd90 100644
--- a/src/mmo/core.hpp
+++ b/src/mmo/core.hpp
@@ -43,3 +43,7 @@ extern int do_init(Slice<ZString>);
/// or when if we manage to exit() gracefully.
extern void term_func(void);
} // namespace tmwa
+
+/// grumble grumble stupid intertwined includes mumble mumble
+__attribute__((warn_unused_result))
+extern int tmwa_main(int argc, char **argv);
diff --git a/src/mmo/ids.py b/src/mmo/ids.py
new file mode 100644
index 0000000..2d26215
--- /dev/null
+++ b/src/mmo/ids.py
@@ -0,0 +1,30 @@
+for s in [
+ 'Species',
+ 'AccountId',
+ 'CharId',
+ 'PartyId',
+ 'ItemNameId',
+ 'BlockId',
+]:
+ class OtherId(object):
+ __slots__ = ('_value')
+ name = 'tmwa::%s' % s
+ enabled = True
+
+ def __init__(self, value):
+ self._value = value
+
+ def to_string(self):
+ value = self._value
+ fields = value.type.fields()
+ field0 = fields[-1]
+ return '%s' % (value[field0])
+
+ tests = [
+ ('tmwa::wrap<tmwa::%s>(123)' % s, '123'),
+ ]
+ globals()[s] = OtherId
+ del OtherId
+
+class GmLevel(object):
+ pass
diff --git a/src/mmo/strs.py b/src/mmo/strs.py
new file mode 100644
index 0000000..3e39ef4
--- /dev/null
+++ b/src/mmo/strs.py
@@ -0,0 +1,35 @@
+for s in [
+ 'AccountName',
+ 'AccountPass',
+ 'AccountCrypt',
+ 'AccountEmail',
+ 'ServerName',
+ 'PartyName',
+ 'VarName',
+ 'MapName',
+ 'CharName',
+]:
+ class OtherString(object):
+ __slots__ = ('_value')
+ name = 'tmwa::%s' % s
+ enabled = True
+
+ def __init__(self, value):
+ self._value = value
+
+ def to_string(self):
+ value = self._value
+ fields = value.type.fields()
+ field0 = fields[-1]
+ return '%s' % value[field0]
+
+ test_extra = '''
+ #include "../strings/fwd.hpp"
+ using tmwa::operator "" _s;
+ '''
+
+ tests = [
+ ('tmwa::stringish<tmwa::%s>("Hello"_s)' % s, '"Hello"'),
+ ]
+ globals()[s] = OtherString
+ del OtherString