| 1 |
/*
|
| 2 |
* This program is free software; you can redistribute it and/or
|
| 3 |
* modify it under the terms of the GNU General Public License
|
| 4 |
* as published by the Free Software Foundation; either version 2
|
| 5 |
* of the License, or (at your option) any later version.
|
| 6 |
*
|
| 7 |
* This program is distributed in the hope that it will be useful,
|
| 8 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 9 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 10 |
* GNU General Public License for more details.
|
| 11 |
*
|
| 12 |
* You should have received a copy of the GNU General Public License
|
| 13 |
* along with this program; if not, write to the Free Software
|
| 14 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
| 15 |
*/
|
| 16 |
#ifndef INCLUDED_ANONGAME_TYPES
|
| 17 |
#define INCLUDED_ANONGAME_TYPES
|
| 18 |
|
| 19 |
#include "common/setup_before.h"
|
| 20 |
#ifdef JUST_NEED_TYPES
|
| 21 |
# include "account.h"
|
| 22 |
# include "connection.h"
|
| 23 |
# include "compat/uint.h"
|
| 24 |
#else
|
| 25 |
# define JUST_NEED_TYPES
|
| 26 |
# include "account.h"
|
| 27 |
# include "connection.h"
|
| 28 |
# include "compat/uint.h"
|
| 29 |
# undef JUST_NEED_TYPES
|
| 30 |
#endif
|
| 31 |
# include "anongame_gameresult.h"
|
| 32 |
#include "common/setup_after.h"
|
| 33 |
|
| 34 |
typedef struct
|
| 35 |
{
|
| 36 |
int currentplayers;
|
| 37 |
int totalplayers;
|
| 38 |
struct connection * player[ANONGAME_MAX_GAMECOUNT];
|
| 39 |
t_account * account[ANONGAME_MAX_GAMECOUNT];
|
| 40 |
int result[ANONGAME_MAX_GAMECOUNT];
|
| 41 |
t_anongame_gameresult * results[ANONGAME_MAX_GAMECOUNT];
|
| 42 |
} t_anongameinfo;
|
| 43 |
|
| 44 |
typedef struct
|
| 45 |
{
|
| 46 |
t_anongameinfo * info;
|
| 47 |
int count;
|
| 48 |
t_uint32 id;
|
| 49 |
t_uint32 tid;
|
| 50 |
struct connection * tc[ANONGAME_MAX_GAMECOUNT/2];
|
| 51 |
t_uint32 race;
|
| 52 |
t_uint32 handle;
|
| 53 |
unsigned int addr;
|
| 54 |
char loaded;
|
| 55 |
char joined;
|
| 56 |
t_uint8 playernum;
|
| 57 |
t_uint32 map_prefs;
|
| 58 |
t_uint8 type;
|
| 59 |
t_uint8 gametype;
|
| 60 |
int queue;
|
| 61 |
} t_anongame;
|
| 62 |
|
| 63 |
typedef struct
|
| 64 |
{
|
| 65 |
struct connection * c;
|
| 66 |
t_uint32 map_prefs;
|
| 67 |
char const * versiontag;
|
| 68 |
} t_matchdata;
|
| 69 |
|
| 70 |
#endif
|
| 71 |
|
| 72 |
/*****/
|
| 73 |
#ifndef JUST_NEED_TYPES
|
| 74 |
#ifndef INCLUDED_ANONGAME_PROTOS
|
| 75 |
#define INCLUDED_ANONGAME_PROTOS
|
| 76 |
|
| 77 |
#define JUST_NEED_TYPES
|
| 78 |
#include "common/packet.h"
|
| 79 |
#include "connection.h"
|
| 80 |
#undef JUST_NEED_TYPES
|
| 81 |
|
| 82 |
extern int anongame_matchlists_create(void);
|
| 83 |
extern int anongame_matchlists_destroy(void);
|
| 84 |
|
| 85 |
extern int handle_anongame_search(t_connection * c, t_packet const * packet);
|
| 86 |
extern int anongame_unqueue(t_connection * c, int queue);
|
| 87 |
|
| 88 |
extern char anongame_arranged(int queue);
|
| 89 |
extern int anongame_stats(t_connection * c);
|
| 90 |
|
| 91 |
extern t_anongameinfo * anongameinfo_create(int totalplayers);
|
| 92 |
extern void anongameinfo_destroy(t_anongameinfo * i);
|
| 93 |
|
| 94 |
extern t_anongameinfo * anongame_get_info(t_anongame * a);
|
| 95 |
extern int anongame_get_currentplayers(t_anongame *a);
|
| 96 |
extern int anongame_get_totalplayers(t_anongame *a);
|
| 97 |
extern t_connection * anongame_get_player(t_anongame * a, int plnum);
|
| 98 |
extern int anongame_get_count(t_anongame *a);
|
| 99 |
extern t_uint32 anongame_get_id(t_anongame * a);
|
| 100 |
extern t_connection * anongame_get_tc(t_anongame *a, int tpnumber);
|
| 101 |
extern t_uint32 anongame_get_race(t_anongame * a);
|
| 102 |
extern t_uint32 anongame_get_handle(t_anongame * a);
|
| 103 |
extern unsigned int anongame_get_addr(t_anongame * a);
|
| 104 |
extern char anongame_get_loaded(t_anongame * a);
|
| 105 |
extern char anongame_get_joined(t_anongame * a);
|
| 106 |
extern t_uint8 anongame_get_playernum(t_anongame * a);
|
| 107 |
extern t_uint8 anongame_get_queue(t_anongame *a);
|
| 108 |
|
| 109 |
extern void anongame_set_result(t_anongame * a, int result);
|
| 110 |
extern void anongame_set_gameresults(t_anongame * a, t_anongame_gameresult * results);
|
| 111 |
extern void anongame_set_handle(t_anongame *a, t_uint32 h);
|
| 112 |
extern void anongame_set_addr(t_anongame *a, unsigned int addr);
|
| 113 |
extern void anongame_set_loaded(t_anongame * a, char loaded);
|
| 114 |
extern void anongame_set_joined(t_anongame * a, char joined);
|
| 115 |
|
| 116 |
extern int handle_w3route_packet(t_connection * c, t_packet const * const packet);
|
| 117 |
extern int handle_anongame_join(t_connection * c);
|
| 118 |
|
| 119 |
#endif
|
| 120 |
#endif
|