treewars/player.cpp

31 lines
416 B
C++

#include "player.h"
Player::Player(string name, unsigned int colour)
{
this->name = name;
this->colour = colour;
energy = 0;
played = false;
}
void Player::add_energy(unsigned int amount)
{
energy += amount;
}
bool Player::spend_energy(unsigned int amount)
{
if (amount > energy) return false;
energy -= amount;
return true;
}
void Player::set_played()
{
played = true;
}