57 lines
1.8 KiB
C++
57 lines
1.8 KiB
C++
/* *******************************************************************
|
|
* 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);
|
|
}
|