From 14c12aeea30d59e9c811f1cc8c7019053d646033 Mon Sep 17 00:00:00 2001 From: XaviDCR92 Date: Tue, 10 Jul 2018 00:04:16 +0200 Subject: More work on Unit/BaseUnit concepts. --- Player.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'Player.cpp') diff --git a/Player.cpp b/Player.cpp index b90e9fa..e8c6e86 100644 --- a/Player.cpp +++ b/Player.cpp @@ -34,8 +34,14 @@ * \brief Constructor for Player class. * *********************************************************************/ -Player::Player(const char* const strPlayerName) +Player::Player(const char* const strPlayerName): +_name{'\0'} { + enum + { + DEFAULT_RESOURCES = 300 + }; + if (strPlayerName != NULL) { strncpy(_name, strPlayerName, MAX_NAME_LENGTH); @@ -44,4 +50,7 @@ Player::Player(const char* const strPlayerName) { /* Undefined player name. */ } + + /* Set all resources to default value. */ + memset(_resourcesMap, DEFAULT_RESOURCES, sizeof(uint8_t) * MAX_RESOURCE_TYPES); } -- cgit v1.2.3