Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
secsome committed Sep 23, 2021
2 parents d941e7f + 15efa6f commit 9b7e1f7
Show file tree
Hide file tree
Showing 47 changed files with 506 additions and 663 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@

#Don't ignore these files
!/Debug/vxl_drawing_lib.lib
!/Release/vxl_drawing_lib.lib
!/Release/vxl_drawing_lib.lib
/.vs/FA2sp/project-colors.json
2 changes: 1 addition & 1 deletion FA2pp
13 changes: 6 additions & 7 deletions FA2sp/Ext/CAITriggerTypes/Body.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "Body.h"

#include <CINI.h>
#include <GlobalVars.h>

#include "../../Helpers/STDHelpers.h"
#include "../../Helpers/Translations.h"
Expand Down Expand Up @@ -53,7 +52,7 @@ BOOL CAITriggerTypesExt::OnInitDialogExt()

::SendMessage(hSides, CB_ADDSTRING, NULL, (LPARAM)"0 - All");
int i = 1;
if (auto sides = GlobalVars::INIFiles::FAData->GetSection("Sides"))
if (auto sides = CINI::FAData->GetSection("Sides"))
{
for (auto& itr : sides->EntitiesDictionary)
{
Expand Down Expand Up @@ -88,7 +87,7 @@ void CAITriggerTypesExt::OnBNCloneAITriggerClicked()
this->CCBAITriggerList.GetWindowText(currentID);
STDHelpers::TrimIndex(currentID);

ppmfc::CString key = INIClass::GetAvailableIndex();
ppmfc::CString key = CINI::GetAvailableIndex();
ppmfc::CString value, name;

HWND hName;
Expand All @@ -100,16 +99,16 @@ void CAITriggerTypesExt::OnBNCloneAITriggerClicked()
delete[] pStr;

value = name + ",";
auto& results = STDHelpers::SplitString(GlobalVars::INIFiles::CurrentDocument->GetString("AITriggerTypes", currentID));
auto& results = STDHelpers::SplitString(CINI::CurrentDocument->GetString("AITriggerTypes", currentID));
for (int i = 1; i < results.size() - 1; ++i)
value += (results[i] + ",");
value += results.back();

GlobalVars::INIFiles::CurrentDocument->WriteString("AITriggerTypes", key, value);
CINI::CurrentDocument->WriteString("AITriggerTypes", key, value);

GlobalVars::INIFiles::CurrentDocument->WriteString(
CINI::CurrentDocument->WriteString(
"AITriggerTypesEnable", key,
GlobalVars::INIFiles::CurrentDocument->GetString("AITriggerTypesEnable", currentID, "no")
CINI::CurrentDocument->GetString("AITriggerTypesEnable", currentID, "no")
);

int idx = this->CCBAITriggerList.AddString(key + " (" + name + ")");
Expand Down
62 changes: 37 additions & 25 deletions FA2sp/Ext/CFinalSunDlg/Body.ObjectBrowserControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include "../../FA2sp.h"

#include <GlobalVars.h>
#include <CINI.h>
#include <CMapData.h>

Expand Down Expand Up @@ -68,9 +67,9 @@ void ObjectBrowserControlExt::Redraw_Initialize()
Owners.clear();
this->DeleteAllItems();

auto& rules = GlobalVars::INIFiles::Rules();
auto& fadata = GlobalVars::INIFiles::FAData();
auto& doc = GlobalVars::INIFiles::CurrentDocument();
auto& rules = CINI::Rules();
auto& fadata = CINI::FAData();
auto& doc = CINI::CurrentDocument();

auto loadSet = [](const char* pTypeName, int nType)
{
Expand Down Expand Up @@ -145,7 +144,7 @@ void ObjectBrowserControlExt::Redraw_Ground()
HTREEITEM& hGround = ExtNodes[Root_Ground];
if (hGround == NULL) return;

auto& doc = GlobalVars::INIFiles::CurrentDocument();
auto& doc = CINI::CurrentDocument();
CString theater = doc.GetString("Map", "Theater");
if (theater == "NEWURBAN")
theater = "UBN";
Expand All @@ -170,17 +169,21 @@ void ObjectBrowserControlExt::Redraw_Owner()
HTREEITEM& hOwner = ExtNodes[Root_Owner];
if (hOwner == NULL) return;

auto& doc = GlobalVars::INIFiles::CurrentDocument();
auto& doc = CINI::CurrentDocument();

bool bMultiplayer = doc.GetBool("Basic", "MultiplayerOnly");
auto& section = Variables::Rules.ParseIndicies("Houses", true);

for (size_t i = 0, sz = section.size(); i < sz; ++i)
if (CINI::CurrentDocument->GetBool("Basic", "MultiplayerOnly"))
{
if (bMultiplayer)
if (section[i] != "Neutral House" && section[i] != "Special House")
continue;
this->InsertString(section[i], Const_House + i, hOwner);
auto& section = Variables::Rules.GetSection("Countries");
auto itr = section.begin();
for (size_t i = 0, sz = section.size(); i < sz; ++i, ++itr)
if (strcmp(itr->second, "Neutral") == 0 || strcmp(itr->second, "Special") == 0)
this->InsertString(itr->second, Const_House + i, hOwner);
}
else
{
auto& section = Variables::Rules.ParseIndicies("Houses", true);
for (size_t i = 0, sz = section.size(); i < sz; ++i)
this->InsertString(section[i], Const_House + i, hOwner);
}
}

Expand All @@ -191,7 +194,7 @@ void ObjectBrowserControlExt::Redraw_Infantry()

std::map<int, HTREEITEM> subNodes;

auto& fadata = GlobalVars::INIFiles::FAData();
auto& fadata = CINI::FAData();

int i = 0;
if (auto sides = fadata.GetSection("Sides"))
Expand Down Expand Up @@ -240,7 +243,7 @@ void ObjectBrowserControlExt::Redraw_Vehicle()

std::map<int, HTREEITEM> subNodes;

auto& fadata = GlobalVars::INIFiles::FAData();
auto& fadata = CINI::FAData();

int i = 0;
if (auto sides = fadata.GetSection("Sides"))
Expand Down Expand Up @@ -289,8 +292,8 @@ void ObjectBrowserControlExt::Redraw_Aircraft()

std::map<int, HTREEITEM> subNodes;

auto& rules = GlobalVars::INIFiles::Rules();
auto& fadata = GlobalVars::INIFiles::FAData();
auto& rules = CINI::Rules();
auto& fadata = CINI::FAData();

int i = 0;
if (auto sides = fadata.GetSection("Sides"))
Expand Down Expand Up @@ -339,8 +342,8 @@ void ObjectBrowserControlExt::Redraw_Building()

std::map<int, HTREEITEM> subNodes;

auto& rules = GlobalVars::INIFiles::Rules();
auto& fadata = GlobalVars::INIFiles::FAData();
auto& rules = CINI::Rules();
auto& fadata = CINI::FAData();

int i = 0;
if (auto sides = fadata.GetSection("Sides"))
Expand Down Expand Up @@ -432,7 +435,7 @@ void ObjectBrowserControlExt::Redraw_Overlay()
HTREEITEM& hOverlay = ExtNodes[Root_Overlay];
if (hOverlay == NULL) return;

auto& rules = GlobalVars::INIFiles::Rules();
auto& rules = CINI::Rules();

HTREEITEM hTemp;
hTemp = this->InsertTranslatedString("DelOvrlObList", -1, hOverlay);
Expand Down Expand Up @@ -466,7 +469,7 @@ void ObjectBrowserControlExt::Redraw_Overlay()
this->InsertTranslatedString("Tracks", Const_Overlay + 39, hOverlay);

MultimapHelper mmh;
mmh.AddINI(&GlobalVars::INIFiles::Rules());
mmh.AddINI(&CINI::Rules());
auto& overlays = mmh.ParseIndicies("OverlayTypes", true);
for (size_t i = 0, sz = std::min<unsigned int>(overlays.size(), 255); i < sz; ++i)
{
Expand Down Expand Up @@ -519,7 +522,7 @@ void ObjectBrowserControlExt::Redraw_Tunnel()
HTREEITEM& hTunnel = ExtNodes[Root_Tunnel];
if (hTunnel == NULL) return;

if (GlobalVars::INIFiles::FAData().GetBool("Debug", "AllowTunnels"))
if (CINI::FAData().GetBool("Debug", "AllowTunnels"))
{
this->InsertTranslatedString("NewTunnelObList", 50, hTunnel);
this->InsertTranslatedString("DelTunnelObList", 51, hTunnel);
Expand All @@ -533,7 +536,7 @@ void ObjectBrowserControlExt::Redraw_PlayerLocation()

this->InsertTranslatedString("StartpointsDelete", 21, hPlayerLocation);

if (GlobalVars::INIFiles::CurrentDocument->GetBool("Basic", "MultiplayerOnly"))
if (CINI::CurrentDocument->GetBool("Basic", "MultiplayerOnly"))
{
for (int i = 0; i < 8; ++i)
{
Expand Down Expand Up @@ -587,7 +590,7 @@ int ObjectBrowserControlExt::GuessSide(const char* pRegName, int nType)

int ObjectBrowserControlExt::GuessBuildingSide(const char* pRegName)
{
auto& rules = GlobalVars::INIFiles::Rules();
auto& rules = CINI::Rules();

int planning;
planning = rules.GetInteger(pRegName, "AIBasePlanningSide", -1);
Expand Down Expand Up @@ -648,6 +651,15 @@ int ObjectBrowserControlExt::GuessGenericSide(const char* pRegName, int nType)
}

// ObjectBrowserControlExt::OnSelectChanged
void ObjectBrowserControlExt::OnExeTerminate()
{
IgnoreSet.clear();
ForceName.clear();
for (auto& set : ExtSets)
set.clear();
KnownItem.clear();
Owners.clear();
}

int ObjectBrowserControlExt::UpdateEngine(int nData)
{
Expand Down
1 change: 1 addition & 0 deletions FA2sp/Ext/CFinalSunDlg/Body.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class ObjectBrowserControlExt : public ObjectBrowserControl
public:
void Redraw();
int UpdateEngine(int nData);
static void OnExeTerminate();

ppmfc::CString QueryUIName(const char* pRegName);

Expand Down
1 change: 0 additions & 1 deletion FA2sp/Ext/CFinalSunDlg/Hooks.ObjectBrowserControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <FA2PP.h>
#include <Helpers/Macro.h>
#include <GlobalVars.h>

#include "../../FA2sp.h"

Expand Down
4 changes: 1 addition & 3 deletions FA2sp/Ext/CHouses/Body.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "Body.h"

#include <GlobalVars.h>

#include "../../Helpers/STDHelpers.h"

#include "../../ExtraWindow/CAllieEditor/CAllieEditor.h"
Expand All @@ -20,7 +18,7 @@ void CHousesExt::UpdateComboboxContents()
while (this->CCBHouses.DeleteString(0) != -1);
while (this->CCBHumanHouse.DeleteString(0) != -1);

auto& doc = GlobalVars::INIFiles::CurrentDocument();
auto& doc = CINI::CurrentDocument();

}

Expand Down
6 changes: 2 additions & 4 deletions FA2sp/Ext/CIsoView/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
#include <Drawing.h>
#include <CINI.h>

#include <GlobalVars.h>

bool CIsoViewExt::DrawStructures = true;
bool CIsoViewExt::DrawInfantries = true;
bool CIsoViewExt::DrawUnits = true;
Expand Down Expand Up @@ -253,13 +251,13 @@ void CIsoViewExt::DrawCelltag(int X, int Y)
void CIsoViewExt::DrawWaypoint(int WPIndex, int X, int Y)
{
this->BltToBackBuffer(ImageDataMapHelper::GetImageDataFromMap("FLAG")->lpSurface, X, Y - 2, -1, -1);
if (auto pSection = GlobalVars::INIFiles::CurrentDocument->GetSection("Waypoints"))
if (auto pSection = CINI::CurrentDocument->GetSection("Waypoints"))
this->DrawText(X + 15, Y + 7, *pSection->GetKeyAt(WPIndex), ExtConfigs::Waypoint_Color);
}

void CIsoViewExt::DrawTube(CellData* pData, int X, int Y)
{
if (auto pTubeData = GlobalVars::CMapData->GetTubeData(pData->Tube))
if (auto pTubeData = CMapData::Instance->GetTubeData(pData->Tube))
{
auto suffix = pData->TubeDataIndex;
if (pData->TubeDataIndex >= 2)
Expand Down
15 changes: 7 additions & 8 deletions FA2sp/Ext/CIsoView/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "../../FA2sp.h"

#include <Drawing.h>
#include <GlobalVars.h>
#include <CINI.h>
#include <CMapData.h>

Expand Down Expand Up @@ -69,7 +68,7 @@ DEFINE_HOOK(469A69, CIsoView_UpdateOverlay_AutoConnect_2, 8)
return 0x469A71;
if (nOverlayIndex >= 0 && nOverlayIndex <= 255)
{
auto& rules = GlobalVars::INIFiles::Rules();
auto& rules = CINI::Rules();
ppmfc::CString key;
key.Format("%d", nOverlayIndex);
auto pRegName = rules.GetString("OverlayTypes", key, "");
Expand Down Expand Up @@ -205,8 +204,8 @@ DEFINE_HOOK(471162, CIsoView_Draw_PowerUp1Loc_PosFix, 5)
else
ArtID = BldID;

X += GlobalVars::INIFiles::Art->GetInteger(ArtID, "PowerUp1LocXX", 0);
Y += GlobalVars::INIFiles::Art->GetInteger(ArtID, "PowerUp1LocYY", 0);
X += CINI::Art->GetInteger(ArtID, "PowerUp1LocXX", 0);
Y += CINI::Art->GetInteger(ArtID, "PowerUp1LocYY", 0);

X += (pBldData->FullWidth - pData->FullWidth) / 2;
Y += (pBldData->FullHeight - pData->FullHeight) / 2;
Expand All @@ -233,8 +232,8 @@ DEFINE_HOOK(471980, CIsoView_Draw_PowerUp2Loc_PosFix, 5)
else
ArtID = BldID;

X += GlobalVars::INIFiles::Art->GetInteger(ArtID, "PowerUp2LocXX", 0);
Y += GlobalVars::INIFiles::Art->GetInteger(ArtID, "PowerUp2LocYY", 0);
X += CINI::Art->GetInteger(ArtID, "PowerUp2LocXX", 0);
Y += CINI::Art->GetInteger(ArtID, "PowerUp2LocYY", 0);

X += (pBldData->FullWidth - pData->FullWidth) / 2;
Y += (pBldData->FullHeight - pData->FullHeight) / 2;
Expand All @@ -261,8 +260,8 @@ DEFINE_HOOK(4720D3, CIsoView_Draw_PowerUp3Loc_PosFix, 5)
else
ArtID = BldID;

X += GlobalVars::INIFiles::Art->GetInteger(ArtID, "PowerUp3LocXX", 0);
Y += GlobalVars::INIFiles::Art->GetInteger(ArtID, "PowerUp3LocYY", 0);
X += CINI::Art->GetInteger(ArtID, "PowerUp3LocXX", 0);
Y += CINI::Art->GetInteger(ArtID, "PowerUp3LocYY", 0);

X += (pBldData->FullWidth - pData->FullWidth) / 2;
Y += (pBldData->FullHeight - pData->FullHeight) / 2;
Expand Down
Loading

0 comments on commit 9b7e1f7

Please sign in to comment.