project-navigation
Personal tools

Author Topic: function to list the inventory? (commandline)  (Read 5582 times)

Hoehrer

  • Guest
function to list the inventory? (commandline)
« on: March 27, 2006, 12:03:24 am »
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

  • Guest
function to list the inventory? (commandline)
« Reply #1 on: March 27, 2006, 12:22:17 am »
Hi

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

ox

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
function to list the inventory? (commandline)
« Reply #2 on: March 27, 2006, 08:15:46 am »
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

  • Guest
function to list the inventory? (commandline)
« Reply #3 on: March 27, 2006, 09:07:08 am »
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....??


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)

Offline Mattn

  • Administrator
  • PHALANX Commander
  • *****
  • Posts: 4831
  • https://github.com/mgerhardy/vengi
    • View Profile
    • Vengi Voxel Tools
function to list the inventory? (commandline)
« Reply #4 on: March 27, 2006, 12:02:12 pm »
Code: [Select]

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

oxyXen

  • Guest
function to list the inventory? (commandline)
« Reply #5 on: March 27, 2006, 01:32:43 pm »
Quote
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.

The reason is consistency

Quote
I don't see a reason to not let them stay in a release as well (bug-reports, etc...)


True. Quake3 hase some startup command for the server, to activate debugging-support.

ox

Hoehrer

  • Guest
function to list the inventory? (commandline)
« Reply #6 on: March 27, 2006, 02:14:57 pm »
Quote from: "Mattn"
Code: [Select]

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

Thanks, i'll have a look into it.

Quote from: "oxyXen"
Quote
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.

The reason is consistency

To be consitent with what? Are there already built-in commands that start with "dbg_"? Or do you mean consistent with the names in C-code?

And where do we draw the line between "dbg_" and the others? Some of the functions _should_ only be used for debugging, but some of them may become a frequently used command for the average player.

I'm do not want to make this a huge topic - since it's rather unimportant for the game itself - so i'm fine with any way we decide on.

Werner

oxyXen

  • Guest
function to list the inventory? (commandline)
« Reply #7 on: March 27, 2006, 02:38:24 pm »
Hi

To be consistent with all the cl_ g_ sv_ mn_ and so on stuff. But i'm like you not interested in a huge discussion on the dopic ;)

ox