/* 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"
#include "entity.h"
#include <SDL.h>
#include <SDL_ttf.h>

enum VertexType {VERTEX_NONE=0x0, VERTEX_ATTACKER=0x1, VERTEX_DEFENDER=0x2,
		 VERTEX_PRODUCER=0x4};

class GameVertex : public Vertex, public Entity
{
  public:
    GameVertex(int x, int y, int z, int r, int colour = 0, int score = 0,
	       VertexType type = VERTEX_NONE, Player* player = NULL);

    bool init();
    void iterate() {}
    void render(SDL_Surface* display);

    VertexType type;
    Player* player;
    bool attacked; // only applicable for a VERTEX_ATTACKER

    float calculate_attack();
    float calculate_armor();

 private:
    float calculate_strength();
    float calculate_strength_r(Vertex* node, unsigned int depth, list<Vertex*>& visited);

    static TTF_Font* font;
    static SDL_Surface* attacker_icon;
    static SDL_Surface* defender_icon;
    static SDL_Surface* producer_icon;
};

#endif