00001 00008 /* 00009 This file is part of Teapot Colony Wars. 00010 00011 Teapot Colony Wars is free software: you can redistribute it and/or modify 00012 it under the terms of the GNU General Public License as published by 00013 the Free Software Foundation, either version 2 of the License, or 00014 (at your option) any later version. 00015 00016 Teapot Colony Wars is distributed in the hope that it will be useful, 00017 but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 GNU General Public License for more details. 00020 00021 You should have received a copy of the GNU General Public License 00022 along with Teapot Colony Wars. If not, see <http://www.gnu.org/licenses/>. 00023 */ 00024 00025 #include "Replication.h" 00026 00027 #include "Colony.h" 00028 #include "Worshiper.h" 00029 00030 Replication::Replication() : _colony(NULL), 00031 _new_worshipers(new std::list<Worshiper*>) { 00032 00033 } 00034 00035 Replication::~Replication() { 00036 delete _new_worshipers; 00037 } 00038 00039 void Replication::setColony(Colony * c) { 00040 _colony = c; 00041 } 00042 00043 unsigned int Replication::getNbWorshipers() { 00044 return _colony->getNbWorshipers(); 00045 } 00046 00047 unsigned int Replication::getNbCells() const { 00048 return _colony->getNbCells(); 00049 } 00050 00051 unsigned int Replication::getFood() const { 00052 return _colony->getFood(); 00053 } 00054 00055 Worshiper* Replication::createWorshiper(unsigned int size, 00056 unsigned int food, Behaviour * b) { 00057 return _colony->createWorshiper(size, food, b); 00058 } 00059 00060 void Replication::addSurvivor(Worshiper * w) { 00061 //By default, delete the worshiper 00062 delete w; 00063 }