10017
|
1 |
/*
|
|
2 |
* Hedgewars, a free turn based strategy game
|
|
3 |
* Copyright (C) 2012 Simeon Maxein <smaxein@googlemail.com>
|
|
4 |
*
|
|
5 |
* This program is free software; you can redistribute it and/or
|
|
6 |
* modify it under the terms of the GNU General Public License
|
|
7 |
* as published by the Free Software Foundation; either version 2
|
|
8 |
* of the License, or (at your option) any later version.
|
|
9 |
*
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
18 |
*/
|
|
19 |
|
|
20 |
#ifndef TEAMLIST_H_
|
|
21 |
#define TEAMLIST_H_
|
|
22 |
|
|
23 |
#include "team.h"
|
|
24 |
|
|
25 |
typedef struct {
|
|
26 |
int teamCount;
|
|
27 |
flib_team **teams;
|
|
28 |
} flib_teamlist;
|
|
29 |
|
|
30 |
flib_teamlist *flib_teamlist_create();
|
|
31 |
|
|
32 |
void flib_teamlist_destroy(flib_teamlist *list);
|
|
33 |
|
|
34 |
/**
|
|
35 |
* Insert a team into the list. The list takes ownership of the team. Returns 0 on success.
|
|
36 |
*/
|
|
37 |
int flib_teamlist_insert(flib_teamlist *list, flib_team *team, int pos);
|
|
38 |
|
|
39 |
/**
|
|
40 |
* Delete the team with the name [name] from the list and destroys it.
|
|
41 |
* Returns 0 on success.
|
|
42 |
*/
|
|
43 |
int flib_teamlist_delete(flib_teamlist *list, const char *name);
|
|
44 |
|
|
45 |
/**
|
|
46 |
* Returns the team with the name [name] from the list if it exists, NULL otherwise
|
|
47 |
*/
|
|
48 |
flib_team *flib_teamlist_find(const flib_teamlist *list, const char *name);
|
|
49 |
|
|
50 |
/**
|
|
51 |
* Removes all items from the list and destroys them.
|
|
52 |
*/
|
|
53 |
void flib_teamlist_clear(flib_teamlist *list);
|
|
54 |
|
|
55 |
/**
|
|
56 |
* Create a copy of the list and all the teams it contains. Weaponsets are not copied, but
|
|
57 |
* kept as references
|
|
58 |
*/
|
|
59 |
flib_teamlist *flib_teamlist_copy(flib_teamlist *list);
|
|
60 |
|
|
61 |
#endif
|