mirror of
https://github.com/1dot13/source.git
synced 2026-08-19 14:20:30 +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:
@@ -30,6 +30,7 @@
|
||||
#include "GameSettings.h"
|
||||
#include <vfs/Core/vfs.h>
|
||||
#include <vfs/Core/File/vfs_file.h>
|
||||
#include <language.hpp>
|
||||
|
||||
/*
|
||||
typedef struct
|
||||
@@ -488,11 +489,11 @@ BOOLEAN EnterBobbyRMailOrder()
|
||||
SetButtonCursor(guiBobbyRClearOrder, CURSOR_LAPTOP_SCREEN);
|
||||
SpecifyDisabledButtonStyle( guiBobbyRClearOrder, DISABLED_STYLE_NONE );
|
||||
//inshy: fix position of text for buttons
|
||||
#ifdef FRENCH
|
||||
if(g_lang == i18n::Lang::fr) {
|
||||
SpecifyButtonTextOffsets( guiBobbyRClearOrder, 13, 10, TRUE );
|
||||
#else
|
||||
} else {
|
||||
SpecifyButtonTextOffsets( guiBobbyRClearOrder, 39, 10, TRUE );
|
||||
#endif
|
||||
}
|
||||
|
||||
// Accept Order button
|
||||
guiBobbyRAcceptOrderImage = LoadButtonImage("LAPTOP\\AcceptOrderButton.sti", 2,0,-1,1,-1 );
|
||||
@@ -504,11 +505,11 @@ BOOLEAN EnterBobbyRMailOrder()
|
||||
DEFAULT_MOVE_CALLBACK, BtnBobbyRAcceptOrderCallback);
|
||||
SetButtonCursor( guiBobbyRAcceptOrder, CURSOR_LAPTOP_SCREEN);
|
||||
//inshy: fix position of text for buttons
|
||||
#ifdef FRENCH
|
||||
if(g_lang == i18n::Lang::fr) {
|
||||
SpecifyButtonTextOffsets( guiBobbyRAcceptOrder, 15, 24, TRUE );
|
||||
#else
|
||||
} else {
|
||||
SpecifyButtonTextOffsets( guiBobbyRAcceptOrder, 43, 24, TRUE );
|
||||
#endif
|
||||
}
|
||||
SpecifyDisabledButtonStyle( guiBobbyRAcceptOrder, DISABLED_STYLE_SHADED );
|
||||
|
||||
if( gbSelectedCity == -1 )
|
||||
|
||||
Reference in New Issue
Block a user