mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-04 14:01:22 +00:00
* Experiment flag for not caching ref on 515 * Update vv_outfit.dm * MANUAL MIRROR https://github.com/tgstation/tgstation/pull/72657 * MANUAL MIRROR https://github.com/tgstation/tgstation/pull/73788 --------- Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com> Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com> Co-authored-by: lessthnthree <three@lessthanthree.dk> Co-authored-by: Gandalf <9026500+Gandalf2k15@users.noreply.github.com>
31 lines
1.2 KiB
Plaintext
31 lines
1.2 KiB
Plaintext
// Stuff that is relatively "core" and is used in other defines/helpers
|
|
|
|
//Returns the hex value of a decimal number
|
|
//len == length of returned string
|
|
#define num2hex(X, len) num2text(X, len, 16)
|
|
|
|
//Returns an integer given a hex input, supports negative values "-ff"
|
|
//skips preceding invalid characters
|
|
#define hex2num(X) text2num(X, 16)
|
|
|
|
/// Stringifies whatever you put into it.
|
|
#define STRINGIFY(argument) #argument
|
|
|
|
/// subtypesof(), typesof() without the parent path
|
|
#define subtypesof(typepath) ( typesof(typepath) - typepath )
|
|
|
|
/// Until a condition is true, sleep
|
|
#define UNTIL(X) while(!(X)) stoplag()
|
|
|
|
#ifdef EXPERIMENT_515_DONT_CACHE_REF
|
|
/// Takes a datum as input, returns its ref string
|
|
#define text_ref(datum) ref(datum)
|
|
#else
|
|
/// Takes a datum as input, returns its ref string, or a cached version of it
|
|
/// This allows us to cache \ref creation, which ensures it'll only ever happen once per datum, saving string tree time
|
|
/// It is slightly less optimal then a []'d datum, but the cost is massively outweighed by the potential savings
|
|
/// It will only work for datums mind, for datum reasons
|
|
/// : because of the embedded typecheck
|
|
#define text_ref(datum) (isdatum(datum) ? (datum:cached_ref ||= "\ref[datum]") : ("\ref[datum]"))
|
|
#endif
|