Skip to content

Commit 805daf5

Browse files
authored
Merge pull request #222 from jsza/master
Fixed #221
2 parents b94fd63 + 038fd0b commit 805daf5

File tree

1 file changed

+8
-3
lines changed
  • addons/source-python/packages/source-python/engines

1 file changed

+8
-3
lines changed

addons/source-python/packages/source-python/engines/sound.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
# Paths
3535
from paths import GAME_PATH
3636
# Stringtables
37-
from stringtables import string_tables
37+
from stringtables import INVALID_STRING_INDEX, string_tables
3838
from stringtables.downloads import Downloadables
3939

4040

@@ -323,7 +323,9 @@ def is_precached(self):
323323
324324
:rtype: bool
325325
"""
326-
return self.sample in string_tables.soundprecache
326+
# We can't use engine_sound.is_sound_precached here because it always
327+
# returns True.
328+
return string_tables.soundprecache[self.sample] != INVALID_STRING_INDEX
327329

328330

329331
class StreamSound(_BaseSound):
@@ -368,4 +370,7 @@ def is_precached(self):
368370
369371
:rtype: bool
370372
"""
371-
return self._stream_sample in string_tables.soundprecache
373+
# We can't use engine_sound.is_sound_precached here because it always
374+
# returns True.
375+
index = string_tables.soundprecache[self._stream_sample]
376+
return index != INVALID_STRING_INDEX

0 commit comments

Comments
 (0)