<commit_before>#include "LocationDefinition.h"

#include "components/debug/Debug.h"

void LocationDefinition::CityDefinition::init(CityDefinition::Type type, uint32_t citySeed,
	uint32_t wildSeed, uint32_t provinceSeed, uint32_t rulerSeed, uint32_t distantSkySeed,
	bool coastal, bool premade)
{
	this->type = type;
	this->citySeed = citySeed;
	this->wildSeed = wildSeed;
	this->provinceSeed = provinceSeed;
	this->rulerSeed = rulerSeed;
	this->distantSkySeed = distantSkySeed;
	this->coastal = coastal;
	this->premade = premade;
}

uint32_t LocationDefinition::CityDefinition::getWildDungeonSeed(int wildBlockX, int wildBlockY) const
{
	return (this->provinceSeed + (((wildBlockY << 6) + wildBlockX) & 0xFFFF)) & 0xFFFFFFFF;
}

void LocationDefinition::DungeonDefinition::init()
{
	// Do nothing
}

void LocationDefinition::MainQuestDungeonDefinition::init(MainQuestDungeonDefinition::Type type)
{
	this->type = type;
}

void LocationDefinition::init(LocationDefinition::Type type,
	const CityDataFile::ProvinceData::LocationData &locationData)
{
	this->name = locationData.name;
	this->x = locationData.x;
	this->y = locationData.y;
	this->visibleByDefault = type == LocationDefinition::Type::City;
	this->type = type;
}

void LocationDefinition::initCity(int localCityID, int provinceID, bool coastal, bool premade,
	CityDefinition::Type type, const CityDataFile &cityData)
{
	const auto &provinceData = cityData.getProvinceData(provinceID);
	const auto &locationData = provinceData.getLocationData(localCityID);
	this->init(LocationDefinition::Type::City, locationData);

	const uint32_t citySeed = cityData.getCitySeed(localCityID, provinceID);
	const uint32_t wildSeed = cityData.getWildernessSeed(localCityID, provinceID);
	const uint32_t provinceSeed = cityData.getProvinceSeed(provinceID);
	const uint32_t rulerSeed = cityData.getRulerSeed(localCityID, provinceID);
	const uint32_t distantSkySeed = cityData.getDistantSkySeed(localCityID, provinceID);
	this->city.init(type, citySeed, wildSeed, provinceSeed, rulerSeed, distantSkySeed, coastal, premade);
}

void LocationDefinition::initDungeon(const CityDataFile::ProvinceData::LocationData &locationData)
{
	this->init(LocationDefinition::Type::Dungeon, locationData);
	this->dungeon.init();
}
<commit_msg>Locations need a name to be visible by default.<commit_after>#include "LocationDefinition.h"

#include "components/debug/Debug.h"

void LocationDefinition::CityDefinition::init(CityDefinition::Type type, uint32_t citySeed,
	uint32_t wildSeed, uint32_t provinceSeed, uint32_t rulerSeed, uint32_t distantSkySeed,
	bool coastal, bool premade)
{
	this->type = type;
	this->citySeed = citySeed;
	this->wildSeed = wildSeed;
	this->provinceSeed = provinceSeed;
	this->rulerSeed = rulerSeed;
	this->distantSkySeed = distantSkySeed;
	this->coastal = coastal;
	this->premade = premade;
}

uint32_t LocationDefinition::CityDefinition::getWildDungeonSeed(int wildBlockX, int wildBlockY) const
{
	return (this->provinceSeed + (((wildBlockY << 6) + wildBlockX) & 0xFFFF)) & 0xFFFFFFFF;
}

void LocationDefinition::DungeonDefinition::init()
{
	// Do nothing
}

void LocationDefinition::MainQuestDungeonDefinition::init(MainQuestDungeonDefinition::Type type)
{
	this->type = type;
}

void LocationDefinition::init(LocationDefinition::Type type,
	const CityDataFile::ProvinceData::LocationData &locationData)
{
	this->name = locationData.name;
	this->x = locationData.x;
	this->y = locationData.y;
	this->visibleByDefault = (locationData.name.size() > 0) && (type == LocationDefinition::Type::City);
	this->type = type;
}

void LocationDefinition::initCity(int localCityID, int provinceID, bool coastal, bool premade,
	CityDefinition::Type type, const CityDataFile &cityData)
{
	const auto &provinceData = cityData.getProvinceData(provinceID);
	const auto &locationData = provinceData.getLocationData(localCityID);
	this->init(LocationDefinition::Type::City, locationData);

	const uint32_t citySeed = cityData.getCitySeed(localCityID, provinceID);
	const uint32_t wildSeed = cityData.getWildernessSeed(localCityID, provinceID);
	const uint32_t provinceSeed = cityData.getProvinceSeed(provinceID);
	const uint32_t rulerSeed = cityData.getRulerSeed(localCityID, provinceID);
	const uint32_t distantSkySeed = cityData.getDistantSkySeed(localCityID, provinceID);
	this->city.init(type, citySeed, wildSeed, provinceSeed, rulerSeed, distantSkySeed, coastal, premade);
}

void LocationDefinition::initDungeon(const CityDataFile::ProvinceData::LocationData &locationData)
{
	this->init(LocationDefinition::Type::Dungeon, locationData);
	this->dungeon.init();
}

{'fraction_non_alphanumeric': 0.1155516941789748, 'fraction_numerical': 0.011077324066029539, 'mean_word_length': 7.656015037593985, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 42, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '5704712', 'n_tokens_mistral': 1574, 'n_tokens_neox': 1512, 'n_words': 288}