• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ParadoxGameConverters / Vic2ToHoI4 / 25256188061

28 Apr 2026 01:10PM UTC coverage: 65.601%. Remained the same
25256188061

push

github

web-flow
1.18 support (#1771)

* Update data files

* Blank new files

* Update version

* Update landmark mappings

0 of 2 new or added lines in 1 file covered. (0.0%)

30194 of 46027 relevant lines covered (65.6%)

27557.69 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/OutHoi4/OutMod.cpp
1
#include "src/OutHoi4/OutMod.h"
2
#include "external/common_items/Log.h"
3
#include "external/common_items/OSCompatibilityLayer.h"
4
#include "src/OutHoi4/OutFlags.h"
5
#include "src/OutHoi4/OutHoi4World.h"
6
#include <filesystem>
7
#include <string>
8

9

10

11
namespace
12
{
13

14
void CreateOutputFolder(const std::filesystem::path& output_name)
×
15
{
16
        Log(LogLevel::Info) << "\tCopying blank mod";
×
17
        if (!commonItems::DoesFolderExist("output") && !std::filesystem::create_directories("output"))
×
18
        {
19
                throw std::runtime_error("Could not create output folder");
×
20
        }
21
        try
22
        {
23
                std::filesystem::copy("blankmod", "output" / output_name, std::filesystem::copy_options::recursive);
×
24
        }
25
        catch (...)
×
26
        {
27
                throw std::runtime_error("Could not copy blankMod");
×
28
        }
×
29
}
×
30

31

32
void CreateModFiles(const std::filesystem::path& output_name)
×
33
{
34
        Log(LogLevel::Info) << "\tCreating .mod files";
×
35

36
        std::filesystem::path mod_filename = "output" / output_name;
×
37
        mod_filename += ".mod";
×
38
        std::ofstream mod_file(mod_filename);
×
39
        if (!mod_file.is_open())
×
40
        {
41
                throw std::runtime_error("Could not create .mod file");
×
42
        }
43
        mod_file << "name = \"Converted - " << output_name.string() << "\"\n";
×
44
        mod_file << "path = \"mod/" << output_name.string() << "/\"\n";
×
45
        mod_file << "user_dir = \"" << output_name.string() << "_user_dir\"\n";
×
46
        mod_file << "replace_path=\"common/abilities\"\n";
×
47
        mod_file << "replace_path=\"common/ai_navy/goals\"\n";
×
48
        mod_file << "replace_path=\"common/ai_navy/taskforce\"\n";
×
49
        mod_file << "replace_path=\"common/ai_strategy\"\n";
×
50
        mod_file << "replace_path=\"common/ai_templates\"\n";
×
51
        mod_file << "replace_path=\"common/countries\"\n";
×
52
        mod_file << "replace_path=\"common/decisions\"\n";
×
53
        mod_file << "replace_path=\"common/decisions/categories\"\n";
×
54
        mod_file << "replace_path=\"common/dynamic_modifiers\"\n";
×
55
        mod_file << "replace_path=\"common/factions/templates\"\n";
×
56
        mod_file << "replace_path=\"common/ideologies\"\n";
×
57
        mod_file << "replace_path=\"common/military_industrial_organization/organizations\"\n";
×
58
        mod_file << "replace_path=\"common/national_focus\"\n";
×
59
        mod_file << "replace_path=\"common/on_actions\"\n";
×
60
        mod_file << "replace_path=\"common/peace_conference/ai_peace\"\n";
×
61
        mod_file << "replace_path=\"common/peace_conference/cost_modifiers\"\n";
×
62
        mod_file << "replace_path=\"common/raids\"\n";
×
63
        mod_file << "replace_path=\"common/script_constants\"\n";
×
64
        mod_file << "replace_path=\"common/scripted_effects\"\n";
×
65
        mod_file << "replace_path=\"common/scripted_localisation\"\n";
×
66
        mod_file << "replace_path=\"common/scripted_triggers\"\n";
×
67
        mod_file << "replace_path=\"common/technology_sharing\"\n";
×
68
        mod_file << "replace_path=\"events\"\n";
×
69
        mod_file << "replace_path=\"history/countries\"\n";
×
70
        mod_file << "replace_path=\"history/states\"\n";
×
71
        mod_file << "replace_path=\"history/units\"\n";
×
72
        mod_file << "replace_path=\"map/supplyareas\"\n";
×
73
        mod_file << "replace_path=\"map/strategicregions\"\n";
×
NEW
74
        mod_file << "supported_version=\"1.18.*\"";
×
75
        mod_file.close();
×
76

77
        std::filesystem::path descriptor_filename = "output" / output_name;
×
78
        descriptor_filename += "/descriptor.mod";
×
79
        std::ofstream descriptor_file(descriptor_filename);
×
80
        if (!descriptor_file.is_open())
×
81
        {
82
                throw std::runtime_error("Could not create descriptor.mod");
×
83
        }
84
        descriptor_file << "name = \"Converted - " << output_name.string() << "\"\n";
×
85
        descriptor_file << "replace_path=\"common/abilities\"\n";
×
86
        descriptor_file << "replace_path=\"common/ai_navy/goals\"\n";
×
87
        descriptor_file << "replace_path=\"common/ai_navy/taskforce\"\n";
×
88
        descriptor_file << "replace_path=\"common/ai_strategy\"\n";
×
89
        descriptor_file << "replace_path=\"common/ai_templates\"\n";
×
90
        descriptor_file << "replace_path=\"common/countries\"\n";
×
91
        descriptor_file << "replace_path=\"common/decisions\"\n";
×
92
        descriptor_file << "replace_path=\"common/decisions/categories\"\n";
×
93
        descriptor_file << "replace_path=\"common/dynamic_modifiers\"\n";
×
94
        descriptor_file << "replace_path=\"common/factions/templates\"\n";
×
95
        descriptor_file << "replace_path=\"common/ideologies\"\n";
×
96
        descriptor_file << "replace_path=\"common/military_industrial_organization/organizations\"\n";
×
97
        descriptor_file << "replace_path=\"common/national_focus\"\n";
×
98
        descriptor_file << "replace_path=\"common/on_actions\"\n";
×
99
        descriptor_file << "replace_path=\"common/peace_conference/ai_peace\"\n";
×
100
        descriptor_file << "replace_path=\"common/peace_conference/cost_modifiers\"\n";
×
101
        descriptor_file << "replace_path=\"common/raids\"\n";
×
102
        descriptor_file << "replace_path=\"common/script_constants\"\n";
×
103
        descriptor_file << "replace_path=\"common/scripted_effects\"\n";
×
104
        descriptor_file << "replace_path=\"common/scripted_localisation\"\n";
×
105
        descriptor_file << "replace_path=\"common/scripted_triggers\"\n";
×
106
        descriptor_file << "replace_path=\"common/technology_sharing\"\n";
×
107
        descriptor_file << "replace_path=\"events\"\n";
×
108
        descriptor_file << "replace_path=\"history/countries\"\n";
×
109
        descriptor_file << "replace_path=\"history/states\"\n";
×
110
        descriptor_file << "replace_path=\"history/units\"\n";
×
111
        descriptor_file << "replace_path=\"map/supplyareas\"\n";
×
112
        descriptor_file << "replace_path=\"map/strategicregions\"\n";
×
NEW
113
        descriptor_file << "supported_version=\"1.18.*\"";
×
114
        descriptor_file.close();
×
115
}
×
116

117
} // namespace
118

119

120

121
void clearOutputFolder(const std::filesystem::path& outputName)
×
122
{
123
        const auto outputFolder = "output" / outputName;
×
124
        if (commonItems::DoesFolderExist(outputFolder))
×
125
        {
126
                Log(LogLevel::Info) << "Removing pre-existing copy of " << outputName;
×
127
                if (std::filesystem::remove_all(outputFolder) == -1)
×
128
                {
129
                        throw std::runtime_error("Could not remove pre-existing output folder " + outputFolder.string() +
×
130
                                                                                         ". Please delete folder and try converting again.");
×
131
                }
132
        }
133
}
×
134

135

136
void output(const HoI4::World& destWorld,
×
137
         const std::filesystem::path& outputName,
138
         const bool debugEnabled,
139
         const Mods& vic2Mods,
140
         const Configuration& theConfiguration)
141
{
142
        Log(LogLevel::Progress) << "80%";
×
143
        Log(LogLevel::Info) << "Outputting mod";
×
144

145
        CreateOutputFolder(outputName);
×
146
        CreateModFiles(outputName);
×
147
        Log(LogLevel::Progress) << "85%";
×
148
        copyFlags(destWorld.getCountries(),
×
149
                 destWorld.GetUnionCountries(),
150
                 outputName,
151
                 vic2Mods,
152
                 destWorld.getMajorIdeologies());
153
        Log(LogLevel::Progress) << "90%";
×
154
        OutputWorld(destWorld, outputName, debugEnabled, theConfiguration);
×
155
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc