ID:2581688
 
Resolved
Addition of two constant strings at compile-time was broken.
BYOND Version:513
Operating System:Windows 10 Home 64-bit
Web Browser:Chrome 83.0.4103.106
Applies to:Dream Maker
Status: Resolved (513.1527)

This issue has been resolved.
Version: 513.1526

Descriptive Problem Summary:

Using string addition operations in defines no longer works properly.

Numbered Steps to Reproduce Problem:
See below.

Code Snippet (if applicable) to Reproduce Problem:
#define SERVER_PATH_FORMAT "data/server/"
#define SOAPSTONE_FILE_FORMAT SERVER_PATH_FORMAT + "soapstone.json"


Expected Results:
SOAPSTONE_FILE_FORMAT would be "data/server/soapstone.json"

Actual Results:
SOAPSTONE_FILE_FORMAT is "soapstone.json"

Does the problem occur:
Every time? Or how often? Every time.
In other games? Yes.
In other user accounts? Unknown.
On other computers? Unknown.

When does the problem NOT occur?
Unknown, seems to always occur.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)
Yes, it did not occur on the last version of 513 beta, before the switch.

Workarounds:
Writing your defines like
#define SERVER_PATH_FORMAT "data/server/"

#define SOAPSTONE_FILE_FORMAT "[SERVER_PATH_FORMAT]soapstone.json"

#define CKEY_PATH_FORMAT "data/users/%CKEY/"

#define CHARACTER_PATH_FORMAT "[CKEY_PATH_FORMAT]characters/"
#define CHARACTER_FILE_FORMAT "character_%CID.json"

#define CONNECTION_PATH_FORMAT "[CKEY_PATH_FORMAT]connections/"
#define CONNECTION_FILE_FORMAT "%DATE_%TIME.json"

Works fine.



String additions did change, but only at the code generation level. Can you provide a test project that shows this in action? The snippets aren't enough to show where the defines are being used.

FYI you should always surround the define with parentheses as best practice.
/client/verb/Add_Things()
src << ("A" + "B")

Prints "B" instead of "AB".
I sent the test case to you via discord on the coderbus channel.
#define SAVED_VALUE(F,v) (F[".0/"+#v] || initial(##v))
//as in
var = SAVED_VALUE(savefile, varinsavefile)


Also broke in 26.
Lummox JR resolved issue with message:
Addition of two constant strings at compile-time was broken.