mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Replace a ton of trivial #ifdefs with runtime checks
This one is big, but unless I missed something, should be all be
trivial.
scripted-diff with the following, then manually tweaked whatever needed:
```
if [ $# -ne 3 ]; then
echo "Usage: $0 '<pattern>' '<replacement>' '<filename>'"
exit 1
fi
pattern="$1"
replacement="$2"
filename="$3"
if [ ! -f "$filename" ]; then
echo "Error: File $filename does not exist."
exit 1
fi
sed -i '/'"$pattern"'/ {
:loop
$ !{
N
/'"$pattern"'.*\n.*#endif/ {
s/'"$pattern"'/'"$replacement"'/
s/#else/} else {/
s/#endif/}/
P
D
}
/'"$pattern"'/ b loop
}
}' "$filename"
echo "Replacement complete in $filename"
```
h/t to Grok2 for the sed command
This commit is contained in:
+4
-3
@@ -36,6 +36,7 @@
|
||||
|
||||
#include "LuaInitNPCs.h"
|
||||
#include "XML.h"
|
||||
#include <language.hpp>
|
||||
|
||||
BOOLEAN Style_JA = TRUE;
|
||||
extern INT8 Test = 0;
|
||||
@@ -726,11 +727,11 @@ void DisplaySirtechSplashScreen()
|
||||
* (2006-10-10, Sergeant_Kolja)
|
||||
*/
|
||||
#ifdef _DEBUG
|
||||
# if defined(ENGLISH)
|
||||
if( g_lang == i18n::Lang::en ) {
|
||||
AssertMsg( 0, String( "Wheter English nor German works. May be You built English - but have only German or other foreign Disk?" ) );
|
||||
# elif defined(GERMAN)
|
||||
} else if( g_lang == i18n::Lang::de ) {
|
||||
AssertMsg( 0, String( "Weder Englisch noch Deutsch geht. Deutsche Version kompiliert und mit englischer CDs gestartet? Das geht nicht!" ) );
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
AssertMsg( 0, String( "Failed to load %s", VObjectDesc.ImageFile ) );
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user