You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
10
10
</details>
11
11
12
12
<details><summary><b>Changed</b></summary>
13
+
14
+
- Unofficial modules (mods) now use [Semantic Versioning](https://semver.org/) to check which version of the game they target.
15
+
As such, the `Index.ini` property `SupportedGameVersion` must now be a valid semantic version number. The game version has also been updated to match this standard.
16
+
17
+
The `SupportedGameVersion` version number must be of the form `X.Y.z`, where:
18
+
19
+
`X` matches the major version of the game,
20
+
`Y` is the minimum minor version of the game the mod requires,
21
+
`z` is the patch number, which is currently not enforced.
22
+
23
+
Mods published for any development builds must match that development version exactly.
Copy file name to clipboardExpand all lines: System/DataModule.cpp
+46-12Lines changed: 46 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,9 @@
2
2
#include"PresetMan.h"
3
3
#include"SceneMan.h"
4
4
#include"LuaMan.h"
5
+
#include"GameVersion.h"
6
+
7
+
#include<System/Semver200/semver200.h>
5
8
6
9
namespaceRTE {
7
10
@@ -15,7 +18,7 @@ namespace RTE {
15
18
m_FriendlyName.clear();
16
19
m_Author.clear();
17
20
m_Description.clear();
18
-
m_SupportedGameVersion.clear();
21
+
m_SupportedGameVersion = nullptr;
19
22
m_Version = 1;
20
23
m_ModuleID = -1;
21
24
m_IconFile.Reset();
@@ -49,18 +52,14 @@ namespace RTE {
49
52
// NOTE: This looks for the MergedIndex.ini generated by the index merger tool. The tool is mostly superseded by disabling loading visuals, but still provides some benefit.
50
53
if (std::filesystem::exists(mergedIndexPath)) { indexPath = mergedIndexPath; }
51
54
55
+
// If the module is a mod, read only its `index.ini` to validate its SupportedGameVersion.
RTEAssert(!m_SupportedGameVersion.empty(), m_FileName + " does not specify a supported Cortex Command version, so it is not compatible with this version of Cortex Command (" + c_MajorGameVersion + c_MinorGameVersion + ").\nPlease contact the mod author or ask for help in the CCCP discord server.");
60
-
RTEAssert(supportedMinorGameVersion <= c_MinorGameVersion, m_FileName + " supports Cortex Command version " + m_SupportedGameVersion + ", which is ahead of this version of Cortex Command (" + c_MajorGameVersion + c_MinorGameVersion + ").\nPlease update your game to the newest version to use this mod.");
61
-
RTEAbort(m_FileName + " supports Cortex Command version " + m_SupportedGameVersion + ", so it is not compatible with this version of Cortex Command (" + c_MajorGameVersion + c_MinorGameVersion + ").\nPlease contact the mod author or ask for help in the CCCP discord server.");
62
-
}
63
-
64
63
// Print an empty line to separate the end of a module from the beginning of the next one in the loading progress log.
65
64
if (progressCallback) { progressCallback("", true); }
66
65
@@ -95,6 +94,7 @@ namespace RTE {
95
94
for (const PresetEntry &preset : m_PresetList){
96
95
delete preset.m_EntityPreset;
97
96
}
97
+
delete m_SupportedGameVersion;
98
98
Clear();
99
99
}
100
100
@@ -145,7 +145,16 @@ namespace RTE {
145
145
reader >> m_IsMerchant;
146
146
if (m_IsMerchant) { m_IsFaction = false; }
147
147
} elseif (propName == "SupportedGameVersion") {
148
-
reader >> m_SupportedGameVersion;
148
+
std::string versionText;
149
+
reader >> versionText;
150
+
// TODO: Need to proceed reading the includes after ReadModuleProperties so we don't read the properties again when fully creating.
reader.ReportError("Couldn't parse the supported game version from the value provided: \"" + versionText + "\"!\nThe supported game version must be a valid semantic version number.\n");
staticconst std::string contactAuthor = "Please contact the mod author or ask for help in the CCCP discord server.";
499
+
500
+
RTEAssert(*m_SupportedGameVersion != version::Semver200_version(), m_FileName + " does not specify a supported Cortex Command version, so it is not compatible with this version of Cortex Command (" + c_GameVersion.str() + ").\n\n" + contactAuthor);
RTEAssert(!modulePrereleaseVersionMismatch && !moduleBuildVersionMismatch, m_FileName + " was developed for pre-release build of Cortex Command v" + m_SupportedGameVersion->str() + ", this game version (v" + c_GameVersion.str() + ") is incompatible.\n\nMods developed on a pre-release must match the game version exactly.\n" + contactAuthor);
RTEAssert(!gamePrereleaseVersionMismatch && !gameBuildVersionMismatch, m_FileName + " was developed for Cortex Command v" + m_SupportedGameVersion->str() + ", this pre-release version of the game (v" + c_GameVersion.str() + ") may not support it.\n\nMods must match the game version exactly to use pre-release builds.\n" + contactAuthor);
509
+
510
+
// Game engine is the same major version as the Module
RTEAssert(majorVersionMatch && minorVersionInRange, m_FileName + " was developed for Cortex Command v" + m_SupportedGameVersion->str() + ", so this version of Cortex Command (v" + c_GameVersion.str() + ") may not support it.\n" + contactAuthor);
Copy file name to clipboardExpand all lines: System/DataModule.h
+10-1Lines changed: 10 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,10 @@
7
7
//struct DATAFILE; // DataFile loading not implemented.
8
8
structBITMAP;
9
9
10
+
namespaceversion {
11
+
classSemver200_version;
12
+
}
13
+
10
14
namespaceRTE {
11
15
12
16
classEntity;
@@ -320,7 +324,7 @@ namespace RTE {
320
324
std::string m_ScriptPath; //!< Path to script to execute when this module is loaded.
321
325
bool m_IsFaction; //!< Whether this data module is considered a faction.
322
326
bool m_IsMerchant; //!< Whether this data module is considered a merchant.
323
-
std::string m_SupportedGameVersion; //!< Game version this DataModule supports. Needs to match exactly for this DataModule to be allowed. Base DataModules don't need this.
327
+
version::Semver200_version *m_SupportedGameVersion; //!< Game version this DataModule supports. Needs to satisfy Caret Version Range for this DataModule to be allowed. Base DataModules don't need this.
324
328
int m_Version; //!< Version number, starting with 1.
325
329
int m_ModuleID; //!< ID number assigned to this upon loading, for internal use only, don't reflect in ini's.
326
330
@@ -355,6 +359,11 @@ namespace RTE {
355
359
staticconst std::string c_ClassName; //!< A string with the friendly-formatted type name of this object.
356
360
357
361
#pragma region INI Handling
362
+
/// <summary>
363
+
/// Checks the module's supported game version against the current game version to ensure compatibility.
364
+
/// </summary>
365
+
voidCheckSupportedGameVersion() const;
366
+
358
367
/// <summary>
359
368
/// If ScanFolderContents is enabled in this DataModule's Index.ini, looks for any ini files in the top-level directory of the module and reads all of them in alphabetical order.
0 commit comments