<commit_before>/*
 * Game.cpp
 *
 *  Created on: 29 May 2014
 *      Author: Marco
 */

#include "Game.hpp"
 

GameDelta GameDelta::mergeDelta(const GameDelta &newDelta) const {
	GameDelta delta(*this);
	for (std::map<Entity, Position>::const_iterator it = newDelta.deltaPositions.begin();
			it != newDelta.deltaPositions.end();
			it++)
	{
		// add position updates
		delta.deltaPositions[it->first] += (it->second);
	}

	for (std::map<Entity, Orientation>::const_iterator it = newDelta.deltaOrientations.begin();
			it != newDelta.deltaOrientations.end();
            it++)
    {
		delta.deltaOrientations[it->first] += (it->second);
    }
	return delta;
}

GameDelta::GameDelta(const GameDelta &src)
{
	deltaPositions = src.deltaPositions;
	deltaOrientations = src.deltaOrientations;
	deltaBoundingBoxes = src.deltaBoundingBoxes;
	deltaRenderObjects = src.deltaRenderObjects;
}

GameDelta::GameDelta(Entity entity, Position pos) :
		deltaPositions(),
		deltaOrientations(),
		deltaBoundingBoxes(),
		deltaRenderObjects()
{
	deltaPositions[entity] = pos;
}

GameDelta::GameDelta(Entity entity, Orientation orientation) :
		deltaPositions(),
		deltaOrientations(),
		deltaBoundingBoxes(),
		deltaRenderObjects()
{
	deltaOrientations[entity] = orientation;
}

GameDelta::GameDelta(Entity entity, BoundingBox bb) :
		deltaPositions(),
		deltaOrientations(),
		deltaBoundingBoxes(),
		deltaRenderObjects()
{
	deltaBoundingBoxes[entity] = bb;
}


GameDelta Game::loadMap(const Worldmap& world) const
{
	GameDelta delta;
	for (int y = 0; y < 42; y++) {
		for (int x = 0; x < 42; x++) {
            Block *block = world.getBlock(x, y);
            Entity new_entity = Entity::newEntity();
            delta = delta.mergeDelta(GameDelta(new_entity, Position(-1, x, y)));
            delta = delta.mergeDelta(GameDelta(new_entity, Orientation(0)));

            std::vector<std::string> textures;

            int count = block->getTextures(textures);

            for (int i = 0; i < count; i++) {
                // create RenderObjects
		}
	}

	return delta;
}

void Game::setup()
{
	m_players.push_back(Entity::newEntity());
	m_player_map.push_back(Worldmap(time(NULL), 60, 60, 5));

	m_players.push_back(Entity::newEntity());
	m_player_map.push_back(Worldmap(time(NULL), 60, 60, 5));

	m_players.push_back(Entity::newEntity());
	m_player_map.push_back(Worldmap(time(NULL), 60, 60, 5));

	m_players.push_back(Entity::newEntity());
	m_player_map.push_back(Worldmap(time(NULL), 60, 60, 5));
}
<commit_msg>fixed compile error after merge<commit_after>/*
 * Game.cpp
 *
 *  Created on: 29 May 2014
 *      Author: Marco
 */

#include "Game.hpp"
 

GameDelta GameDelta::mergeDelta(const GameDelta &newDelta) const {
	GameDelta delta(*this);
	for (std::map<Entity, Position>::const_iterator it = newDelta.deltaPositions.begin();
			it != newDelta.deltaPositions.end();
			it++)
	{
		// add position updates
		delta.deltaPositions[it->first] += (it->second);
	}

	for (std::map<Entity, Orientation>::const_iterator it = newDelta.deltaOrientations.begin();
			it != newDelta.deltaOrientations.end();
            it++)
    {
		delta.deltaOrientations[it->first] += (it->second);
    }
	return delta;
}

GameDelta::GameDelta(const GameDelta &src)
{
	deltaPositions = src.deltaPositions;
	deltaOrientations = src.deltaOrientations;
	deltaBoundingBoxes = src.deltaBoundingBoxes;
	deltaRenderObjects = src.deltaRenderObjects;
}

GameDelta::GameDelta(Entity entity, Position pos) :
		deltaPositions(),
		deltaOrientations(),
		deltaBoundingBoxes(),
		deltaRenderObjects()
{
	deltaPositions[entity] = pos;
}

GameDelta::GameDelta(Entity entity, Orientation orientation) :
		deltaPositions(),
		deltaOrientations(),
		deltaBoundingBoxes(),
		deltaRenderObjects()
{
	deltaOrientations[entity] = orientation;
}

GameDelta::GameDelta(Entity entity, BoundingBox bb) :
		deltaPositions(),
		deltaOrientations(),
		deltaBoundingBoxes(),
		deltaRenderObjects()
{
	deltaBoundingBoxes[entity] = bb;
}


GameDelta Game::loadMap(const Worldmap& world) const
{
	GameDelta delta;
	for (int y = 0; y < 42; y++) {
		for (int x = 0; x < 42; x++) {
            Block *block = world.getBlock(x, y);
            Entity new_entity = Entity::newEntity();
            delta = delta.mergeDelta(GameDelta(new_entity, Position(-1, x, y)));
            delta = delta.mergeDelta(GameDelta(new_entity, Orientation(0)));

            std::vector<std::string> textures;

            int count = block->getTextures(textures);

            for (int i = 0; i < count; i++) {
                // create RenderObjects
		}
		}
	}

	return delta;
}

void Game::setup()
{
	m_players.push_back(Entity::newEntity());
	m_player_map.push_back(Worldmap(time(NULL), 60, 60, 5));

	m_players.push_back(Entity::newEntity());
	m_player_map.push_back(Worldmap(time(NULL), 60, 60, 5));

	m_players.push_back(Entity::newEntity());
	m_player_map.push_back(Worldmap(time(NULL), 60, 60, 5));

	m_players.push_back(Entity::newEntity());
	m_player_map.push_back(Worldmap(time(NULL), 60, 60, 5));
}

{'fraction_non_alphanumeric': 0.14629777070063693, 'fraction_numerical': 0.01393312101910828, 'mean_word_length': 4.2783613445378155, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1262222', 'n_tokens_mistral': 1807, 'n_tokens_neox': 1675, 'n_words': 320}