Development > Coding

function to list the inventory? (commandline)

(1/2) > >>

Hoehrer:
Is there already a function (for debugging) that lists _every_ type of item that can be in the inventor (csi->ods[all] should hold them  i suppose?)

If not i'll probably write one.. then the next question is where to put it ... but i'll come back to that ;)

Werner

oxyXen:
Hi

Probably a collection of debugging-experimental-funcs would be nice, something like dbg_showallitems.

ox

Mattn:
imo there is no function rigth now.

maybe we should rename all the *list functions to dbg_*list and make them only available in debug-compiles....??

Hoehrer:

--- Quote from: "Mattn" ---imo there is no function rigth now.

maybe we should rename all the *list functions to dbg_*list and make them only available in debug-compiles....??
--- End quote ---


I don't see a reason to not let them stay in a release as well (bug-reports, etc...), and cheating isn't really a problem since most of the info is already readable in the ufo-files.

concerning a common prefix for _pure_ debugging functions is a good idea. "DBG_*" sounds good to me for C functions. The naming of the console should either be "dbg_***list" "or simply ***list" (IMHO the shorter the better) where the latter is how is's here in my code currently: "invlist" & "techlist" in the commandline . Since nearly every command in the console is a 'debug' function right now i don#t see a reason to use a special prefix for that.

Ok, back to the first topic: I've started to write a simple function yesterday to print the ics->sds content (named it "R_ItemList_f "or something like that after RS_TechnologyList_f in cl_research.c) ... i don't have access to it right now, so i'm not sure about the name.

I currently put it into q_shared.c (+ header in q_shared.h) and made it availabe to the in-game console in cl_research.c since i didn't find any suited function in q_shared.c at all. So i'm currently searching fo a better place for this. (maybe cl_main.?)

Werner

PS: on a sidenote how do i use parameters in the binsing of console-commands (just an example: "techlistlist plasma" will list only plasma)

Mattn:

--- Code: ---
char* filter = NULL;
if (Cmd_Argc() == 2) // 2 because the first one it the actual command itself
{
   filter = Cmd_Argv(1);
}
if ( filter != NULL )
[,....]

--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version