2011-07-03 20:37:07 +00:00
|
|
|
/* 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"
|
2011-07-06 18:52:45 +00:00
|
|
|
#include "entity.h"
|
|
|
|
#include <SDL.h>
|
|
|
|
#include <SDL_ttf.h>
|
2011-07-03 20:37:07 +00:00
|
|
|
|
2011-07-06 21:25:12 +00:00
|
|
|
enum VertexType {VERTEX_NONE=0x0, VERTEX_ATTACKER=0x1, VERTEX_DEFENDER=0x2,
|
|
|
|
VERTEX_PRODUCER=0x4};
|
2011-07-03 20:37:07 +00:00
|
|
|
|
2011-07-06 18:52:45 +00:00
|
|
|
class GameVertex : public Vertex, public Entity
|
2011-07-03 20:37:07 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
GameVertex(int x, int y, int z, int r, int colour = 0, int score = 0,
|
|
|
|
VertexType type = VERTEX_NONE, Player* player = NULL);
|
|
|
|
|
2011-07-06 18:52:45 +00:00
|
|
|
bool init();
|
|
|
|
void iterate() {}
|
|
|
|
void render(SDL_Surface* display);
|
|
|
|
|
2011-07-03 20:37:07 +00:00
|
|
|
VertexType type;
|
|
|
|
Player* player;
|
2011-07-04 07:09:36 +00:00
|
|
|
bool attacked; // only applicable for a VERTEX_ATTACKER
|
2011-07-03 20:37:07 +00:00
|
|
|
|
|
|
|
float calculate_attack();
|
|
|
|
float calculate_armor();
|
|
|
|
|
|
|
|
private:
|
|
|
|
float calculate_strength();
|
|
|
|
float calculate_strength_r(Vertex* node, unsigned int depth, list<Vertex*>& visited);
|
|
|
|
|
2011-07-06 18:52:45 +00:00
|
|
|
static TTF_Font* font;
|
|
|
|
static SDL_Surface* attacker_icon;
|
|
|
|
static SDL_Surface* defender_icon;
|
|
|
|
static SDL_Surface* producer_icon;
|
2011-07-03 20:37:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|