#include"BugBots.hpp" World* World::m_world = NULL; int World::Points() { return m_points; } World* World::GetWorld() { if(m_world) { return m_world; } else { return NULL; } } World* World::Create() { if(!m_world) { m_world = new World; } return m_world; } World::World() { } Position World::ReqMove(Item* itm, Position loc) { int dist; Position finalDest; if(loc.Distance(itm->m_pos) > (itm->m_speed - itm->m_moved)) { //The Item is trying to move further than it can. } else if(!Game::GetGame()->IsOnScreen(loc)) { //The Item is trying to move off the screen. finalDest = Game::GetGame()->LastOnScreen(itm->m_pos, loc); dist = finalDest.Distance(itm->m_pos); } else { //Everything is ok with the request. dist = loc.Distance(itm->m_pos); finalDest = loc; } itm->m_pos = finalDest; itm->m_moved += dist; //change the list which itm is on in the hash_map. //use the energy that the item needs to move dist. return finalDest; } Position World::ReqMove(Item* itm, Offset loc) { return ReqMove(itm, itm->m_pos + loc); } bool World::ReqEat(Item* itm, Wrapper* target) { return false; } bool World::ReqPickUp(Item* itm, Wrapper* target) { return false; } bool World::ReqPutDown(Item* itm, Wrapper* target, Position loc) { return false; } bool World::ReqPutDown(Item* itm, Wrapper* target, Offset offset) { return ReqPutDown(itm, target, itm->m_pos + offset); } bool World::ReqHurt(Item* itm, Wrapper* target, int amount) { return false; } bool World::ReqExplode(Item* itm) { return false; } bool World::CanMove(Item* itm) { return itm->m_moved >= itm->m_speed; } list::iterator*>* World::ReqLook(Item* itm, Position pos) { if(pos.Distance(itm->m_pos) <= itm->m_sight) { return m_positionMap[pos]; } else { return NULL; } } list::iterator*>* World::ReqLook(Item* itm, Offset ofst) { return ReqLook(itm, itm->m_pos + ofst); } Wrapper* World::ReqCreateItem(Item* itm, ItemBuilder* creator, int maxSize) { return NULL; } Wrapper* World::ReqCreateItem(Team* team, ItemBuilder* creator, Position loc, int MaxSize) { return NULL; } Wrapper* World::ReqCreateItem(Team* team, ItemBuilder* creator, Item* holder, int maxSize) { return NULL; } template bool World::AddTeam() { } void World::InitTeams() { }