]> jfr.im git - irc/gameservirc.git/blame_incremental - gameserv/extern.h
Fixed a major bug that had player fights core dumping the server
[irc/gameservirc.git] / gameserv / extern.h
... / ...
CommitLineData
1#ifndef EXTERN_H
2#define EXTERN_H
3
4#define E extern
5
6#define LEVELS 12 // Levels in the game
7#define REALLEVELS 9 // Levels to load from monsters.dat
8#define MONSTERS 12 // Monsters per level
9
10#include <stdarg.h>
11#include "player.h"
12#include "list.h"
13#include "config.h"
14#include "options.h"
15
16#if TIME_WITH_SYS_TIME
17# include <sys/time.h>
18# include <time.h>
19#else
20# if HAVE_SYS_TIME_H
21# include <sys/time.h>
22# else
23# include <time.h>
24# endif
25#endif
26
27// Hash.cpp stuff start
28#define U_TABLE_SIZE 1999
29E unsigned long HASH(const unsigned char *name, int size_of_table);
30// hash.cpp stuff end
31
32
33E int day;
34E void save_day();
35E void load_day();
36
37// The socket
38E int sock;
39
40
41/* config.cpp start */
42E int load_config_file(char *config = "gameserv.conf");
43E void unload_config_file();
44E char *s_GameServ;
45E char *c_Forest;
46E char *c_ForestTopic;
47E char *gshost;
48E char *gsident;
49E char *pidfile;
50
51#if defined(P10)
52E char *gsnum;
53#endif
54
55E char *servername;
56E char *remoteserver;
57E char *remoteport;
58E char *remotepass;
59E char *playerdata;
60E char *logfile;
61E char *monsterdata;
62E char *adminpass;
63E char *VERSION;
64E char *PACKAGE;
65E char *welcomemsg;
66
67E bool shuttingdown;
68E int welcomedelay;
69E int updateperiod;
70E int forestfights;
71E int maxafightdistance;
72E int maxbfightdistance;
73
74/* config.cpp end */
75
76E List<aClient> players[U_TABLE_SIZE];
77E List<aClient> clients[U_TABLE_SIZE];
78E Monster boss;
79
80/** List search functions **/
81E aClient *find(char *nick);
82E aClient *find(const char *nick);
83E aClient *findbynick(char *nick);
84E aClient *findbynick(const char *nick);
85E aClient *findbyrealnick(char *realnick);
86E aClient *findplayer(const char *name);
87E aClient *findIRCplayer(const char *nick);
88#ifdef P10
89E aClient *findbyrealnick(char *realnick);
90#endif
91
92/** Sock writing functions **/
93E void notice(const char *source, const char *dest, const char *fmt, ...);
94E void raw(const char *fmt, ...);
95
96/** gameserv.cpp **/
97E void gameserv(char *source, char *buf);
98E Monster *monsters[LEVELS][MONSTERS];
99
100/** forest.cpp **/
101E void forest(char *source, char *buf);
102
103/** functions.cpp **/
104
105E bool is_playing(char *u);
106E bool is_playing(aClient *user);
107
108E bool is_fighting(char *u);
109E bool is_fighting(aClient *user);
110
111E bool player_fight(char *u);
112E bool player_fight(aClient *user);
113
114E bool master_fight(char *u);
115E bool master_fight(aClient *user);
116
117#ifndef HAVE_STRTOK
118E char *strtok(char *str, const char *delim);
119#endif
120
121E char *spaces(int len, char *seperator);
122E void display_monster(char *u);
123E void display_players(char *u);
124E int stricmp(const char *s1, const char *s2);
125E int strnicmp(const char *s1, const char *s2, size_t len);
126E long int chartoint(char ch);
127E int isstringnum(char *num);
128E long int pow (int x, int y);
129E long int stringtoint(char *number);
130E void init_masters();
131E void init_monsters();
132E bool load_monsters();
133E void delete_monsters();
134E void delete_masters();
135E Monster *getNewMonster(Monster *m);
136E void deleteMonster(Monster *m);
137E void refresh(Player *p);
138E void refreshall();
139E void reset(Player *p);
140E void resetall();
141
142E void do_attack(char *u);
143E void do_bank(char *u);
144E void do_fight(char *u);
145E void do_forest(char *u);
146E void do_heal(char *u);
147E void do_identify(char *u);
148E void do_invenory(char *u);
149E void do_list(char *u);
150E void do_logout(char *u);
151E void do_play(char *u);
152E void do_quitg(char *u);
153E void do_refresh(char *u);
154E void do_register(char *u);
155E void do_reset(char *u);
156E void do_run(char *u);
157E void do_stats(char *u);
158E void do_store(char *u);
159E void do_tavern(char *u);
160E void do_use(char *u);
161E void see_mystic(char *u);
162
163E void logout(aClient *user); // log a user off the game
164E void showstats(const char *u, const char *nick);
165E void showinventory(aClient *from, aClient *to = NULL);
166/* Database saving stuff */
167
168E int save_gs_dbase();
169E int load_gs_dbase();
170
171// Log File Stuff
172E void log(const char *fmt, ...);
173
174#endif