Skip to content

Commit 30ed1a8

Browse files
committed
Add proper unit sorting criteria.
1 parent cdb34a1 commit 30ed1a8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

sc2reader/data/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,19 @@ def __str__(self):
255255
def __repr__(self):
256256
return str(self)
257257

258+
def __cmp__(self, other):
259+
if other.id > self.id:
260+
return -1
261+
elif other.id < self.id:
262+
return 1
263+
else:
264+
if other.type > self.type:
265+
return -1
266+
elif other.type < self.type:
267+
return 1
268+
else:
269+
return 0
270+
258271
class Ability(object):
259272
pass
260273

0 commit comments

Comments
 (0)