Skip to content

Commit

Permalink
Minor tweaks (#161) #patch
Browse files Browse the repository at this point in the history
* ReSharper tweaks

* Fixed encoding of two mod files
  • Loading branch information
IhateTrains authored Mar 14, 2021
1 parent 05919ca commit 94fcab2
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Druidic
#Druidic
ynys_mon = { #toutatis
county = c_anglesey
barony = b_yns_mon
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


kushitism_religion = {
family = rf_pagan

Expand Down
3 changes: 2 additions & 1 deletion ImperatorToCK3/Source/CK3/Dynasties/Dynasty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "Imperator/Families/Family.h"
#include "Imperator/Characters/Character.h"
#include "Log.h"
#include <ranges>



Expand All @@ -17,7 +18,7 @@ CK3::Dynasty::Dynasty(const Imperator::Family& impFamily, const mappers::Localiz
Log(LogLevel::Warning) << "Couldn't determine culture for dynasty " << ID << ", needs manual setting!";
}

for (const auto& [memberID, member] : impMembers) {
for (const auto& member : impMembers | std::views::values) {
if (const auto& ck3Member = member->getCK3Character()) {
ck3Member->setDynastyID(ID);
}
Expand Down
6 changes: 3 additions & 3 deletions ImperatorToCK3/Source/CK3/Province/CK3Province.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ namespace CK3 {

class Title;
class Province {
public:
public:
Province() = default;
Province(unsigned long long id, std::istream& theStream);
Province(unsigned long long id, const Province& otherProv);

void initializeFromImperator(const std::shared_ptr<Imperator::Province>& origProvince,
void initializeFromImperator(const std::shared_ptr<Imperator::Province>& impProvince,
const mappers::CultureMapper& cultureMapper,
const mappers::ReligionMapper& religionMapper);

Expand All @@ -44,7 +44,7 @@ class Province {

friend std::ostream& operator<<(std::ostream& output, const Province& province);

private:
private:
void setReligionFromImperator(const mappers::ReligionMapper& religionMapper);
void setCultureFromImperator(const mappers::CultureMapper& cultureMapper);
void setHoldingFromImperator();
Expand Down
4 changes: 1 addition & 3 deletions ImperatorToCK3/Source/CommonUtilities/History.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#include "ParserHelpers.h"
#include "CommonRegexes.h"
#include "History.h"



std::optional<std::string> History::getFieldValue(const std::string& fieldName, const date& date) const {
const auto itr = simpleFields.find(fieldName);
if (itr == simpleFields.end())
{
if (itr == simpleFields.end()) {
return std::nullopt;
}

Expand Down
2 changes: 1 addition & 1 deletion ImperatorToCK3/Source/CommonUtilities/HistoryFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class History::Factory: commonItems::parser
{
public:
explicit Factory(std::vector<SimpleFieldStruct> simpleFieldStructs);
explicit Factory(std::vector<SimpleFieldStruct> _simpleFieldStructs);
std::unique_ptr<History> getHistory(std::istream& theStream);

private:
Expand Down
7 changes: 4 additions & 3 deletions ImperatorToCK3/Source/Imperator/Characters/Characters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "CommonRegexes.h"
#include <set>
#include <utility>
#include <ranges>



Expand All @@ -31,7 +32,7 @@ void Imperator::Characters::linkFamilies(const Families& theFamilies) {
std::set<unsigned long long> idsWithoutDefinition;
const auto& families = theFamilies.getFamilies();

for (const auto& [characterID, character]: characters) {
for (const auto& character : characters | std::views::values) {
auto familyID = character->getFamily().first;
if (const auto& familyItr = families.find(familyID); familyItr != families.end()) {
character->setFamily(familyItr->second);
Expand Down Expand Up @@ -60,10 +61,10 @@ void Imperator::Characters::linkFamilies(const Families& theFamilies) {

void Imperator::Characters::linkSpouses() {
auto counterSpouse = 0;
for (const auto& [characterID, character]: characters) {
for (const auto& character : characters | std::views::values) {
if (!character->getSpouses().empty()) {
std::map<unsigned long long, std::shared_ptr<Character>> newSpouses;
for (const auto& [spouseID, spouse]: character->getSpouses()) {
for (const auto& spouseID : character->getSpouses() | std::views::keys) {
const auto& characterItr = characters.find(spouseID);
if (characterItr != characters.end()) {
newSpouses.emplace(characterItr->first, characterItr->second);
Expand Down
5 changes: 3 additions & 2 deletions ImperatorToCK3/Source/Imperator/Countries/Countries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "Log.h"
#include "ParserHelpers.h"
#include "CommonRegexes.h"
#include <ranges>



Expand Down Expand Up @@ -40,10 +41,10 @@ void Imperator::Countries::linkFamilies(const Families& theFamilies) {
auto counter = 0;
std::set<unsigned long long> idsWithoutDefinition;
const auto& families = theFamilies.getFamilies();
for (const auto& [countryID, country] : countries) {
for (const auto& country : countries | std::views::values) {
if (!country->getFamilies().empty()) {
std::map<unsigned long long, std::shared_ptr<Family>> newFamilies;
for (const auto& [familyID, family] : country->getFamilies()) {
for (const auto& familyID : country->getFamilies() | std::views::keys) {
const auto& familyItr = families.find(familyID);
if (familyItr != families.end()) {
newFamilies.insert(std::pair(familyItr->first, familyItr->second));
Expand Down
2 changes: 1 addition & 1 deletion ImperatorToCK3/Source/Imperator/Families/Family.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Family {
class Factory;
Family() = default;

void linkMember(const std::shared_ptr<Character>& memberPtr);
void linkMember(const std::shared_ptr<Character>& newMemberPtr);

[[nodiscard]] auto getID() const { return ID; }
[[nodiscard]] const auto& getKey() const { return key; }
Expand Down
7 changes: 4 additions & 3 deletions ImperatorToCK3/Source/Imperator/Provinces/Provinces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "Log.h"
#include "ParserHelpers.h"
#include "CommonRegexes.h"
#include <ranges>



Expand All @@ -28,10 +29,10 @@ void Imperator::Provinces::registerKeys() {
void Imperator::Provinces::linkPops(const Pops& thePops) {
auto counter = 0;
const auto& pops = thePops.getPops();
for (const auto& [provinceID, province] : provinces) {
for (const auto& province : provinces | std::views::values) {
if (!province->getPops().empty()) {
std::map<unsigned long long, std::shared_ptr<Pop>> newPops;
for (const auto& [popID, pop] : province->getPops()) {
for (const auto& popID : province->getPops() | std::views::keys) {
const auto& popItr = pops.find(popID);
if (popItr != pops.end()) {
newPops.emplace(popItr->first, popItr->second);
Expand All @@ -51,7 +52,7 @@ void Imperator::Provinces::linkPops(const Pops& thePops) {
void Imperator::Provinces::linkCountries(const Countries& theCountries) {
auto counter = 0;
const auto& countries = theCountries.getCountries();
for (const auto& [provinceID, province] : provinces) {
for (const auto& province : provinces | std::views::values) {
if (!province->getPops().empty()) {
const auto& countryItr = countries.find(province->getOwner().first);
if (countryItr != countries.end()) {
Expand Down

0 comments on commit 94fcab2

Please sign in to comment.