<commit_before>#include "GameManager.h"

void GameManager::Update(float dt)
{
	GameEntities.clear();
	for (int i = 0; i < GameObjects->size(); i++)
	{
		if (GameObjects->at(i)->ToDelete == true)
		{
			delete GameObjects->at(i);
			GameObjects->erase(GameObjects->begin() + i);
			i--;
		}
		GameObjects->at(i)->Update(dt);
		std::vector<Component*>* objectComponents = &GameObjects->at(i)->components;
		for (int p = 0; p < objectComponents->size(); p++)
		{
			objectComponents->at(p)->Update(dt);
		}
		if (GameObjects->at(i)->entity != nullptr)
		{
			GameEntities.push_back(GameObjects->at(i)->entity);
		}
	}
	if (activeScene)
	{
		activeScene->Update();
	}
}

void GameManager::SetActiveScene(Scene * nextScene)
{
	if (activeScene)
	{
		activeScene->End();
		delete activeScene;
	}

	activeScene = nextScene;
	activeScene->Initialize();
	GameObjects = &activeScene->GameObjects;
	GameEntities.clear();
}

GameManager::~GameManager()
{
	delete activeScene;
}
<commit_msg>Small fix with for loop to avoid crashing.`<commit_after>#include "GameManager.h"

void GameManager::Update(float dt)
{
	GameEntities.clear();
	for (int i = 0; i < GameObjects->size(); i++)
	{
		if (GameObjects->at(i)->ToDelete == true)
		{
			delete GameObjects->at(i);
			GameObjects->erase(GameObjects->begin() + i);
			i--;
			continue;
		}
		GameObjects->at(i)->Update(dt);
		std::vector<Component*>* objectComponents = &GameObjects->at(i)->components;
		for (int p = 0; p < objectComponents->size(); p++)
		{
			objectComponents->at(p)->Update(dt);
		}
		if (GameObjects->at(i)->entity != nullptr)
		{
			GameEntities.push_back(GameObjects->at(i)->entity);
		}
	}
	if (activeScene)
	{
		activeScene->Update();
	}
}

void GameManager::SetActiveScene(Scene * nextScene)
{
	if (activeScene)
	{
		activeScene->End();
		delete activeScene;
	}

	activeScene = nextScene;
	activeScene->Initialize();
	GameObjects = &activeScene->GameObjects;
	GameEntities.clear();
}

GameManager::~GameManager()
{
	delete activeScene;
}

{'fraction_non_alphanumeric': 0.17335243553008595, 'fraction_numerical': 0.0019102196752626551, 'mean_word_length': 3.5543478260869565, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 47, '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': '5291852', 'n_tokens_mistral': 769, 'n_tokens_neox': 722, 'n_words': 122}