<commit_before>//
//  GameGrid.h
//  Created by <NAME> on 02/04/14.
//

#ifndef GAMEGRID_H
#define GAMEGRID_H

#include "ExampleGame/Components/Grid/GridCell.h"
#include "ExampleGame/Components/Grid/GridConstants.h"
#include "ExampleGame/Components/Grid/GridRoom.h"
#include "ExampleGame/Components/Grid/GridZone.h"
#include "Libraries/glm/glm.hpp"
#include "Vajra/Common/Objects/Declarations.h"

#include <list>
#include <vector>

class GameGrid {
public:
	GameGrid(unsigned int spanX, unsigned int spanZ);
	~GameGrid();

	int GetElevationFromWorldY(float worldY);
	float ConvertElevationToWorldY(unsigned int elevation);

	inline unsigned int GetGridWidth()   { return this->gridWidth;  }
	inline unsigned int GetGridHeight()  { return this->gridHeight; }

	GridCell* GetCell(int gridX, int gridZ);     // Returns the cell at the specified coordinates
	GridCell* GetCell(glm::vec3 worldPosition);  // Returns the cell at the specified world position

	// Returns number of cell "hops" to get from start to goal
	int GetCellDistanceBetweenCells(int startCellX, int startCellZ, int goalCellX, int goalCellZ);
	int GetCellDistanceBetweenCells(GridCell* startCell, GridCell* goalCell);

	// Returns distance along the ground plane from start to goal
	float GetGroundDistanceBetweenCells(int startCellX, int startCellZ, int goalCellX, int goalCellZ);
	float GetGroundDistanceBetweenCells(GridCell* startCell, GridCell* goalCell);

	// Returns 3-D distance from start to goal
	float GetTrueDistanceBetweenCells(int startCellX, int startCellZ, int goalCellX, int goalCellZ);
	float GetTrueDistanceBetweenCells(GridCell* startCell, GridCell* goalCell);

	// Populates the list with all adjacent cells and returns the number of adjacent cells
	void GetNeighborCells(std::list<GridCell*>& outNbrs, GridCell* cell, int range = 1);

	void AddGridRoom(int west, int south, int width, int height);

	GridRoom* GetRoom(int gridX, int gridZ);     // Returns the room at the specified coordinates
	GridRoom* GetRoom(glm::vec3 worldPosition);  // Returns the room at the specified world position
	GridRoom* GetRoom(GridCell* cell);           // Returns the room at the specified grid cell

	// returns the world position of the center of a room
	glm::vec3 GetRoomCenter(int x, int z);
	glm::vec3 GetRoomCenter(GridCell* cell);

	void AddGridZone(ObjectIdType zoneId);

	GridZone* GetZone(int gridX, int gridZ);     // Returns the first zone the cell at the specified coordinates resides in
	GridZone* GetZone(glm::vec3 worldPosition);  // Returns the first zone the cell at the specified world position resides in
	GridZone* GetZone(GridCell* cell);           // Returns the first zone the specified cell resides in

	void TouchedCells(GridCell* startCell, GridCell* goalCell, std::list<GridCell*>& outTouched);

	bool Passable(GridCell* startCell, GridCell* goalCell);

	bool HasLineOfSight(GridCell* sourceCell, GridCell* targetCell);
	bool HasLineOfSight(int sourceCellX, int sourceCellZ, int targetCellX, int targetCellZ);

	int GetCellGroundLevel(int gridX, int gridZ);
	bool IsCellPassableAtElevation(int gridX, int gridZ, unsigned int elevation);
	bool IsCellVisibleAtElevation(int gridX, int gridZ, unsigned int elevation);

	void SetCellGroundLevel(int gridX, int gridZ, unsigned int elevation);
	void SetCellPassableAtElevation(int gridX, int gridZ, unsigned int elevation, bool isPassable);
	void SetCellVisibleAtElevation(int gridX, int gridZ, unsigned int elevation, bool isVisible);

private:
	void init(unsigned int spanX, unsigned int spanZ);
	void destroy();

	bool isWithinGrid(int cellX, int cellZ);     // Returns true if the specified cell falls within the grid boundaries
	bool isWithinGrid(glm::vec3 worldPosition);  // Returns true if the vector position falls within a defined cell

	unsigned int gridWidth;
	unsigned int gridHeight;

	GridCell*** gridCells;
	unsigned char*** passableBits;
	unsigned char*** visibleBits;

	std::vector<GridRoom*> gridRooms;
	std::list<ObjectIdType> gridZones;

#ifdef DEBUG
public:
	void debugDrawGrid();

private:
	//Color gridColor; // Default debug grid color
	//Color gridColor4; // Color used for every fourth grid cell
	//Color gridColor16; // Color used for every sixteenth grid cell
	//Color selectionColor; // Color used for the selected cell
	//Color pathColor; // Color used to draw the path
	bool paintSolid; // If true, cells are painted as solid rather than wireframe
#endif
};

#endif // GAMEGRID_H
<commit_msg>Fixing a bad merge from my previous commit<commit_after>//
//  GameGrid.h
//  Created by <NAME> on 02/04/14.
//

#ifndef GAMEGRID_H
#define GAMEGRID_H

#include "ExampleGame/Components/Grid/GridCell.h"
#include "ExampleGame/Components/Grid/GridConstants.h"
#include "ExampleGame/Components/Grid/GridRoom.h"
#include "ExampleGame/Components/Grid/GridZone.h"
#include "Libraries/glm/glm.hpp"
#include "Vajra/Common/Objects/Declarations.h"

#include <list>
#include <vector>

class GameGrid {
public:
	GameGrid(unsigned int spanX, unsigned int spanZ);
	~GameGrid();

	int GetElevationFromWorldY(float worldY);
	float ConvertElevationToWorldY(unsigned int elevation);

	inline unsigned int GetGridWidth()   { return this->gridWidth;  }
	inline unsigned int GetGridHeight()  { return this->gridHeight; }

	GridCell* GetCell(int gridX, int gridZ);     // Returns the cell at the specified coordinates
	GridCell* GetCell(glm::vec3 worldPosition);  // Returns the cell at the specified world position

	// Returns number of cell "hops" to get from start to goal
	int GetCellDistanceBetweenCells(int startCellX, int startCellZ, int goalCellX, int goalCellZ);
	int GetCellDistanceBetweenCells(GridCell* startCell, GridCell* goalCell);

	// Returns distance along the ground plane from start to goal
	float GetGroundDistanceBetweenCells(int startCellX, int startCellZ, int goalCellX, int goalCellZ);
	float GetGroundDistanceBetweenCells(GridCell* startCell, GridCell* goalCell);

	// Returns 3-D distance from start to goal
	float GetTrueDistanceBetweenCells(int startCellX, int startCellZ, int goalCellX, int goalCellZ);
	float GetTrueDistanceBetweenCells(GridCell* startCell, GridCell* goalCell);

	// Populates the list with all adjacent cells and returns the number of adjacent cells
	void GetNeighborCells(std::list<GridCell*>& outNbrs, GridCell* cell, float range = 1.0f);

	void AddGridRoom(int west, int south, int width, int height);

	GridRoom* GetRoom(int gridX, int gridZ);     // Returns the room at the specified coordinates
	GridRoom* GetRoom(glm::vec3 worldPosition);  // Returns the room at the specified world position
	GridRoom* GetRoom(GridCell* cell);           // Returns the room at the specified grid cell

	// returns the world position of the center of a room
	glm::vec3 GetRoomCenter(int x, int z);
	glm::vec3 GetRoomCenter(GridCell* cell);

	void AddGridZone(ObjectIdType zoneId);

	GridZone* GetZone(int gridX, int gridZ);     // Returns the first zone the cell at the specified coordinates resides in
	GridZone* GetZone(glm::vec3 worldPosition);  // Returns the first zone the cell at the specified world position resides in
	GridZone* GetZone(GridCell* cell);           // Returns the first zone the specified cell resides in

	void TouchedCells(GridCell* startCell, GridCell* goalCell, std::list<GridCell*>& outTouched);

	bool Passable(GridCell* startCell, GridCell* goalCell);

	bool HasLineOfSight(GridCell* sourceCell, GridCell* targetCell);
	bool HasLineOfSight(int sourceCellX, int sourceCellZ, int targetCellX, int targetCellZ);

	int GetCellGroundLevel(int gridX, int gridZ);
	bool IsCellPassableAtElevation(int gridX, int gridZ, unsigned int elevation);
	bool IsCellVisibleAtElevation(int gridX, int gridZ, unsigned int elevation);

	void SetCellGroundLevel(int gridX, int gridZ, unsigned int elevation);
	void SetCellPassableAtElevation(int gridX, int gridZ, unsigned int elevation, bool isPassable);
	void SetCellVisibleAtElevation(int gridX, int gridZ, unsigned int elevation, bool isVisible);

private:
	void init(unsigned int spanX, unsigned int spanZ);
	void destroy();

	bool isWithinGrid(int cellX, int cellZ);     // Returns true if the specified cell falls within the grid boundaries
	bool isWithinGrid(glm::vec3 worldPosition);  // Returns true if the vector position falls within a defined cell

	unsigned int gridWidth;
	unsigned int gridHeight;

	GridCell*** gridCells;
	unsigned char*** passableBits;
	unsigned char*** visibleBits;

	std::vector<GridRoom*> gridRooms;
	std::list<ObjectIdType> gridZones;

#ifdef DEBUG
public:
	void debugDrawGrid();

private:
	//Color gridColor; // Default debug grid color
	//Color gridColor4; // Color used for every fourth grid cell
	//Color gridColor16; // Color used for every sixteenth grid cell
	//Color selectionColor; // Color used for the selected cell
	//Color pathColor; // Color used to draw the path
	bool paintSolid; // If true, cells are painted as solid rather than wireframe
#endif
};

#endif // GAMEGRID_H

{'fraction_non_alphanumeric': 0.08637984841729826, 'fraction_numerical': 0.003901025412394115, 'mean_word_length': 5.099932019034671, 'pattern_counts': {'":': 0, '<': 17, '<?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': '4671161', 'n_tokens_mistral': 2736, 'n_tokens_neox': 2607, 'n_words': 955}