/*
* This file is part of IWOR (see <iwor.sourceforge.net>).
* Copyright (c) 2008-2009, 2013 Aidin Gharibnavaz <aidin.vf@gmail.com>
*
* IWOR is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* IWOR is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with IWOR. If not, see <http://www.gnu.org/licenses/>.
*/
/*
A class to hold information of a robot.
NOTE:
A class with constructor can not be used in a union.
So constructor is removed and 'init' can be
used to set the variables for the first time.
*/
#ifndef _STRING_INCLUDED
#include <string>
#define _STRING_INCLUDED
#endif
class Robot
{
public:
void init(int pID,int ptribe,int pbattery,
int pshield, char* pname, int plifetime);
//Set state of the robot for the first time.
int getID();
//Return ID of the robot.
int getTribe();
//Return tribe of the robot.
std::string getName();
//Return name of the robot
int getBattery();
//Return battery of the robot.
int getHonor();
//Return honor of robot.
int getShield();
//Return shield of the robot.
int isHeld();
//Return 1 if robot held something, 0 if not.
int isAlive();
//Return 1 if robot still alive, 0 if not.
void pickUp();
//Robot is just picked up something.
void drop();
//Robot is just dropped something.
void setBattery(int amount);
//set battery of the robot.
int consumeBattery(int amount);
//Return the left Battery including 0.
//If the amount is larger than the robot's battery,
//will return BATTERY_ERROR;
void addHonor(int amount);
//Add `amount' of honor to this robot.
void reduceHonor(int amount);
//Reduce honor of the robot.
void takeDamage(int amount);
//Robot has been damaged, shield will reduce.
int getLifetime();
//Return the age of the robot.
void reduceLifetime(int amount);
//Increase the age of the robot.
private:
int ID;
//ID of this robot (equal to file descriptor of the
//client who control this robot).
int tribe;
//ID of the tribe which robot belongs to.
int battery;
//Current state of robot's battery.
int shield;
//Health of the robot.
int honor;
//The amount of honor this robot gained.
char *name;
//Name of the robot.
int hold;
//If robot holds something, this will set to 1.
int alive;
//Is robot still alive?
int lifeTime;
//Age of the robot.
};