Skip to content

Commit 61453d0

Browse files
committed
* Moved ReplayBuffer up for future debugging options
* Moved raw reading from player constructor to reader * Removed unneeded replaybuffer.py * Moved processor-specific variables to processors
1 parent 0d1e6b8 commit 61453d0

File tree

8 files changed

+141
-485
lines changed

8 files changed

+141
-485
lines changed

sc2reader/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def read_file(filename,config=DefaultConfig()):
4848
for file,readers in config.readers.iteritems():
4949
for reader in readers:
5050
if reader.reads(replay.build):
51-
reader.read(archive.read_file(file),replay)
51+
reader.read(ReplayBuffer(archive.read_file(file)),replay)
5252
break
5353
else:
5454
raise NotYetImplementedError("No parser was found that accepted the replay file;check configuration")

sc2reader/constants.py

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# EDSTR_CATEGORY_Race
55
# EDSTR_PLAYERPROPS_RACE
66
# question mark means not confirmed data
7-
races = {
7+
LOCALIZED_RACES = {
88

99
# deDE
1010
# enUS
@@ -33,7 +33,11 @@
3333
'人類': 'Terran'
3434
}
3535

36-
RACES = {
36+
#
37+
# Codes as found in bytestream
38+
#
39+
40+
RACE_CODES = {
3741
'rreT': 'Terran',
3842
'greZ': 'Zerg',
3943
'torP': 'Protoss',
@@ -45,8 +49,7 @@
4549
'128': 'Header',
4650
'125': 'Ping',
4751
}
48-
49-
TEAM_COLORS = {
52+
TEAM_COLOR_CODES = {
5053
'10ct': "Red",
5154
'20ct': "Blue",
5255
'30ct': "Teal",
@@ -64,53 +67,47 @@
6467
'51ct': "??",
6568
'61ct': "??",
6669
}
67-
DIFFICULTIES = {
70+
DIFFICULTY_CODES = {
6871
'yEyV': 'Very easy',
6972
'ysaE': 'Easy',
7073
'ideM': 'Medium',
7174
'draH': 'Hard',
7275
'dHyV': 'Very hard',
7376
'asnI': 'Insane',
7477
}
75-
76-
GAME_TYPES = {
78+
GAME_TYPE_CODES = {
7779
'virP': 'Private',
7880
'buP': 'Public',
7981
'mmA': 'Ladder',
8082
'': 'Single Player',
8183
}
82-
8384
# (name, key for team ids)
84-
GAME_FORMATS = {
85-
'1v1': ('1v1', 0x07d2,),
86-
'2v2': ('2v2', 0x07d3,),
87-
'3v3': ('3v3', 0x07d4,),
88-
'4v4': ('4v4', 0x07d5,),
89-
'AFF': ('FFA', 0x07d6,),
85+
GAME_FORMAT_CODES = {
86+
'1v1': '1v1',
87+
'2v2': '2v2',
88+
'3v3': '3v3',
89+
'4v4': '4v4',
90+
'AFF': 'FFA',
9091
}
91-
92-
GAME_SPEEDS = {
92+
GAME_SPEED_CODES = {
9393
'rolS': 'Slower',
9494
'wolS': 'Slow',
9595
'mroN': 'Normal',
9696
'tsaF': 'Fast',
9797
'rsaF': 'Faster',
9898
}
99-
100-
PLAYER_TYPES = {
99+
PLAYER_TYPE_CODES = {
101100
'nmuH': 'Human',
102101
'pmoC': 'Computer',
103102
}
104-
105-
GATEWAYS = {
103+
GATEWAY_CODES = {
106104
'US': 'Americas',
107105
'KR': 'Asia',
108106
'EU': 'Europe',
109107
'SG': 'South East Asia',
110108
'XX': 'Public Test',
111109
}
112-
113-
COLOURS = {
110+
COLOR_CODES = {
114111
'B4141E': 'Red',
115112
'0042FF': 'Blue',
116113
'1CA7EA': 'Teal',

sc2reader/data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def visit(self, timestamp, player, object_type=None):
154154
# TODO siege tanks should not auto-assign
155155
self.morph_to(object_type, timestamp)
156156

157-
if not player.is_obs and not self.player:
157+
if not player.is_observer and not self.player:
158158
self.player = player
159159

160160
def morph_to(self, cls, timestamp):

0 commit comments

Comments
 (0)