treewars/gamevertex.h

37 lines
921 B
C
Raw Normal View History

/* This extends a normal vertex to do a bunch of game-specific stuff,
* including handling attack and defense strengths. It is used by the
* GameData class.
*
* Following the lead of the Vertex class (which is more of a glorified struct)
* this will have public data members. Don't judge me.
*/
#ifndef _GAMEVERTEX_H_
#define _GAMEVERTEX_H_
#include "vertex.h"
#include "player.h"
enum VertexType {VERTEX_NONE=0x1, VERTEX_ATTACKER=0x2, VERTEX_DEFENDER=0x4,
VERTEX_PRODUCER=0x8};
class GameVertex : public Vertex
{
public:
GameVertex(int x, int y, int z, int r, int colour = 0, int score = 0,
VertexType type = VERTEX_NONE, Player* player = NULL);
VertexType type;
Player* player;
float calculate_attack();
float calculate_armor();
private:
float calculate_strength();
float calculate_strength_r(Vertex* node, unsigned int depth, list<Vertex*>& visited);
};
#endif