mirror of
https://github.com/1dot13/source.git
synced 2026-09-16 14:47:17 +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:
@@ -40,6 +40,7 @@
|
||||
#include "Luaglobal.h"
|
||||
#include "LuaInitNPCs.h"
|
||||
#include "Interface.h"
|
||||
#include <language.hpp>
|
||||
|
||||
#include "GameInitOptionsScreen.h"
|
||||
extern WorldItems gAllWorldItems;
|
||||
@@ -1631,12 +1632,12 @@ void AdjustLoyaltyForCivsEatenByMonsters( INT16 sSectorX, INT16 sSectorY, UINT8
|
||||
swprintf( str, gpStrategicString[STR_PB_BANDIT_KILLCIVS_IN_SECTOR], ubHowMany, pSectorString );
|
||||
else
|
||||
{
|
||||
#ifdef CHINESE
|
||||
if( g_lang == i18n::Lang::zh ) {
|
||||
//diffrent order of words in Chinese
|
||||
swprintf( str, gpStrategicString[STR_DIALOG_CREATURES_KILL_CIVILIANS], pSectorString, ubHowMany );
|
||||
#else
|
||||
} else {
|
||||
swprintf( str, gpStrategicString[STR_DIALOG_CREATURES_KILL_CIVILIANS], ubHowMany, pSectorString );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
DoScreenIndependantMessageBox( str, MSG_BOX_FLAG_OK, MapScreenDefaultOkBoxCallback );
|
||||
|
||||
Reference in New Issue
Block a user