Skip to content

Commit 50a3f1f

Browse files
committed
Fixes for sound replacement strings
1 parent a56d407 commit 50a3f1f

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

dlls/soundreplacement.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ const std::string& SoundReplacementList::ReplacementFor(const std::string &sound
2020
if (it != _replacementMap.end()) {
2121
return it->second;
2222
}
23-
return std::string();
23+
return SoundReplacementSystem::emptyString;
2424
}
2525

26+
const std::string SoundReplacementSystem::emptyString;
27+
2628
static void LogExpectedQuoteError(const char* fileName, int line, int pos)
2729
{
2830
ALERT(at_console, "Parsing %s. Expected \" at line %d, position %d\n", fileName, line, pos);
@@ -90,7 +92,7 @@ bool SoundReplacementSystem::EnsureReplacementFile(const char *fileName)
9092
const std::string originalName(buffer + origNameStart, buffer + origNameEnd);
9193
const std::string replacementName(buffer + replNameStart, buffer + replNameEnd);
9294
replacementMap[originalName] = replacementName;
93-
ALERT(at_console, "File '%s' is replaced with '%s'\n", originalName.c_str(), replacementName.c_str());
95+
ALERT(at_console, "Sound replacement '%s': '%s' is replaced with '%s'\n", fileName, originalName.c_str(), replacementName.c_str());
9496
}
9597
else
9698
{
@@ -138,5 +140,5 @@ const std::string& SoundReplacementSystem::FindReplacement(const char *fileName,
138140
return soundReplacementFile.ReplacementFor(originalSoundName);
139141
}
140142
}
141-
return std::string();
143+
return SoundReplacementSystem::emptyString;
142144
}

dlls/soundreplacement.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class SoundReplacementList
99
{
1010
public:
11-
typedef std::map<const std::string, const std::string> ReplacementMap;
11+
typedef std::map<std::string, std::string> ReplacementMap;
1212
SoundReplacementList();
1313
SoundReplacementList(ReplacementMap&& replacementMap);
1414
bool IsValid() const;
@@ -23,6 +23,8 @@ class SoundReplacementSystem
2323
public:
2424
bool EnsureReplacementFile(const char* fileName);
2525
const std::string& FindReplacement(const char* fileName, const char* originalSoundName);
26+
27+
static const std::string emptyString;
2628
private:
2729
std::map<std::string, SoundReplacementList> _fileMap;
2830
};

0 commit comments

Comments
 (0)