1 /* bzflag
2  * Copyright (c) 1993-2021 Tim Riker
3  *
4  * This package is free software;  you can redistribute it and/or
5  * modify it under the terms of the license found in the file
6  * named COPYING that should have accompanied this file.
7  *
8  * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
9  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
10  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
11  */
12 
13 /*
14  * Team:
15  *   Encapsulates information about a team
16  */
17 
18 #ifndef BZF_TEAM_H
19 #define BZF_TEAM_H
20 
21 #include "common.h"
22 #include "global.h"
23 #include <string>
24 
25 const int       TeamPLen = 10;
26 
27 struct Team
28 {
29 public:
30     Team();
31 
32     void*       pack(void*) const;
33     const void*     unpack(const void*);
34 
35     static const std::string    getImagePrefix(TeamColor); // const
36     static const char*      getName(TeamColor); // const
37     static TeamColor        getTeam(const std::string &name); // const
38     static const float*     getTankColor(TeamColor); // const
39     static const float*     getRadarColor(TeamColor team); // const
40     static const float*     getShotColor(TeamColor team); // const
41     static const std::string    getAnsiCode(TeamColor team); // const
42     static bool         isColorTeam(TeamColor); // const
43 
44     static void     setColors(TeamColor,
45                               const float* tank,
46                               const float* radar);
47     static void     updateShotColors();
48 
49 public:
50     unsigned short  size;           // num players on team
51 
getWinsTeam52     short       getWins() const
53     {
54         return won;
55     }
getLossesTeam56     short       getLosses() const
57     {
58         return lost;
59     }
setWinsTeam60     void        setWins(short v)
61     {
62         won = v;
63     }
setLossesTeam64     void        setLosses(short v)
65     {
66         lost = v;
67     }
68 
69     static float    tankColor[NumTeams][3];
70     static float    radarColor[NumTeams][3];
71     static float    shotColor[NumTeams][3];
72 
73 private:
74     unsigned short  won;            // wins by team members
75     unsigned short  lost;           // losses by team members
76 
77     static float    addBrightness(const float color); // const
78 
79 };
80 
81 
82 #endif // BZF_TEAM_H
83 
84 // Local Variables: ***
85 // mode: C++ ***
86 // tab-width: 4 ***
87 // c-basic-offset: 4 ***
88 // indent-tabs-mode: nil ***
89 // End: ***
90 // ex: shiftwidth=4 tabstop=4
91