Server Help

Bot Questions - In there mervbot source...

Anonymous - Wed Nov 05, 2003 4:12 pm
Post subject: In there mervbot source...
Where is _listnode defined? Or is it something out of the project?
Cyan~Fire - Wed Nov 05, 2003 6:26 pm
Post subject:
It's not in the DLL project, but is linked to when you try to compile. It's in datatypes.h (and cpp).
It's rather complicated if you don't have much experience with C++ so I'll try to explain here.

_listnode is a portion of a _linkedlist, which is basically like an array that can contain multiple datatypes. _linkedlists are used for the game flaglist, playerlist, and other struct lists. If you want to use one of these lists, use this:

Code: Show/Hide
_listnode <Datatype> *parse = list.head
while (parse)
{
  Datatype *object = parse->item
  //Perform functions on object
  parse = parse->next
}

Replace 'Datatype' with your desired object type (Flag, Player, Brick) and replace 'list' with your desired bot list of the data (flaglist, playerlist, bricklist).

Example on using a playerlist from Catid's rank plugin:
Code: Show/Hide
listnode <Player> *parse = playerlist->head;
while (parse)
{
   Player *p = parse->item;
   init_rank(p);
   parse = parse->next;
}


Hope this helps,
Cyan~Fire
Anonymous - Wed Nov 05, 2003 6:32 pm
Post subject:
I know what linked lists are and how to use them, just wondering about this one icon_smile.gif.
Anonymous - Wed Nov 05, 2003 6:35 pm
Post subject:
Also wanted to know where to find them, and thanks. I thought I looked in there for them (seemed the most logical place, checked there first)... I seem to only be able to find the definitions in the .h file, where is the code for it at?
Anonymous - Wed Nov 05, 2003 6:37 pm
Post subject:
Arg, I found them. icon_smile.gif
Anonymous - Wed Nov 05, 2003 6:42 pm
Post subject:
One more question, sorry. Where does AnonymousStruct come from?
Cyan~Fire - Wed Nov 05, 2003 9:53 pm
Post subject:
AnynymousStruct is just Catid's way of saying you can put any struct in there.
Dustpuppy - Thu Nov 06, 2003 6:25 am
Post subject:
For some reason (not quite sure why, something to do with the templating I believe) the function bodies have to be in the header.
And yes, you can replace AnonymousStruct with whatever type you want to make a list/node of. Look up templates in the MSDN if you need more info (and have it icon_smile.gif
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group