diff options
| author | oy <Tom_Adams@web.de> | 2011-04-13 20:37:12 +0200 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-04-13 20:37:12 +0200 |
| commit | 06115dd49dca2f8eb5f14606437e8fd20037cc4d (patch) | |
| tree | 5ec4bca6158319b3f5285d7689c5f94ae8da8c93 /datasrc/compile.py | |
| parent | 63e059b8fff6498e42b765a1dca000e53005ea77 (diff) | |
| download | zcatch-06115dd49dca2f8eb5f14606437e8fd20037cc4d.tar.gz zcatch-06115dd49dca2f8eb5f14606437e8fd20037cc4d.zip | |
added "Whitespace and line Endings cleanup" by GreYFoX
Diffstat (limited to 'datasrc/compile.py')
| -rw-r--r-- | datasrc/compile.py | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/datasrc/compile.py b/datasrc/compile.py index 0ae3bbc7..e8901c48 100644 --- a/datasrc/compile.py +++ b/datasrc/compile.py @@ -21,7 +21,7 @@ def create_flags_table(names): i += 1 lines += ["};"] return lines - + def EmitEnum(names, num): print("enum") print("{") @@ -92,11 +92,11 @@ if gen_client_content_source or gen_server_content_source: # NETWORK if gen_network_header: - + print("#ifndef GAME_GENERATED_PROTOCOL_H") print("#define GAME_GENERATED_PROTOCOL_H") print(network.RawHeader) - + for e in network.Enums: for l in create_enum_table(["%s_%s"%(e.name, v) for v in e.values], 'NUM_%sS'%e.name): print(l) print("") @@ -104,17 +104,17 @@ if gen_network_header: for e in network.Flags: for l in create_flags_table(["%s_%s" % (e.name, v) for v in e.values]): print(l) print("") - + for l in create_enum_table(["NETOBJ_INVALID"]+[o.enum_name for o in network.Objects], "NUM_NETOBJTYPES"): print(l) print("") for l in create_enum_table(["NETMSG_INVALID"]+[o.enum_name for o in network.Messages], "NUM_NETMSGTYPES"): print(l) print("") - + for item in network.Objects + network.Messages: for line in item.emit_declaration(): print(line) print("") - + EmitEnum(["SOUND_%s"%i.name.value.upper() for i in content.container.sounds.items], "NUM_SOUNDS") EmitEnum(["WEAPON_%s"%i.name.value.upper() for i in content.container.weapons.id.items], "NUM_WEAPONS") @@ -127,11 +127,11 @@ class CNetObjHandler char m_aMsgData[1024]; int m_NumObjCorrections; int ClampInt(const char *pErrorMsg, int Value, int Min, int Max); - + static const char *ms_apObjNames[]; static int ms_aObjSizes[]; static const char *ms_apMsgNames[]; - + public: CNetObjHandler(); @@ -140,7 +140,7 @@ public: int GetObjSize(int Type); int NumObjCorrections(); const char *CorrectedObjOn(); - + const char *GetMsgName(int Type); void *SecureUnpackMsg(int Type, CUnpacker *pUnpacker); const char *FailedMsgOn(); @@ -149,16 +149,16 @@ public: """) print("#endif // GAME_GENERATED_PROTOCOL_H") - + if gen_network_source: # create names lines = [] - + lines += ['#include <engine/shared/protocol.h>'] lines += ['#include <engine/message.h>'] lines += ['#include "protocol.h"'] - + lines += ['CNetObjHandler::CNetObjHandler()'] lines += ['{'] lines += ['\tm_pMsgFailedOn = "";'] @@ -202,7 +202,7 @@ if gen_network_source: lines += ['\t""'] lines += ['};'] lines += [''] - + lines += ['const char *CNetObjHandler::GetObjName(int Type)'] lines += ['{'] lines += ['\tif(Type < 0 || Type >= NUM_NETOBJTYPES) return "(out of range)";'] @@ -216,16 +216,16 @@ if gen_network_source: lines += ['\treturn ms_aObjSizes[Type];'] lines += ['};'] lines += [''] - - + + lines += ['const char *CNetObjHandler::GetMsgName(int Type)'] lines += ['{'] lines += ['\tif(Type < 0 || Type >= NUM_NETMSGTYPES) return "(out of range)";'] lines += ['\treturn ms_apMsgNames[Type];'] lines += ['};'] lines += [''] - - + + for l in lines: print(l) @@ -255,7 +255,7 @@ if gen_network_source: lines += ['{'] lines += ['\tswitch(Type)'] lines += ['\t{'] - + for item in network.Objects: for line in item.emit_validate(): lines += ["\t" + line] @@ -264,9 +264,9 @@ if gen_network_source: lines += ['\treturn -1;'] lines += ['};'] lines += [''] - - #int Validate(int Type, void *pData, int Size); - + + #int Validate(int Type, void *pData, int Size); + if 0: for item in network.Messages: for line in item.emit_unpack(): @@ -281,20 +281,20 @@ if gen_network_source: lines += ['\tsecure_unpack_%s,' % msg.name] lines += ['\t0x0'] lines += ['};'] - + # lines += ['void *CNetObjHandler::SecureUnpackMsg(int Type, CUnpacker *pUnpacker)'] lines += ['{'] lines += ['\tm_pMsgFailedOn = 0;'] lines += ['\tswitch(Type)'] lines += ['\t{'] - - + + for item in network.Messages: for line in item.emit_unpack(): lines += ["\t" + line] lines += ['\t'] - + lines += ['\tdefault:'] lines += ['\t\tm_pMsgFailedOn = "(type out of range)";'] lines += ['\t\tbreak;'] @@ -313,6 +313,6 @@ if gen_network_source: for l in lines: print(l) - + if gen_client_content_header or gen_server_content_header: print("#endif") |