Code: Show/Hide /* this is a generic interface for swappable games. a swappable game is a game
* type module that can be loaded/unloaded while an arena is still running, so * you can rotate through several game types without changing arena. */ #ifndef __SWAPPABLEGAME_H #define __SWAPPABLEGAME_H /** the callback function when a game has been won. tgt contains the winners * or NULL if there were none. */ typedef void (*GameoverFunc)(Arena *arena, const Target *tgt); /** the fg_ctf interface struct */ typedef struct Iswappablegame { INTERFACE_HEAD_DECL void (*StartGame)(Arena *arena, GameoverFunc func); void (*StopGame)(Arena *arena); } Iswappablegame; #endif |
Code: Show/Hide #include "fg_ctf.h"
#define GAME_COUNT 2 local const struct { const char *iid; const char *votename; const char *helptext; } game_info[] = { /* edit this and GAME_COUNT to add more games */ { I_SWAPPABLEGAME_CTF, "CTF", "Bring the enemy flag to your base" }, { I_SWAPPABLEGAME_CTF, "CTF", "Bring the enemy flag to your base" }, }; |