Skip to content

Commit 434d1cd

Browse files
committed
Add proper unit sorting criteria.
1 parent 5cbde02 commit 434d1cd

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
@@ -250,6 +250,19 @@ def __str__(self):
250250
def __repr__(self):
251251
return str(self)
252252

253+
def __cmp__(self, other):
254+
if other.id > self.id:
255+
return -1
256+
elif other.id < self.id:
257+
return 1
258+
else:
259+
if other.type > self.type:
260+
return -1
261+
elif other.type < self.type:
262+
return 1
263+
else:
264+
return 0
265+
253266
class Ability(object):
254267
pass
255268

0 commit comments

Comments
 (0)