| 1 | /* |
| 2 | * (C) 2004 Olaf Freyer ([email protected]) |
| 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 <ctime> |
| 23 | |
| 24 | #ifndef JUST_NEED_TYPES |
| 25 | # define JUST_NEED_TYPES |
| 26 | # include "common/list.h" |
| 27 | # include "common/tag.h" |
| 28 | # include "account.h" |
| 29 | # undef JUST_NEED_TYPES |
| 30 | #else |
| 31 | # include "common/list.h" |
| 32 | # include "common/tag.h" |
| 33 | # include "account.h" |
| 34 | #endif |
| 35 | |
| 36 | #define MAX_TEAMSIZE 4 |
| 37 | |
| 38 | namespace pvpgn |
| 39 | { |
| 40 | |
| 41 | namespace bnetd |
| 42 | { |
| 43 | |
| 44 | typedef struct team |
| 45 | #ifdef TEAM_INTERNAL_ACCESS |
| 46 | { |
| 47 | unsigned char size; |
| 48 | int wins; |
| 49 | int losses; |
| 50 | int xp; |
| 51 | int level; |
| 52 | int rank; |
| 53 | unsigned int teamid; |
| 54 | unsigned int teammembers[MAX_TEAMSIZE]; |
| 55 | t_account * members[MAX_TEAMSIZE]; |
| 56 | t_clienttag clienttag; |
| 57 | std::time_t lastgame; |
| 58 | } |
| 59 | #endif |
| 60 | t_team; |
| 61 | |
| 62 | } |
| 63 | |
| 64 | } |
| 65 | |
| 66 | #endif |
| 67 | |
| 68 | #ifndef JUST_NEED_TYPES |
| 69 | #ifndef INCLUDED_TEAM_PROTOS |
| 70 | #define INCLUDED_TEAM_PROTOS |
| 71 | |
| 72 | namespace pvpgn |
| 73 | { |
| 74 | |
| 75 | namespace bnetd |
| 76 | { |
| 77 | |
| 78 | extern int teamlist_load(void); |
| 79 | extern int teamlist_unload(void); |
| 80 | extern int teams_destroy(t_list *); |
| 81 | |
| 82 | extern t_team* create_team(t_account **accounts, t_clienttag clienttag); |
| 83 | extern void dispose_team(t_team * team); |
| 84 | |
| 85 | extern t_team* teamlist_find_team_by_accounts(t_account **accounts, t_clienttag clienttag); |
| 86 | extern t_team* teamlist_find_team_by_uids(unsigned int * uids, t_clienttag clienttag); |
| 87 | extern t_team* teamlist_find_team_by_teamid(unsigned int teamid); |
| 88 | |
| 89 | extern t_team* _list_find_team_by_accounts(t_account **accounts, t_clienttag clienttag, t_list * list); |
| 90 | extern t_team* _list_find_team_by_uids(unsigned int * uids, t_clienttag clienttag, t_list * list); |
| 91 | extern t_team* _list_find_team_by_teamid(unsigned int teamid, t_list * list); |
| 92 | |
| 93 | extern unsigned int team_get_teamid(t_team * team); |
| 94 | extern t_account * team_get_member(t_team * team, int count); |
| 95 | extern unsigned int team_get_memberuid(t_team * team, int count); |
| 96 | |
| 97 | extern t_clienttag team_get_clienttag(t_team * team); |
| 98 | extern unsigned char team_get_size(t_team * team); |
| 99 | extern int team_get_wins(t_team * team); |
| 100 | extern int team_get_losses(t_team * team); |
| 101 | extern int team_get_xp(t_team * team); |
| 102 | extern int team_get_level(t_team * team); |
| 103 | extern int team_set_rank(t_team * team, unsigned int rank); |
| 104 | extern int team_get_rank(t_team * team); |
| 105 | extern std::time_t team_get_lastgame(t_team * team); |
| 106 | |
| 107 | extern int team_inc_wins(t_team * team); |
| 108 | extern int team_inc_losses(t_team * team); |
| 109 | |
| 110 | extern int team_set_saveladderstats(t_team * team, unsigned int gametype, int result, unsigned int opponlevel, t_clienttag clienttag); |
| 111 | |
| 112 | } |
| 113 | |
| 114 | } |
| 115 | |
| 116 | #endif |
| 117 | #endif |