]> jfr.im git - irc/gameservirc.git/blob - gameserv/extern.h
This is a major bugfix for several mistakes made in coding that were
[irc/gameservirc.git] / gameserv / extern.h
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 12 // Levels to load from monsters.dat
8 #define MONSTERS 12 // Monsters per level
9
10 #include <stdarg.h>
11 #include "player.h"
12 #include "level.h"
13 #include "list.h"
14 #include "config.h"
15 #include "myString.h"
16 #include "options.h"
17
18 #if TIME_WITH_SYS_TIME
19 # include <sys/time.h>
20 # include <time.h>
21 #else
22 # if HAVE_SYS_TIME_H
23 # include <sys/time.h>
24 # else
25 # include <time.h>
26 # endif
27 #endif
28
29 // Hash.cpp stuff start
30 #define U_TABLE_SIZE 1999
31 E unsigned long sHASH(const unsigned char *name);
32 E unsigned long iHASH(const unsigned char *name);
33 // hash.cpp stuff end
34
35 E long lastrefresh;
36 E void save_lastrefresh();
37 E void load_lastrefresh();
38
39 // The socket
40 E int sock;
41
42
43 /* config.cpp start */
44 E int load_config_file(char *config = "gameserv.conf");
45 E void unload_config_file();
46 E char *s_GameServ;
47 E char *c_Forest;
48 E char *c_ForestTopic;
49 E char *gshost;
50 E char *gsident;
51 E char *pidfile;
52 E char *newsdata;
53
54 #if defined(P10)
55 E char *gsnum;
56 #endif
57
58 E char *servername;
59 E char *remoteserver;
60 E char *remoteport;
61 E char *remotepass;
62 E char *playerdata;
63 E char *logfile;
64 E char *adminpass;
65 E char *VERSION;
66 E char *PACKAGE;
67 E char *welcomemsg;
68 E char *ignoreserverslist;
69
70 E long configflags;
71 E long refreshperiod;
72 E int level1expire;
73 E int defaultexpire;
74 E bool shuttingdown;
75 E int welcomedelay;
76 E int updateperiod;
77 E int forestfights;
78 E int maxafightdistance;
79 E int maxbfightdistance;
80 E int maxidletime;
81 E int idlecheckperiod;
82
83 /* config.cpp end */
84
85 E List<aClient> players[U_TABLE_SIZE];
86 E List<aClient> clients[U_TABLE_SIZE];
87 E List<myString> todaysnews;
88 E Monster boss;
89
90 /** tcpclient.cpp **/
91 E void check_idles();
92
93 /** List search functions **/
94 E aClient *find(char *nick);
95 E aClient *find(const char *nick);
96 E aClient *findbynick(char *nick);
97 E aClient *findbynick(const char *nick);
98 E aClient *findbyrealnick(char *realnick);
99 E aClient *findplayer(const char *name);
100 E aClient *findIRCplayer(const char *nick);
101 #ifdef P10
102 E aClient *findbyrealnick(char *realnick);
103 #endif
104
105 /** tcpclient.cpp **/
106
107 /** Sock writing functions **/
108 E void notice(const char *source, const char *dest, const char *fmt, ...);
109 E void raw(const char *fmt, ...);
110
111 /** news.cpp **/
112 E void addNews(List<myString> &news, const char *fmt, ...);
113 E void do_news(char *u);
114 E void clearNews(List<myString> &news);
115 E void loadNews(char *filename, List<myString> &news);
116 E void saveNews(char *filename, List<myString> &news);
117 E void showNews(char *nick, List<myString> &news);
118
119 /** gameserv.cpp **/
120 E void gameserv(char *source, char *buf);
121 E Level levels[LEVELS];
122
123 /** forest.cpp **/
124 E void forest(char *source, char *buf);
125
126 /** functions.cpp **/
127
128 E bool is_playing(char *u);
129 E bool is_playing(aClient *user);
130
131 E bool is_fighting(char *u);
132 E bool is_fighting(aClient *user);
133
134 E bool player_fight(char *u);
135 E bool player_fight(aClient *user);
136
137 E bool master_fight(char *u);
138 E bool master_fight(aClient *user);
139
140 #ifndef HAVE_STRTOK
141 E char *strtok(char *str, const char *delim);
142 #endif
143
144 E char *spaces(int len, char *seperator);
145 E void display_monster(char *u);
146 E void display_players(char *u);
147 E int stricmp(const char *s1, const char *s2);
148 E int strnicmp(const char *s1, const char *s2, size_t len);
149 E long int chartoint(char ch);
150 E int isstringnum(char *num);
151 E long int pow (int x, int y);
152 E long int stringtoint(char *number);
153 E bool load_masters();
154 E bool load_monsters();
155 E bool load_levels();
156 E void delete_monsters();
157 E void delete_masters();
158 E Monster *getNewMonster(Monster *m);
159 E void deleteMonster(Monster *m);
160 E void refresh(Player *p);
161 E void refreshall();
162 E void updateTS(Player *p);
163 E bool timedOut(Player *p);
164 E void timeOutEvent(Player *p);
165 E void reset(Player *p);
166 E void resetall();
167
168 E void do_attack(char *u);
169 E void do_bank(char *u);
170 E void do_check(char *u);
171 E void do_fight(char *u);
172 E void do_forest(char *u);
173 E void do_heal(char *u);
174 E void do_identify(char *u);
175 E void do_invenory(char *u);
176 E void do_list(char *u);
177 E void do_logout(char *u);
178 E void do_play(char *u);
179 E void do_quitg(char *u);
180 E void do_refresh(char *u);
181 E void do_register(char *u);
182 E void do_reset(char *u);
183 E void do_run(char *u);
184 E void do_stats(char *u);
185 E void do_store(char *u);
186 E void do_tavern(char *u);
187 E void do_use(char *u);
188 E void see_mystic(char *u);
189
190 E void logout(aClient *user); // log a user off the game
191 E void showstats(const char *u, const char *nick);
192 E void showinventory(aClient *from, aClient *to = NULL);
193 /* Database saving stuff */
194
195 E int save_gs_dbase();
196 E int load_gs_dbase();
197
198 // Log File Stuff
199 E void log(const char *fmt, ...);
200
201 #endif