| 1 |
/************************************************************************ |
| 2 |
* serverside.h Server-side parts of dopewars * |
| 3 |
* Copyright (C) 1998-2022 Ben Webb * |
| 4 |
* Email: [email protected] * |
| 5 |
* WWW: https://dopewars.sourceforge.io/ * |
| 6 |
* * |
| 7 |
* This program is free software; you can redistribute it and/or * |
| 8 |
* modify it under the terms of the GNU General Public License * |
| 9 |
* as published by the Free Software Foundation; either version 2 * |
| 10 |
* of the License, or (at your option) any later version. * |
| 11 |
* * |
| 12 |
* This program is distributed in the hope that it will be useful, * |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 15 |
* GNU General Public License for more details. * |
| 16 |
* * |
| 17 |
* You should have received a copy of the GNU General Public License * |
| 18 |
* along with this program; if not, write to the Free Software * |
| 19 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, * |
| 20 |
* MA 02111-1307, USA. * |
| 21 |
************************************************************************/ |
| 22 |
|
| 23 |
#ifndef __DP_SERVERSIDE_H__ |
| 24 |
#define __DP_SERVERSIDE_H__ |
| 25 |
|
| 26 |
#ifdef HAVE_CONFIG_H |
| 27 |
#include <config.h> |
| 28 |
#endif |
| 29 |
|
| 30 |
#include "dopewars.h" |
| 31 |
|
| 32 |
extern GSList *FirstServer; |
| 33 |
extern char *PidFile; |
| 34 |
|
| 35 |
void CleanUpServer(void); |
| 36 |
void BreakHandle(int sig); |
| 37 |
void ClientLeftServer(Player *Play); |
| 38 |
void StopServer(void); |
| 39 |
Player *HandleNewConnection(void); |
| 40 |
void ServerLoop(struct CMDLINE *cmdline); |
| 41 |
void HandleServerPlayer(Player *Play); |
| 42 |
void HandleServerMessage(gchar *buf, Player *ReallyFrom); |
| 43 |
void FinishGame(Player *Play, char *Message); |
| 44 |
void SendHighScores(Player *Play, gboolean EndGame, char *Message); |
| 45 |
void SendEvent(Player *To); |
| 46 |
void SendDrugsHere(Player *To, gboolean DisplayBusts); |
| 47 |
void BuyObject(Player *From, char *data); |
| 48 |
int RandomOffer(Player *To); |
| 49 |
void HandleAnswer(Player *From, Player *To, char *answer); |
| 50 |
void ClearPrices(Player *Play); |
| 51 |
int LoseBitch(Player *Play, Inventory *Guns, Inventory *Drugs); |
| 52 |
void GainBitch(Player *Play); |
| 53 |
void SetFightTimeout(Player *Play); |
| 54 |
void ClearFightTimeout(Player *Play); |
| 55 |
long GetMinimumTimeout(GSList *First); |
| 56 |
GSList *HandleTimeouts(GSList *First); |
| 57 |
void ConvertHighScoreFile(const gchar *convertfile); |
| 58 |
void OpenHighScoreFile(void); |
| 59 |
gboolean CheckHighScoreFileConfig(void); |
| 60 |
void CloseHighScoreFile(void); |
| 61 |
gboolean HighScoreRead(FILE *fp, struct HISCORE *MultiScore, |
| 62 |
struct HISCORE *AntiqueScore, gboolean ReadHeader); |
| 63 |
void CopsAttackPlayer(Player *Play); |
| 64 |
void AttackPlayer(Player *Play, Player *Attacked); |
| 65 |
gboolean IsOpponent(Player *Play, Player *Other); |
| 66 |
void Fire(Player *Play); |
| 67 |
void WithdrawFromCombat(Player *Play); |
| 68 |
void RunFromCombat(Player *Play, int ToLocation); |
| 69 |
gboolean CanPlayerFire(Player *Play); |
| 70 |
gboolean CanRunHere(Player *Play); |
| 71 |
Player *GetNextShooter(Player *Play); |
| 72 |
void DropPrivileges(void); |
| 73 |
|
| 74 |
#ifdef GUI_SERVER |
| 75 |
void GuiServerLoop(struct CMDLINE *cmdline, gboolean is_service); |
| 76 |
#ifdef CYGWIN |
| 77 |
void ServiceMain(struct CMDLINE *cmdline); |
| 78 |
#endif |
| 79 |
#endif |
| 80 |
#ifndef CYGWIN |
| 81 |
gchar *GetLocalSocket(void); |
| 82 |
#endif |
| 83 |
|
| 84 |
#endif /* __DP_SERVERSIDE_H__ */ |