<commit_before>#include <iostream>
#include <fstream>
#include <string>
#include "levelLoader.h"
#include "Brick.h"

using namespace std;

LevelLoader::LevelLoader(GameManager* gm)
{
	gameManager = gm;
}

#define BLOCK_WIDTH 90

void LevelLoader::openMap(const std::string& mapName, int& maxBlocks)
{
    Log::info("Loading " + mapName);
    string line;
	ifstream myFile(mapName);

    if (!myFile.is_open())
    {
        Log::error("Couldn't open " + mapName);
        maxBlocks = 0;
    }

    int blockCount = 0;

	int ypos = 30;
	while (getline(myFile, line))
	{
		int xpos = 25;
		while (line.size() > 0)
		{
			char hp = line.at(0);
			int health = hp - '0';

			if (health > 0)
			{
				if (health == 3)
					gameManager->addEntity(new Brick(gameManager->getWindow(), "redBrick.bmp", xpos, ypos, health));
				if (health == 2)
					gameManager->addEntity(new Brick(gameManager->getWindow(), "yellowBrick.bmp", xpos, ypos, health));<commit_msg>More cleanup and comments.<commit_after>#include <iostream>
#include <fstream>
#include <string>
#include "levelLoader.h"
#include "Brick.h"

using namespace std;

LevelLoader::LevelLoader(GameManager* gm)
{
	gameManager = gm;
}

#define BLOCK_WIDTH 90

// function for openeing and reading the file containing the map
void LevelLoader::openMap(const std::string& mapName, int& maxBlocks)
{
    Log::info("Loading " + mapName);
    string line;
	ifstream myFile(mapName);

		// check to see if the file is able to be opened
    if (!myFile.is_open())
    {
        Log::error("Couldn't open " + mapName);
        maxBlocks = 0;
    }

    int blockCount = 0;

	int ypos = 30;
	while (getline(myFile, line))
	{
		int xpos = 25;
		while (line.size() > 0)
		{
			char hp = line.at(0);
			int health = hp - '0';

			if (health > 0)
			{
				if (health == 3)
					gameManager->addEntity(new Brick(gameManager->getWindow(), "redBrick.bmp", xpos, ypos, health));
				if (health == 2)
					gameManager->addEntity(new Brick(gameManager->getWindow(), "yellowBrick.bmp", xpos, ypos, health));
{'fraction_non_alphanumeric': 0.14904082636497787, 'fraction_numerical': 0.013772749631087064, 'mean_word_length': 3.5605381165919283, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 21, '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': '4359764', 'n_tokens_mistral': 812, 'n_tokens_neox': 722, 'n_words': 187}