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:
@@ -9665,27 +9665,27 @@ void BltCharInvPanel()
|
||||
// print armor/weight/camo labels
|
||||
mprintf(UI_CHARINV.Text.ArmorLabel.iX, UI_CHARINV.Text.ArmorLabel.iY, pInvPanelTitleStrings[ 0 ] );
|
||||
|
||||
#ifdef CHINESE
|
||||
if( g_lang == i18n::Lang::zh ) {
|
||||
mprintf(UI_CHARINV.Text.ArmorPercent.iX, UI_CHARINV.Text.ArmorPercent.iY, ChineseSpecString1 );
|
||||
#else
|
||||
} else {
|
||||
mprintf(UI_CHARINV.Text.ArmorPercent.iX, UI_CHARINV.Text.ArmorPercent.iY, L"%%" );
|
||||
#endif
|
||||
}
|
||||
|
||||
mprintf(UI_CHARINV.Text.WeightLabel.iX, UI_CHARINV.Text.WeightLabel.iY, pInvPanelTitleStrings[ 1 ] );
|
||||
|
||||
#ifdef CHINESE
|
||||
if( g_lang == i18n::Lang::zh ) {
|
||||
mprintf(UI_CHARINV.Text.WeightPercent.iX, UI_CHARINV.Text.WeightPercent.iY, ChineseSpecString1 );
|
||||
#else
|
||||
} else {
|
||||
mprintf(UI_CHARINV.Text.WeightPercent.iX, UI_CHARINV.Text.WeightPercent.iY, L"%%" );
|
||||
#endif
|
||||
}
|
||||
|
||||
mprintf(UI_CHARINV.Text.CamoLabel.iX, UI_CHARINV.Text.CamoLabel.iY, pInvPanelTitleStrings[ 2 ] );
|
||||
|
||||
#ifdef CHINESE
|
||||
if( g_lang == i18n::Lang::zh ) {
|
||||
mprintf(UI_CHARINV.Text.CamoPercent.iX, UI_CHARINV.Text.CamoPercent.iY, ChineseSpecString1 );
|
||||
#else
|
||||
} else {
|
||||
mprintf(UI_CHARINV.Text.CamoPercent.iX, UI_CHARINV.Text.CamoPercent.iY, L"%%" );
|
||||
#endif
|
||||
}
|
||||
|
||||
const auto width = UI_CHARINV.Text.PercentWidth;
|
||||
const auto height = UI_CHARINV.Text.PercentHeight;
|
||||
|
||||
Reference in New Issue
Block a user