#include "Field.h" Field::Field(uint width, uint height): m_width(width), m_height(height) { m_fieldCells.resize(width*height); } Coordinates Field::getMaxCoordinates() { return Coordinates(m_width, m_height); } Field::~Field(void) { } bool Field::drawAllPlayers(uint numCycles) { return(true); } Cell& Field::getCell(Coordinates c) { if (c.x<0 || c.x >= m_width || c.y <0 || c.y >= m_height) throw std::out_of_range ("getCell"); return(m_fieldCells[c.x+m_width*c.y]); } void Field::init(uint width, uint height) { // m_fieldCells.assign(width*height, EMPTY_CELL); m_width = width; m_height = height; m_fieldCells.clear(); m_fieldCells.resize(width*height); } void Field::setCell(Coordinates coord, Cell cell) { m_fieldCells[coord.x+m_width*coord.y] = cell; }