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