mirror of
https://github.com/1dot13/source.git
synced 2026-08-05 14:00:23 +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:
@@ -152,6 +152,7 @@
|
||||
#endif
|
||||
|
||||
#include "LuaInitNPCs.h"
|
||||
#include <language.hpp>
|
||||
|
||||
|
||||
#ifdef JA2UB
|
||||
@@ -7205,7 +7206,7 @@ BOOLEAN LoadSoldierStructure( HWFILE hFile )
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef GERMAN
|
||||
if( g_lang == i18n::Lang::de ) {
|
||||
// Fix neutral flags
|
||||
if ( guiCurrentSaveGameVersion < 94 )
|
||||
{
|
||||
@@ -7215,7 +7216,7 @@ BOOLEAN LoadSoldierStructure( HWFILE hFile )
|
||||
Menptr[ cnt].aiData.bNeutral = FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
//#ifdef JA2UB
|
||||
//if the soldier has the NON weapon version of the merc knofe or merc umbrella
|
||||
//ConvertWeapons( &Menptr[ cnt ] );
|
||||
@@ -9896,9 +9897,9 @@ UINT32 CalcJA2EncryptionSet( SAVED_GAME_HEADER * pSaveGameHeader )
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef GERMAN
|
||||
if( g_lang == i18n::Lang::de ) {
|
||||
uiEncryptionSet *= 11;
|
||||
#endif
|
||||
}
|
||||
|
||||
uiEncryptionSet = uiEncryptionSet % 10;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user