summaryrefslogtreecommitdiff
path: root/herculesversion/packetversion.py
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-14 18:41:10 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-14 18:41:10 +0300
commit086ec646cbe26d9fe5565a77dd0a910f10f53dd2 (patch)
treec5c1da4162f2e5afe351c455d6c19f0ec613070e /herculesversion/packetversion.py
parentc06b0e0f5a1d3a64a5e15e4341ea3ff23a11025b (diff)
downloadevol-tools-086ec646cbe26d9fe5565a77dd0a910f10f53dd2.tar.gz
evol-tools-086ec646cbe26d9fe5565a77dd0a910f10f53dd2.tar.bz2
evol-tools-086ec646cbe26d9fe5565a77dd0a910f10f53dd2.tar.xz
evol-tools-086ec646cbe26d9fe5565a77dd0a910f10f53dd2.zip
herculesversion: update parsing in packetversion.py and add year parameters.
Diffstat (limited to 'herculesversion/packetversion.py')
-rwxr-xr-xherculesversion/packetversion.py16
1 files changed, 14 insertions, 2 deletions
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)