Skip to content

Commit 9d1c930

Browse files
committed
turns out you can actually embed numbers in strings in the preprocessor
1 parent 10a5a0d commit 9d1c930

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

code/parse/sexp.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@
115115
#undef MessageBox
116116
#endif
117117

118-
119-
120-
#define TRUE 1
121-
#define FALSE 0
118+
// these are useful for embedding numbers in SEXP help strings
119+
// see https://stackoverflow.com/questions/5459868/concatenate-int-to-string-using-c-preprocessor
120+
#define STR_HELPER(x) #x
121+
#define STR(x) STR_HELPER(x)
122122

123123

124124
SCP_vector<sexp_oper> Operators = {
@@ -2825,7 +2825,7 @@ int check_sexp_syntax(int node, int return_type, int recursive, int *bad_node, i
28252825
if (*CTEXT(node) != '#') { // not a manual source?
28262826
if ( stricmp(CTEXT(node), "<any wingman>") != 0)
28272827
if ( stricmp(CTEXT(node), "<none>") != 0 ) // not a special token?
2828-
if ((ship_name_lookup(CTEXT(node), TRUE) < 0) && (wing_name_lookup(CTEXT(node), 1) < 0)) // is it in the mission?
2828+
if ((ship_name_lookup(CTEXT(node), 1) < 0) && (wing_name_lookup(CTEXT(node), 1) < 0)) // is it in the mission?
28292829
if (Fred_running || !mission_check_ship_yet_to_arrive(CTEXT(node)))
28302830
return SEXP_CHECK_INVALID_MSG_SOURCE;
28312831
}
@@ -33166,7 +33166,7 @@ SCP_vector<sexp_help_struct> Sexp_help = {
3316633166
// Goober5000
3316733167
{ OP_AI_IGNORE_NEW, "Ai-ignore-new (Ship goal)\r\n"
3316833168
"\tTells the specified ship to ignore the given target and not consider it when picking something "
33169-
"to attack. Up to MAX_IGNORE_NEW_OBJECTS targets can be ignored at a time. Targets ignored by "
33169+
"to attack. Up to " STR(MAX_IGNORE_NEW_OBJECTS) " targets can be ignored at a time. Targets ignored by "
3317033170
"any given ship do not affect targets ignored by any other ship.\r\n\r\n"
3317133171
"Takes 2 arguments...\r\n"
3317233172
"\t1:\tName of target to ignore.\r\n"

0 commit comments

Comments
 (0)