#ifndef CLASS_PLAYERCONTAINER #define CLASS_PLAYERCONTAINER #include #include #include "graphic/Image.h" #include "xml/tinyxml/tinyxml.h" #include "xml/XmlLoader.h" #include "Unit.h" #include "Building.h" #include "SceneElement.h" #include "TerrainElement.h" #include "IsoObjectsMap.h" #include "Functions.h" /// Creates a player and its elements class PlayerContainer { private: /// Links to this containers faction elements std::vector _element_storage; /// Object map used IsoObjectsMap * _objectmap_pointer; /// PlayerContainers start ID number, no validation that the id is uniqe is performed int _id; /// Returns the directions towards center from x,y point int DirectionTowardsCenter(Element * sel_unit); /// Delete Element void Delete(std::vector::iterator it); /// Finds the Element id in storage std::vector::iterator LocateElement(int id); public: /// Base constructor PlayerContainer (IsoObjectsMap * om, int id) { _objectmap_pointer = om;_id = id;}; virtual ~PlayerContainer (); /// Loads elements from xml file bool CreateElements(const char *xmlpath); /// Delete Element at row,col void DeleteElement(int row, int col); /// Delete Element with ID void DeleteElement(int id); /// Delete selected element void DeleteElement(Element * element); /// Return element in row,col Element * GetElement(int row, int col); /// Return element with id Element * GetElement(int id); /// Return element in row,col and remove from own list Element * GiveElement(int row, int col); /// Return element with id and remove from own list Element * GiveElement(int id); /// Adds a already existing Element to the container void AddExistingElement(Element * element); /// Places units in a line from point void PlaceUnitGroup(int row, int col); /// Computes visibility for all objects in this player container void ComputeVisibility(); }; #endif