[1606] in Coldmud discussion meeting
Adding an option to toliteral() for decomp to obj numbers
daemon@ATHENA.MIT.EDU (Tue Jul 11 21:41:48 2000
)
Date: Tue, 11 Jul 2000 18:36:23 -0700 (PDT)
From: Jeremy Weatherford <xidus@xidus.net>
To: coldstuff@cold.org
Reply-To: coldstuff@cold.org
Hello,
The ColdC function toliteral() currently calls data_to_literal with the
DF_WITH_OBJNAMES flag set, so that objnums are looked up to objnames
whereever possible. I'd like to be able to pass an option to toliteral()
that passes DF_NO_OPTS to data_to_literal instead, always returning
objnums as is.
I need this functionality for an in-game textdump routine, btw. I've
implemented it in my own code in a quick-and-dirty manner. I don't
understand the Genesis hardcode well enough to implement in correctly yet.
Below is my version of COLDC_FUNC(toliteral) in src/ops/data.c, though.
Thanks,
Jeremy Weatherford
xidus@xidus.net
http://xidus.net
----------------8<-------------
COLDC_FUNC(toliteral) {
cStr *str;
INIT_1_OR_2_ARGS(ANY_TYPE, ANY_TYPE);
str = data_to_literal(&args[0], (argc == 2) ? FALSE : TRUE);
pop(argc);
push_string(str);
string_discard(str);
}