Fix consistency

This commit is contained in:
Arkshine 2015-07-16 07:49:46 +02:00
parent c775cfca73
commit 9223989a01
3 changed files with 9 additions and 7 deletions

View File

@ -25,18 +25,18 @@
template<> template<>
int Compare<ke::AString>(const ke::AString &k1, const ke::AString &k2) int Compare<ke::AString>(const ke::AString &k1, const ke::AString &k2)
{ {
return k1.compare(k2.chars()); return k1.compare(k2);
} }
template<> template<>
int CompareAlt<char const *, ke::AString>(char const * const &k1, ke::AString const &k2) int CompareAlt<char const *, ke::AString>(char const * const &k1, ke::AString const &k2)
{ {
return strcmp(k1, k2.chars()); return k2.compare(k1);
} }
template<> template<>
int CompareAlt<ke::AString, ke::AString>(ke::AString const &k1, ke::AString const &k2) int CompareAlt<ke::AString, ke::AString>(ke::AString const &k1, ke::AString const &k2)
{ {
return strcmp(k1.chars(), k2.chars()); return k1.compare(k2);
} }
template<> template<>

View File

@ -112,14 +112,16 @@ const char *translate(AMX *amx, cell amxaddr, const char *key)
if (def == NULL) if (def == NULL)
{ {
if (debug) if (debug && status == ERR_BADLANG)
{ {
ke::AString lang(pLangName); ke::AString lang(pLangName);
if (status == ERR_BADLANG && (BadLang_Table.AltFindOrInsert(ke::Move(lang)).last + 120.0f < gpGlobals->time)) lang_err &err = BadLang_Table.AltFindOrInsert(ke::Move(lang));
if (err.last + 120.0f < gpGlobals->time)
{ {
AMXXLOG_Error("[AMXX] Language \"%s\" not found", pLangName); AMXXLOG_Error("[AMXX] Language \"%s\" not found", pLangName);
BadLang_Table.AltFindOrInsert(ke::Move(lang)).last = gpGlobals->time; err.last = gpGlobals->time;
} }
} }

View File

@ -164,7 +164,7 @@ public:
{ {
if (hashbucket->at(i) == hash) if (hashbucket->at(i) == hash)
{ {
if (key.compare(keybucket->at(i).chars()) == 0) if (key.compare(keybucket->at(i)) == 0)
{ {
return &(m_DataBuckets[bucketnum].at(i)); return &(m_DataBuckets[bucketnum].at(i));
} }