@@ -547,14 +547,16 @@ class GameSummary(Resource):
547547 def __init__ (self , summary_file , filename = None , ** options ):
548548 super (GameSummary , self ).__init__ (summary_file , filename ,** options )
549549
550- self .players = dict ()
550+ self .team = dict ()
551+ self .teams = list ()
552+ self .players = list ()
553+ self .winners = list ()
554+ self .player = dict ()
551555 self .build_orders = dict ()
552556 self .image_urls = list ()
553557 self .localization_urls = dict ()
554558 self .lobby_properties = dict ()
555559 self .lobby_player_properties = dict ()
556- self .teams = dict ()
557- self .winners = list ()
558560
559561 self .data = zlib .decompress (summary_file .read ()[16 :])
560562 self .parts = list ()
@@ -614,14 +616,18 @@ def __init__(self, summary_file, filename=None, **options):
614616 # { 0: 3405691582L, 1: 11402158793782460416L}
615617 player .unknown2 = player_struct [0 ][1 ][1 ]
616618
617- self .players [player .pid ] = player
619+ self .players .append (player )
620+ self .player [player .pid ] = player
621+
618622 if not player .teamid in self .teams :
619- self .teams [player .teamid ] = list ()
620- self .teams [player .teamid ].append (player .pid )
623+ self .team [player .teamid ] = list ()
624+ self .team [player .teamid ].append (player .pid )
625+ self .teams = [self .team [tid ] for tid in sorted (self .team .keys ())]
626+
621627
622628 # Parse graph and stats stucts, for each player
623- for pid in self .players :
624- p = self . players [ pid ]
629+ for pid , p in self .player . items () :
630+ print type ( pid ), type ( p )
625631 # Graph stuff
626632 xy = [(o [2 ], o [0 ]) for o in self .parts [4 ][0 ][2 ][1 ][p .pid ]]
627633 p .army_graph = Graph ([], [], xy_list = xy )
@@ -659,8 +665,7 @@ def __init__(self, summary_file, filename=None, **options):
659665 bo_structs .append (self .parts [4 ][0 ][3 :])
660666
661667 # This might not be the most effective way, but it works
662- for pid in self .players :
663- p = self .players [pid ]
668+ for pid , p in self .player .items ():
664669 bo = list ()
665670 for bo_struct in bo_structs :
666671 for order in bo_struct :
0 commit comments