blob: e8c6e86de9ccd164f8935b7a32d45ed4650dc8e2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/* *******************************************************************
* Includes
* ******************************************************************/
#include "Player.h"
#include <string.h>
/* *******************************************************************
* Defines
* ******************************************************************/
/* *******************************************************************
* Types definition
* ******************************************************************/
/* *******************************************************************
* Global variables definition
* ******************************************************************/
/* *******************************************************************
* Local variables definition
* ******************************************************************/
/* *******************************************************************
* Local prototypes declaration
* ******************************************************************/
/* *******************************************************************
* Functions definition
* ******************************************************************/
/*****************************************************************//**
*
* \brief Constructor for Player class.
*
*********************************************************************/
Player::Player(const char* const strPlayerName):
_name{'\0'}
{
enum
{
DEFAULT_RESOURCES = 300
};
if (strPlayerName != NULL)
{
strncpy(_name, strPlayerName, MAX_NAME_LENGTH);
}
else
{
/* Undefined player name. */
}
/* Set all resources to default value. */
memset(_resourcesMap, DEFAULT_RESOURCES, sizeof(uint8_t) * MAX_RESOURCE_TYPES);
}
|