From 91eda24ddc8b56c6022a4d99519f28230e6b3bbf Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Sun, 24 Feb 2008 18:41:02 +0000 Subject: fixed correction count. fixed miss-behaving server --- scripts/netobj.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'scripts/netobj.py') diff --git a/scripts/netobj.py b/scripts/netobj.py index 107f49c4..03228e34 100644 --- a/scripts/netobj.py +++ b/scripts/netobj.py @@ -184,6 +184,7 @@ def emit_header_file(f, p): print >>f, "int netobj_secure(int type, void *data, int size);" print >>f, "const char *netobj_get_name(int type);" + print >>f, "int netobj_num_corrections();" print >>f, "" for obj in p.objects: @@ -199,11 +200,15 @@ def emit_source_file(f, p, protofilename): for l in p.source_raw: print >>f, l + print >>f, "" + print >>f, "static int num_corrections = 0;" + print >>f, "int netobj_num_corrections() { return num_corrections; }" + print >>f, "" print >>f, "static int netobj_clamp_int(int v, int min, int max)" print >>f, "{" - print >>f, "if(v>f, "if(v>max) return max;" - print >>f, "return v;" + print >>f, "\tif(v>f, "\tif(v>max) { num_corrections++; return max; }" + print >>f, "\treturn v;" print >>f, "}" print >>f, "" -- cgit 1.4.1