From 086ec646cbe26d9fe5565a77dd0a910f10f53dd2 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 14 Jan 2016 18:41:10 +0300 Subject: herculesversion: update parsing in packetversion.py and add year parameters. --- herculesversion/packetversion.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'herculesversion') diff --git a/herculesversion/packetversion.py b/herculesversion/packetversion.py index 82fd896..279aea2 100755 --- a/herculesversion/packetversion.py +++ b/herculesversion/packetversion.py @@ -48,7 +48,11 @@ def readPackets(path, oldVersion, newVersion): for line in f: if searchState == 0: # search for #if PACKETVER if line.find(defStart) == 0: - ver = int(line[len(defStart):]) + ver = line[len(defStart):] + idx = ver.find("//"); + if idx > 0: + ver = ver[:idx] + ver = int(ver) if ver <= newVersion: if ver > oldVersion: newBlock = True @@ -98,8 +102,16 @@ def showPlan(data): if id1 != id2: print "{0:30} {1:4} -> {2:4}".format(line, id1, id2) +def showHelp(): + print "Show difference between packet versions." + print "Usage: {0} old new".format(sys.argv[0]) + def main(): - data = readPackets("hercules/src/map/packets.h", 20140416, 20141022) + if len(sys.argv) != 3: + showHelp(); + exit(); + + data = readPackets("hercules/src/map/packets.h", int(sys.argv[1]), int(sys.argv[2])) changed = findChangedPackets(data) showPlan(changed) -- cgit v1.2.3-70-g09d2