#include #include #include #include "shape.h" #include "../pods/pod.h" // static variables: int Shape::id_counter = 0; // unique pod ID counter vector Shape::shape_index; // a vector of pointers to shapes. now we can look them up by ID number // *STRUCTORS //=========================================================== Shape::Shape(int axis) { // let's fill up some dummy info for testing id = ++id_counter; name = "FART"; stype = SHAPE_CUBE; ftype = FORCE_ELEC; mat = MAT_CHROME; maxhp = 200; att = 50; def = 50; spd = 50; opac = 50; acu = 50; size = 50; intel = 50; bravery = 50; constancy = 50; // set pod pointer ? // add the shape index AddShape(this); } Shape::~Shape() { // remove from shape vector int max = shape_index.size(); for (int i = 0; i < max; i++) { if (shape_index[i]->id == this->id) { shape_index.erase( shape_index.begin()+i ); } } } //=========================================================== // GET //=========================================================== int Shape::GetID() { return id; } string Shape::GetName() { return name; } shape_type Shape::GetShapeType() { return stype; } int Shape::GetMaxHP() { return maxhp; } int Shape::GetAtt() { return att; } int Shape::GetDef() { return def; } int Shape::GetSpd() { return spd; } int Shape::GetOpac() { return opac; } int Shape::GetAcu() { return acu; } int Shape::GetSize() { return size; } int Shape::GetIntel() { return intel; } int Shape::GetBrave() { return bravery; } int Shape::GetConst() { return constancy; } force_type Shape::GetForceType() { return ftype; } material Shape::GetMat() { return mat; } //=========================================================== // SET //=========================================================== //void Shape::SetAxis() {;;} //void Shape::SetPod() {;;} // Shape::SetFormation(); //=========================================================== // GENERAL SHAPE GOODIES //=========================================================== // adds a shape to the shape index void Shape::AddShape(Shape* s){ shape_index.push_back(s); } // get a pod pointer based on it's ID number Shape* Shape::GetShape(int id){ int max = shape_index.size(); for (int i = 0; i < max; i++) { if (shape_index[i]->id == id) { return shape_index[i]; } } return NULL; } int Shape::GetNumShapes() { return shape_index.size(); } //===========================================================