<commit_before>#include "asteroid.hpp"

#include <typeinfo>

#include <dispatch/dispatch.h>

#include "renderer/scene/scenemanager.hpp"

#include "rocket.hpp"

extern scene::SceneManager* sceneManagerPtr;
extern unsigned int score;

Asteroid::Asteroid(glm::vec3 initialLocation, unsigned int mass) : scene::GravitationalObject(initialLocation, mass, "sphere", render::ColourInformationUniform{glm::vec3{142.0f, 100.0f, 0.0f}, 1.0f}), removeOnceToken{0} {
	scale = glm::vec3{mass * 0.5f, mass * 0.5f, mass * 0.5f};
}

void Asteroid::handleCollision(scene::SceneItem& collidee) {
	if (typeid(collidee) == typeid(Rocket)) {
		static_cast<Rocket&>(collidee).explode();

		dispatch_once(&removeOnceToken, ^{
			dispatch_async(dispatch_get_current_queue(), ^{
				score += 1000;
				sceneManagerPtr->removeItem(getShared());
			});
		});

		return;
	}

	if (typeid(collidee) != typeid(*this)) {
		return;<commit_msg>Asteroid: Apply VClip to Asteroid-Rocket collisions<commit_after>#include "asteroid.hpp"

#include <typeinfo>

#include <dispatch/dispatch.h>

#include "renderer/scene/scenemanager.hpp"

#define VCLIP_TEMPLATES
#include "collisiondetection/vclip.hpp"

#include "rocket.hpp"

extern scene::SceneManager* sceneManagerPtr;
extern unsigned int score;

Asteroid::Asteroid(glm::vec3 initialLocation, unsigned int mass) : scene::GravitationalObject(initialLocation, mass, "sphere", render::ColourInformationUniform{glm::vec3{142.0f, 100.0f, 0.0f}, 1.0f}), removeOnceToken{0} {
	scale = glm::vec3{mass * 0.5f, mass * 0.5f, mass * 0.5f};
}

void Asteroid::handleCollision(scene::SceneItem& collidee) {
	if (typeid(collidee) == typeid(Rocket)) {
		collisiondetection::VClip vclip(this, &collidee);
		if(vclip.run()) {
			static_cast<Rocket&>(collidee).explode();

			dispatch_once(&removeOnceToken, ^{
				dispatch_async(dispatch_get_current_queue(), ^{
					score += 1000;
					sceneManagerPtr->removeItem(getShared());
				});
			});
		}

		return;
	}

	if (typeid(collidee) != typeid(*this)) {
		return;
{'fraction_non_alphanumeric': 0.1575274177467597, 'fraction_numerical': 0.0259222333000997, 'mean_word_length': 6.066901408450704, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '2080587', 'n_tokens_mistral': 806, 'n_tokens_neox': 719, 'n_words': 120}