mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
use exhaustive switch instead of if statements
This commit is contained in:
committed by
majcosta
parent
30e5d8f91c
commit
433de0e67b
@@ -27,7 +27,11 @@ if(ADDRESS_SANITIZER)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
|
# TODO: fix the warnings here and turn them on
|
||||||
|
# https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warnings-c4000-through-c4199
|
||||||
add_compile_options("/wd4838") # silence implicit narrowing conversion warnings
|
add_compile_options("/wd4838") # silence implicit narrowing conversion warnings
|
||||||
|
# add_compile_options("/w14061")
|
||||||
|
# add_compile_options("/w14062")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# whether we are using MSBuild as a generator
|
# whether we are using MSBuild as a generator
|
||||||
@@ -150,6 +154,7 @@ foreach(app IN LISTS ApplicationTargets)
|
|||||||
add_library(${language_library})
|
add_library(${language_library})
|
||||||
target_sources(${language_library} PRIVATE ${i18nSrc})
|
target_sources(${language_library} PRIVATE ${i18nSrc})
|
||||||
target_compile_definitions(${language_library} PRIVATE ${compilationFlags} ${debugFlags})
|
target_compile_definitions(${language_library} PRIVATE ${compilationFlags} ${debugFlags})
|
||||||
|
target_compile_options(${language_library} PRIVATE /w14062)
|
||||||
target_link_libraries(${exe} PRIVATE ${language_library})
|
target_link_libraries(${exe} PRIVATE ${language_library})
|
||||||
|
|
||||||
# go through all game libraries again and link them to the app executable
|
# go through all game libraries again and link them to the app executable
|
||||||
|
|||||||
+21
-13
@@ -483,19 +483,27 @@ namespace Loc
|
|||||||
}
|
}
|
||||||
bool Translate(vfs::String::char_t* str, int len, i18n::Lang lang)
|
bool Translate(vfs::String::char_t* str, int len, i18n::Lang lang)
|
||||||
{
|
{
|
||||||
if(lang == i18n::Lang::en || lang == i18n::Lang::de)
|
switch (lang) {
|
||||||
{
|
case i18n::Lang::en:
|
||||||
return true;
|
case i18n::Lang::de:
|
||||||
}
|
return true;
|
||||||
else if(lang == i18n::Lang::ru)
|
case i18n::Lang::ru:
|
||||||
{
|
for (int i = 0; i < len; i++)
|
||||||
for(int i=0; i<len; i++) str[i] = ToRussian(str[i]);
|
{
|
||||||
return true;
|
str[i] = ToRussian(str[i]);
|
||||||
}
|
}
|
||||||
else if(lang == i18n::Lang::pl)
|
return true;
|
||||||
{
|
case i18n::Lang::pl:
|
||||||
for(int i=0; i<len; i++) str[i] = ToPolish(str[i]);
|
for (int i = 0; i < len; i++)
|
||||||
return true;
|
{
|
||||||
|
str[i] = ToPolish(str[i]);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
case i18n::Lang::nl:
|
||||||
|
case i18n::Lang::fr:
|
||||||
|
case i18n::Lang::it:
|
||||||
|
case i18n::Lang::zh:
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user