mirror of
https://github.com/electronicarts/CNC_TS_and_RA2_Mission_Editor.git
synced 2025-07-17 19:56:38 -04:00
Enhance:ini registry sequence (#121)
* '+=' supported . * introduced registry list value deduplication . * TechnoType listing now parse data both from ini and map . * added UT case .
This commit is contained in:
parent
3e90dca667
commit
93e956e7ac
8 changed files with 164 additions and 50 deletions
|
@ -32,6 +32,7 @@
|
|||
#include "progressdlg.h"
|
||||
#include "Structs.h"
|
||||
#include "Tube.h"
|
||||
#include "IniMega.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
|
@ -3525,15 +3526,15 @@ BuildingFoundation getBuildingFoundation(const CString& artId) {
|
|||
// TODO: simplify this function, remove duplicated codes
|
||||
void CMapData::UpdateBuildingInfo(const CString* lpUnitType)
|
||||
{
|
||||
CIniFile& ini = GetIniFile();
|
||||
auto const& rulesGroup = IniMegaFile::GetRules();
|
||||
|
||||
if (!lpUnitType) {
|
||||
memset(buildinginfo, 0, buildingInfoCapacity * sizeof(BUILDING_INFO));
|
||||
|
||||
for (auto const& [seq, id] : rules.GetSection("BuildingTypes")) {
|
||||
for (auto const& [seq, id] : rulesGroup.GetSection("BuildingTypes")) {
|
||||
auto const& type = id;
|
||||
auto artname = rules.GetStringOr(type, "Image", type);
|
||||
artname = ini.GetStringOr(type, "Image", artname);
|
||||
auto artname = rulesGroup.GetStringOr(type, "Image", type);
|
||||
artname = rulesGroup.GetStringOr(type, "Image", artname);
|
||||
|
||||
auto const foundation = getBuildingFoundation(artname);
|
||||
|
||||
|
@ -3588,9 +3589,9 @@ void CMapData::UpdateBuildingInfo(const CString* lpUnitType)
|
|||
|
||||
}
|
||||
|
||||
for (auto const& [seq, id] : rules.GetSection("BuildingTypes")) {
|
||||
for (auto const& [seq, id] : rulesGroup.GetSection("BuildingTypes")) {
|
||||
auto const& type = id;
|
||||
auto artname = ini.GetStringOr(type, "Image", type);
|
||||
auto artname = rulesGroup.GetStringOr(type, "Image", type);
|
||||
|
||||
auto const foundation = getBuildingFoundation(artname);
|
||||
|
||||
|
@ -3624,8 +3625,8 @@ void CMapData::UpdateBuildingInfo(const CString* lpUnitType)
|
|||
|
||||
// only for specific building -> faster
|
||||
auto const& type = *lpUnitType;
|
||||
auto artname = rules.GetStringOr(type, "Image", type);
|
||||
artname = ini.GetStringOr(type, "Image", artname);
|
||||
auto artname = rulesGroup.GetStringOr(type, "Image", type);
|
||||
artname = rulesGroup.GetStringOr(type, "Image", artname);
|
||||
|
||||
auto const foundation = getBuildingFoundation(artname);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue