Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
_linkedlist.kill() function

 
Post new topic   Reply to topic Printable version
 View previous topic  Just Bot Dumb Post :: Post Woooo Doors.  View next topic  
Author Message
tikiman
Newbie


Joined: Jan 25 2003
Posts: 14
Offline

PostPosted: Wed Jan 29, 2003 4:36 pm    Post subject: _linkedlist.kill() function Reply to topic Reply with quote

Whenever I use this function I get either an assertion failure or Catid's command-crash bug error. The funny thing is I can use the append() function to add a node, then use a find() function and it will return the correct node. But if I try to kill() the same node within the same block of code I get errors. The code essentially looks like this:

Code: Show/Hide
captlist.append(name_ptr);
captlist.kill(name_ptr);


Where name_ptr is a String*. This is within a command definition in command.cpp of course. Anyone know whats going wrong here?
Back to top
View users profile Send private message Add User to Ignore List
SOS
Server Help Squatter


Joined: Dec 02 2002
Posts: 329
Offline

PostPosted: Wed Jan 29, 2003 11:39 pm    Post subject: Reply to topic Reply with quote

So the captlist is a _linkedlist<String*>? Hmm...
Well, I can't think of anything that can cause this :/
Did you run it through a debugger?
_________________
3y3 4m l33t h4x0r
j0! 3y3 4m t4lking to j00!
fux0red 5cr1pt k1dd13.
-"l33t h41ku"
Back to top
View users profile Send private message Add User to Ignore List Send email
catid
Guest


Offline

PostPosted: Thu Jan 30, 2003 5:54 pm    Post subject: linkedlist Reply to topic Reply with quote

_linkedlist <String> MyList;

MyList.append(new String("Hello"));

_listnode <String> *parse = MyList.head;

while (parse)
{
String *s = parse->item;

if (*s == "blah")
MyList.kill(parse);

parse = parse->next;
}

etc...
Back to top
SOS
Server Help Squatter


Joined: Dec 02 2002
Posts: 329
Offline

PostPosted: Fri Jan 31, 2003 1:03 am    Post subject: Reply to topic Reply with quote

Actually caid, that would crash, lol sa_tongue.gif
parse = parse->next; before the kill icon_smile.gif
Back to top
View users profile Send private message Add User to Ignore List Send email
tikiman
Newbie


Joined: Jan 25 2003
Posts: 14
Offline

PostPosted: Sat Feb 01, 2003 4:58 pm    Post subject: Reply to topic Reply with quote

Thanks catid, I wouldn't have thought to put the (new String("Hello")) as a parameter to the append function:)

I actually ended up using <PlayerTag> instead and just copied some of your code to do the kill(). But the post you made would have worked as well.
Back to top
View users profile Send private message Add User to Ignore List
catid
Guest


Offline

PostPosted: Sat Feb 22, 2003 8:26 pm    Post subject: oops! Reply to topic Reply with quote

oops! Sorry =)
Back to top
VampZ
Guest


Offline

PostPosted: Mon Feb 24, 2003 2:44 pm    Post subject: Reply to topic Reply with quote

wouldn't that crash too?

I'd think you would have to do:

_listnode tempNode = parse->next;
MyList.kill(parse);
parse = tempNode;
Back to top
VampZ
Guest


Offline

PostPosted: Mon Feb 24, 2003 2:49 pm    Post subject: Reply to topic Reply with quote

err... and make sure you declare _listnode tempNode outside of the loop to prevent duplicate declarations of course.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot Questions All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 678 page(s) served in previous 5 minutes.

phpBB Created this page in 0.576214 seconds : 33 queries executed (78.1%): GZIP compression disabled