kettek2/wiki/games/newsboy/Newsboy_0x00/engine/Index.h

24 lines
652 B
C

#ifndef INDEX_H
#define INDEX_H
/*
This is the header file for Index and Index-related functionality.
*/
struct Index {
char *ids; // memory of free spots
int size; // size
int bias; // "weight" that shows where the most free indexes are from the center
};
int initIndex(struct Index *index, int size);
int clearIndex(struct Index *index);
int growIndex(struct Index *index, int size);
int addIndex(struct Index *index, int id);
int remIndex(struct Index *index, int id);
int toggleIndex(struct Index *index, int id);
int getIndex(struct Index *index, int id);
// find and return first free index
int acquireIndex(struct Index *index);
#endif