You can see it all here:
auxilary.h
vector.h
vector.c
main.c
How could one use it?
- stack-like behaviour stack.c
- queue-like behaviour queue.c
- list-like behaviour list.c
- dynamic array behaviour darray.c
- cool c-array wrapper array-wrapper.c
Of course you can mix these approaches to get what you exactly want to.
What's more?
- search for and counts occurences of element in vector
- compare vectors
- concatenate and insert one vector to another
- get part of vector as a new vector
A friend of mine asked if vector could prevent such errors he can ocassionally see:
for ( af = ch->affected; af != NULL; af = af->next )
{
if ( af->bitvector == &AFF_PARALYZE )
{
affect_strip(ch,af->type);
if (!IS_NPC( ch ) )
send_to_char( "Z powodu bólu, odzyskujesz kontrolę nad swoim ciałem\n\r", ch );
}
}
affect-strip removes one or more nodes from af list which can cause crash or something unpredictable.
What such situation could look like when using vector? I hope he will be able to answer to this question himself. :)
No comments:
Post a Comment