Skip to content
This repository has been archived by the owner on Feb 19, 2018. It is now read-only.

Tower Set

Andrés edited this page Mar 17, 2015 · 6 revisions

This Documentation is from a code still under heavy development, you may find errors,sudden changes or the answer to life,universe and everything

###Overview Stores a set of [tower attributes](Tower Attributes) that may be used to instantiate towers

Name Version Header Implementation
Tower Set 0.7.5 tower_set.h tower_set.cpp

Before reading this, make sure you have read the pages about [Tower Attack Attributes](Tower Attack Attributes),[Tower Attack](Tower Attack),[Tower Attributes](Tower Attributes) and Towers

###Variables Private

  • string name name of the set

  • map<string,tower_attributes> towers map that stores all attributes, with the tower_name as key value

  • `const ALLEGRO_TIMER *timer; timer to be used when spawning towers

###Constructor

  • tower_set() default constructor

  • tower_set(const string &name,const ALLEGRO_TIMER *timer) empty set constructor

  • tower_set(const string &name,const vector<tower_attributes> &tower_list,const ALLEGRO_TIMER *timer) constructor from vector of attributes (full constructor)

  • tower_set(const string &name,const tower_attributes &tower_attr,const ALLEGRO_TIMER *timer) constructor for one element

###Destructor

  • ~tower_set() fully destroy all attributes (animations and bitmaps) except timers

###Methods Public

  • void set_name(const string &name) set name of the tower_set

  • void add_tower(const tower_attributes &info) adds new tower attributes

  • void set_timer(const ALLEGRO_TIMER *timer) sets new timer (spawned towers will remain with old timer)

  • void remove_tower(const string &name) removes tower with given name

  • void clear() clear all the set info without destroying it (useful to avoid destroying animations or bitmaps with destructor)

  • string get_name() const returns set name

  • unsigned int size() const returns set size

  • bool empty() const returns true if map is empty

  • bool is_tower(const string &name) const return true if tower with given name exists in set

  • set<string> get_tower_names() const return a set with all the towers names

  • unsigned int get_tower_cost(const string &name) const returns the cost of the tower with given name

  • tower spawn_tower(const string &name,double posx,double posy) returns a new spawned tower

  • bool check() const checks if class is working properly, returns false if not

DCmC Wiki 0.7.6

Clone this wiki locally