| 1 |
/*
|
| 2 |
* (C) 2004 Olaf Freyer (aaron@cs.tu-berlin.de)
|
| 3 |
*
|
| 4 |
* This program is free software; you can redistribute it and/or
|
| 5 |
* modify it under the terms of the GNU General Public License
|
| 6 |
* as published by the Free Software Foundation; either version 2
|
| 7 |
* of the License, or (at your option) any later version.
|
| 8 |
*
|
| 9 |
* This program is distributed in the hope that it will be useful,
|
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 12 |
* GNU General Public License for more details.
|
| 13 |
*
|
| 14 |
* You should have received a copy of the GNU General Public License
|
| 15 |
* along with this program; if not, write to the Free Software
|
| 16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
| 17 |
*/
|
| 18 |
|
| 19 |
#ifndef INCLUDED_TEAM_TYPES
|
| 20 |
#define INCLUDED_TEAM_TYPES
|
| 21 |
|
| 22 |
# include "common/list.h"
|
| 23 |
#ifndef JUST_NEED_TYPES
|
| 24 |
# define JUST_NEED_TYPES
|
| 25 |
# include "account.h"
|
| 26 |
# undef JUST_NEED_TYPES
|
| 27 |
#else
|
| 28 |
# include "account.h"
|
| 29 |
#endif
|
| 30 |
#include "common/tag.h"
|
| 31 |
#ifdef HAVE_TIME_H
|
| 32 |
# include <time.h>
|
| 33 |
#endif
|
| 34 |
|
| 35 |
#define MAX_TEAMSIZE 4
|
| 36 |
|
| 37 |
typedef struct team
|
| 38 |
#ifdef TEAM_INTERNAL_ACCESS
|
| 39 |
{
|
| 40 |
unsigned char size;
|
| 41 |
int wins;
|
| 42 |
int losses;
|
| 43 |
int xp;
|
| 44 |
int level;
|
| 45 |
int rank;
|
| 46 |
unsigned int teamid;
|
| 47 |
unsigned int teammembers[MAX_TEAMSIZE];
|
| 48 |
t_account * members[MAX_TEAMSIZE];
|
| 49 |
t_clienttag clienttag;
|
| 50 |
time_t lastgame;
|
| 51 |
}
|
| 52 |
#endif
|
| 53 |
t_team;
|
| 54 |
|
| 55 |
#endif
|
| 56 |
|
| 57 |
#ifndef JUST_NEED_TYPES
|
| 58 |
#ifndef INCLUDED_TEAM_PROTOS
|
| 59 |
#define INCLUDED_TEAM_PROTOS
|
| 60 |
|
| 61 |
extern int teamlist_load(void);
|
| 62 |
extern int teamlist_unload(void);
|
| 63 |
extern int teams_destroy(t_list *);
|
| 64 |
|
| 65 |
extern t_team* create_team(t_account **accounts,t_clienttag clienttag);
|
| 66 |
extern void dispose_team(t_team * team);
|
| 67 |
|
| 68 |
extern t_team* teamlist_find_team_by_accounts(t_account **accounts,t_clienttag clienttag);
|
| 69 |
extern t_team* teamlist_find_team_by_uids(unsigned int * uids, t_clienttag clienttag);
|
| 70 |
extern t_team* teamlist_find_team_by_teamid(unsigned int teamid);
|
| 71 |
|
| 72 |
extern t_team* _list_find_team_by_accounts(t_account **accounts,t_clienttag clienttag,t_list * list);
|
| 73 |
extern t_team* _list_find_team_by_uids(unsigned int * uids,t_clienttag clienttag, t_list * list);
|
| 74 |
extern t_team* _list_find_team_by_teamid(unsigned int teamid, t_list * list);
|
| 75 |
|
| 76 |
extern unsigned int team_get_teamid(t_team * team);
|
| 77 |
extern t_account * team_get_member(t_team * team,int count);
|
| 78 |
extern unsigned int team_get_memberuid(t_team * team,int count);
|
| 79 |
|
| 80 |
extern t_clienttag team_get_clienttag(t_team * team);
|
| 81 |
extern unsigned char team_get_size(t_team * team);
|
| 82 |
extern int team_get_wins(t_team * team);
|
| 83 |
extern int team_get_losses(t_team * team);
|
| 84 |
extern int team_get_xp(t_team * team);
|
| 85 |
extern int team_get_level(t_team * team);
|
| 86 |
extern int team_get_rank(t_team * team);
|
| 87 |
extern time_t team_get_lastgame(t_team * team);
|
| 88 |
|
| 89 |
extern int team_inc_wins(t_team * team);
|
| 90 |
extern int team_inc_losses(t_team * team);
|
| 91 |
|
| 92 |
extern int team_set_saveladderstats(t_team * team, unsigned int gametype, int result, unsigned int opponlevel,t_clienttag clienttag);
|
| 93 |
|
| 94 |
#endif
|
| 95 |
#endif
|