Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

refactor(gameengine): remove mod support

Olcay Seygan7d2262990b66
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ArchiveFileSystem.h b/GeneralsMD/Code/GameEngine/Include/Common/ArchiveFileSystem.h
index 5d8c1fe40..10d319906 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/ArchiveFileSystem.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/ArchiveFileSystem.h
@@ -145,10 +145,6 @@ public:
};
-/// openFile reads a merged mod's own copy of one of our interface image sheets by this name in front of
-/// its path (getModUICopies)
-#define MOD_UI_COPY "ModUI~"
-
class ArchiveFileSystem : public SubsystemInterface
{
public:
@@ -177,25 +173,6 @@ class ArchiveFileSystem : public SubsystemInterface
// Unprotected this for copy-protection routines
AsciiString getArchiveFilenameForFile(const AsciiString& filename) const;
- void loadMods( void );
- /// the -mod or -modpatch path, exactly as given, that loadMods loaded this archive for; empty for retail's
- AsciiString modLayerOf( const AsciiString& archiveFilename ) const;
-
- /// FileSystem::setFocus: a -mod index sees that mod's archives alone. FILE_FOCUS_ALL is the merged
- /// tree, which -modfactions leaves as retail's and FILE_FOCUS_RETAIL always is.
- void setFocus( Int focus ) { m_focus = focus; }
-
- /// -modfactions: mod's own copy of filename, whatever the focus (FileSystem::splitModName)
- File* openModFile( Int mod, const AsciiString& filename, Int access );
- Bool doesModFileExist( Int mod, const AsciiString& filename ) const;
- Bool getModFileInfo( Int mod, const AsciiString& filename, FileInfo *fileInfo ) const;
-
- /// a texture one of our interface image sheets names (FileSystem::isForkUIPath); a mod's copy never wins
- Bool isOurUITexture( const AsciiString& filename ) const;
- /// "ModUI~<path>" for each interface image sheet in directory that a merged mod brought its own copy
- /// of: openFile reads the mod's copy by that name, so ImageCollection::load gets the images only the
- /// mod has before ours take every name both define
- void getModUICopies( const AsciiString& directory, std::vector<AsciiString> &names ) const;
/// the folder init loaded the base game's archives from, trailing slash included; empty when they sit
/// beside the exe or nowhere. The base campaign movies are loose files in its Data\Movies.
@@ -203,24 +180,10 @@ class ArchiveFileSystem : public SubsystemInterface
protected:
virtual void loadIntoDirectoryTree(const ArchiveFile *archiveFile, const AsciiString& archiveFilename, Bool overwrite = FALSE ); ///< load the archive file's header information and apply it to the global archive directory tree.
- void addToTree(ArchivedDirectoryInfo &root, const ArchiveFile *archiveFile, const AsciiString& archiveFilename, Bool overwrite);
void prioritizeLargerFiles(const AsciiString& directory, const char *inferiorArchive, const char *superiorArchive); ///< where two archives claim the same file in this directory, keep the bigger copy.
- void collectUITextures( void ); ///< fills m_uiTextures before loadMods merges a mod in
- void keepModsApart( size_t modCount ); ///< one tree per -mod, and the merged one left as retail's
- void addModArchive( Int mod, ArchiveFile *archiveFile, const AsciiString& archiveFilename ); ///< over the merged tree, or into the mod's own when kept apart
- const ArchivedDirectoryInfo & focusedRoot( void ) const;
- static AsciiString archiveInTree( const ArchivedDirectoryInfo &root, const AsciiString& filename );
- Bool inFocus( const AsciiString& archiveFilename ) const;
-
ArchiveFileMap m_archiveFileMap;
ArchivedDirectoryInfo m_rootDirectory;
- std::vector<ArchivedDirectoryInfo> m_modRoots; ///< -modfactions: each -mod's archives alone, in its own order
- std::map<AsciiString, Int> m_archiveMod; ///< -modfactions: archive -> -mod index; retail's are not in it
- std::map<AsciiString, AsciiString> m_archiveLayer; ///< archive -> the -mod or -modpatch path that loaded it (modLayerOf)
- std::map<AsciiString, AsciiString> m_modUICopies; ///< lower-case interface image sheet -> the last mod archive with its own copy
- std::set<AsciiString> m_uiTextures; ///< lower-case "art\textures\..." our interface image sheets name
- Int m_focus;
};
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/AudioEventInfo.h b/GeneralsMD/Code/GameEngine/Include/Common/AudioEventInfo.h
index 3e062b561..fd8eff2ae 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/AudioEventInfo.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/AudioEventInfo.h
@@ -121,7 +121,7 @@ public:
AudioType m_soundType; // This should be either Music, Streaming or SoundEffect
- /// Music Follows the Fight (MusicManager) for a mod's own music: a MusicTrack with
+ /// Music Follows the Fight (MusicManager) for music outside the hand table: a MusicTrack with
/// `MusicMood = Calm`, `Tense` or `Battle` and `MusicSide = <playlist>` joins that playlist at that
/// mood, over the retail table where it names a retail track. The playlist is whichever side's
/// tracks the skirmish scripts play; an untagged track (0, `None`) is left to the table or to them.
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/CommandStore.h b/GeneralsMD/Code/GameEngine/Include/Common/CommandStore.h
index 3b1306ecd..8823da011 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/CommandStore.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/CommandStore.h
@@ -49,7 +49,7 @@ public:
CommandStore( void );
virtual ~CommandStore( void );
- void init( void ); ///< load CommandButton.ini, CommandSet.ini, the mods' copies and CommandSetReforged.ini
+ void init( void ); ///< load CommandButton.ini, CommandSet.ini and CommandSetReforged.ini
void reset( void ); ///< remove the map's overrides
void update( void ) { }
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/FileSystem.h b/GeneralsMD/Code/GameEngine/Include/Common/FileSystem.h
index 42a943b6d..184d0f30c 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/FileSystem.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/FileSystem.h
@@ -103,8 +103,6 @@ typedef FilenameList::iterator FilenameListIter;
#define TEST_TGA_DIR_PATH "../TestArt/" ///< .tga texture files live here
#endif
-enum { FILE_FOCUS_ALL = -2, FILE_FOCUS_RETAIL = -1 }; ///< FileSystem::setFocus; 0 and up is a -mod index
-
struct FileInfo {
Int sizeHigh;
Int sizeLow;
@@ -142,34 +140,6 @@ public:
void getFileListInDirectory(const AsciiString& directory, const AsciiString& searchName, FilenameList &filenameList, Bool searchSubdirectories) const; ///< search the given directory for files matching the searchName (egs. *.ini, *.rep). Possibly search subdirectories.
Bool getFileInfo(const AsciiString& filename, FileInfo *fileInfo) const; ///< fills in the FileInfo struct for the file given. returns TRUE if successful.
- /// "<mod dir><filename>" when the last -mod that has this game path has it loose, else empty. When
- /// that mod has it in an archive instead, *inModArchive says so. Either copy beats Run's loose files
- /// and every archive that is not a mod's - except a fork-owned file the install folder holds loose,
- /// which no mod replaces.
- AsciiString modLooseFile(const AsciiString& filename, Bool *inModArchive = NULL) const;
-
- /// TRUE for a game path the fork ships loose and no mod replaces (BalanceReforged.ini, Patch.str, its
- /// .wnd layouts ...); see the definition for how the set is decided.
- static Bool isForkOwnedPath(const AsciiString& filename);
-
- /// TRUE for a game path that draws the game's interface (a .wnd, Language.ini's fonts, the shell's
- /// image sheets): a merged mod never replaces it, the copy retail or the fork has wins
- static Bool isForkUIPath(const AsciiString& filename);
-
- /// TRUE for a game path under "Maps\": the maps are always ours, a mod's own maps are never listed or
- /// loaded, so every machine in a match reads the same map whatever mods it runs
- static Bool isMapPath(const AsciiString& filename);
-
- /// -modfactions: FILE_FOCUS_RETAIL or a -mod index makes every read see that set of files alone,
- /// so retail and each mod load their factions one after another; FILE_FOCUS_ALL is the merged view.
- void setFocus(Int focus);
- Int getFocus() const { return s_focus; }
-
- /// -modfactions: a file name starting "M<n>~" ("Art\W3D\M2~AVRanger.w3d") is mod n's copy and nothing
- /// else; the art code falls back to the plain name itself. TRUE for such a name, with *mod the -mod
- /// index and *bare the path without the prefix.
- static Bool splitModName(const AsciiString& filename, Int *mod, AsciiString *bare);
-
Bool createDirectory(AsciiString directory); ///< create a directory of the given name.
/// language when Data\<language>\Language.ini is loose or in an archive, otherwise the first
@@ -183,15 +153,10 @@ public:
void loadMusicFilesFromCD();
void unloadMusicFilesFromCD();
protected:
- AsciiString focusedLooseFile(const AsciiString& filename) const; ///< the loose copy the focus sees, else empty
- AsciiString modFolderFile(Int mod, const AsciiString& filename) const; ///< "<mod folder><filename>" when it is there, else empty
mutable std::map<unsigned,bool> m_fileExist;
/// m_fileExist is asked from the main thread and from the logic thread's model loads in an overlapped
/// tick (and the texture loader's, if it ever runs): two inserts at once corrupt the tree and the heap
mutable std::mutex m_fileExistLock;
- // static: GlobalData's constructor reads files through a TheFileSystem that a few engine tests leave
- // NULL, and openFile has always answered NULL there without touching the object
- static Int s_focus;
};
extern FileSystem* TheFileSystem;
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameMusic.h b/GeneralsMD/Code/GameEngine/Include/Common/GameMusic.h
index 46f2d5f00..772520d0e 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/GameMusic.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/GameMusic.h
@@ -111,7 +111,7 @@ public:
* or by half when it is the local player's own unit wherever it stands. Those add to an intensity
* that halves about every three and a half seconds, so it reads roughly as weighted shots a second.
* Above a threshold the music moves from calm to tense to battle, each a crossfade to a track of
- * the side's own playlist chosen by a hand table (TheDynamicTracks) or, for a mod's music, by the
+ * the side's own playlist chosen by a hand table (TheDynamicTracks) or, for any other track, by the
* MusicMood and MusicSide its Music.ini gives each track, and comes back down once the
* fight has been over for a few seconds and the track has had its minimum time. While tense or
* battle music plays, the skirmish scripts' own track changes are held; back at calm, they choose
@@ -168,7 +168,7 @@ class MusicManager
Bool m_issuing; ///< our own stop and play are going through
Bool m_stopHeld;
AudioHandle m_heldStop; ///< a script's stop, kept until the play after it says whose track it was
- AsciiString m_side; ///< "USA", "CHI", "GLA" or a mod's MusicSide: whose playlist
+ AsciiString m_side; ///< "USA", "CHI", "GLA" or a track's MusicSide: whose playlist
AsciiString m_track; ///< the track we last started
AudioEventRTS *m_fadeEvent; ///< the device's own copy of the track fading in, NULL when none
AudioHandle m_fadeHandle; ///< its handle: the copy is only touched while the device still has it
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
index e80a8f7c2..b2d236792 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
@@ -596,7 +596,6 @@ public:
UnsignedInt m_iniCRC; ///< CRC of important INI files
UnsignedInt m_exeCRC; ///< CRC of the executable
void computeExeCRC( void ); ///< m_exeCRC from the build fingerprint, the version and the two scb as they resolve now
- UnsignedInt m_baseExeCRC; ///< m_exeCRC before any -mod mounted: the build without its mods, for the LAN mod check
BodyDamageType m_movementPenaltyDamageState; ///< at this body damage state, we have movement penalties
@@ -764,13 +763,6 @@ public:
Bool m_isBreakableMovie; ///< if we enter a breakable movie, set this flag
Bool m_breakTheMovie; ///< The user has hit escape!
- std::vector<AsciiString> m_mods; ///< every -mod in command-line order, later wins: a folder ends in '\', anything else is a .big
- AsciiString m_modName; ///< UTF-8, each mod's "<name> <version>" from its mod.json (else the folder or archive name), joined by ", " in m_mods order; empty without -mod
- std::vector<AsciiString> m_modNames; ///< UTF-8, each mod's mod.json "name" (else the folder or archive name), in m_mods order
- std::vector<Bool> m_modIsPatch; ///< -modpatch: TRUE for each m_mods entry given as a patch; with no full -mod the patches stack as plain mods
- std::vector< std::vector<AsciiString> > m_modPatches; ///< -modfactions: the -modpatch folders over each m_mods[n], later wins
- std::vector<AsciiString> m_retailPatches; ///< -modfactions: the -modpatch folders given before any -mod, over retail's files
- Bool m_modFactions; ///< any full -mod given: every mod's factions load beside retail's under "M<n>~" names (ModNamespace). "-modfactions" in a comment is this; the switch is gone
//-allAdvice feature
//Bool m_allAdvice;
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/INI.h b/GeneralsMD/Code/GameEngine/Include/Common/INI.h
index 5761b276d..83d2fae34 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/INI.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/INI.h
@@ -36,9 +36,6 @@
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
#include <stddef.h> // for offsetof, which we don't use but everyone who includes us does
-#include <set>
-#include <string>
-#include <vector>
#include "Common/STLTypedefs.h"
#include "Common/AsciiString.h"
#include "Common/GameCommon.h"
@@ -66,9 +63,6 @@ enum INILoadType
enum
{
INI_MAX_CHARS_PER_LINE = 1028, ///< max characters per line entry in any ini file
- /// a line once -modfactions has put "M<n>~" before its names: at most one name every two characters,
- /// four characters of prefix each up to mod 99, so a full line can triple
- INI_MAX_CHARS_PER_PREFIXED_LINE = INI_MAX_CHARS_PER_LINE * 3,
};
//-------------------------------------------------------------------------------------------------
@@ -170,75 +164,6 @@ public:
typedef void (*INIBlockParse)( INI *ini );
typedef void (*BuildMultiIniFieldProc)(MultiIniFieldParse& p);
-//-------------------------------------------------------------------------------------------------
-/** -modfactions: every name a mod defines is read as "M<n>~name" while that mod's files load, so two
- * mods and retail can each have their own FactionAmerica, Ranger and Command_ConstructBarracks side
- * by side. A name the mod does not define stays retail's. The rewrite is of the text, before the
- * INI checksum sees it, so it is the same on every machine that has the same mods in the same order. */
-//-------------------------------------------------------------------------------------------------
-enum ModNameType
-{
- MODNAME_OBJECT, MODNAME_WEAPON, MODNAME_ARMOR, MODNAME_DAMAGEFX, MODNAME_UPGRADE, MODNAME_SCIENCE,
- MODNAME_SPECIALPOWER, MODNAME_COMMANDSET, MODNAME_COMMANDBUTTON, MODNAME_FXLIST, MODNAME_OCL,
- MODNAME_PARTICLESYSTEM, MODNAME_LOCOMOTOR, MODNAME_PLAYERTEMPLATE, MODNAME_MAPPEDIMAGE,
- MODNAME_AUDIOEVENT, MODNAME_CRATE,
- MODNAME_COUNT
-};
-
-class ModNamespace
-{
-public:
- ModNamespace() : m_active( -1 ) {}
-
- void scanMods( void ); ///< every -mod's faction files, each under its own FileSystem focus
- void scanLine( Int mod, const char *line ); ///< a block header names one of the mod's own; "Side = X" keeps X out
- void finishScan( Int mod ); ///< drop the side names, which the engine compares as text
- /// a file the mod ships under Art\W3D, Art\Textures or Data\Audio; a word naming it gets the prefix too,
- /// and the FileSystem and WW3D then serve the mod's own copy
- void addAsset( Int mod, const char *fileName );
- void setActive( Int mod ) { m_active = mod; } ///< -1: nothing is rewritten
- Int getActive( void ) const { return m_active; }
- Int getNameCount( Int mod ) const { return (Int)m_mods[ mod ].all.size(); }
-
- /// rewrite the active mod's names, and in a file field the files it ships, in a comment-free line in
- /// place, every word but the first; FALSE when the result would not fit capacity bytes
- Bool rewriteLine( char *line, size_t capacity ) const;
- /// the same for the labels in the mod's own string table. This runs after the INI checksum: the table
- /// is the player's language, and two installs in different languages must still agree.
- Bool rewriteLabels( char *line, size_t capacity ) const;
- /// "M<n>~X" where mod n has no `type` called X is a reference to retail's X: TRUE and *retailName
- /// set. Finders ask this on a miss, so a definition of the mod's own X never falls through to retail's.
- Bool findRetailName( const AsciiString &name, ModNameType type, AsciiString *retailName ) const;
- Bool findRetailKey( NameKeyType key, ModNameType type, NameKeyType *retailKey ) const;
- /// "M<n>~name" when mod n defines a `type` called name, else name: how a mod's own data that is not INI
- /// (its SkirmishScripts.scb) names its things
- AsciiString modName( Int mod, ModNameType type, const AsciiString &name ) const;
- /// where the file name in a path-shaped word starts, past its last '\\' or '/': "Sub\\x.mp3" gives 4.
- /// The prefix goes there, since FileSystem::splitModName reads it on the last part only
- static size_t lastPathPart( const std::string &word );
-
- static const char *const FactionFiles[]; ///< what scanMods reads and the mod passes load, NULL-ended; no ".ini" is a directory
-
-private:
- struct Names
- {
- std::set<std::string> all;
- std::set<std::string> byType[ MODNAME_COUNT ];
- std::set<std::string> sides;
- std::set<std::string> assets; ///< lowercase: w3d and audio by base name, textures by file name
- };
- static Bool isAsset( const Names &names, const std::string &word );
- static Bool isAssetField( const std::string &field ); ///< a field whose value names a model, animation, texture or sound file
- static size_t namedAfterKeyword( const std::string &word ); ///< "OCL:X" gives 4, where the name starts; 0 for any other word
- typedef Bool (ModNamespace::*WordTest)( const std::string &word, Bool assetField ) const;
- Bool isNameOrAsset( const std::string &word, Bool assetField ) const;
- Bool isModLabel( const std::string &word, Bool assetField ) const;
- Bool prefixWords( char *line, size_t capacity, WordTest test ) const;
- std::vector<Names> m_mods;
- Int m_active;
-};
-extern ModNamespace TheModNamespace;
-
//-------------------------------------------------------------------------------------------------
/** INI Reader interface */
//-------------------------------------------------------------------------------------------------
@@ -254,8 +179,6 @@ public:
void loadDirectory( AsciiString dirName, Bool subdirs, INILoadType loadType, Xfer *pXfer ); ///< load directory of INI files
void load( AsciiString filename, INILoadType loadType, Xfer *pXfer ); ///< load INI file
- /// -modfactions: load path (a directory when directory) from each -mod in turn, under its focus and its names
- static void loadModPasses( const char *path, Xfer *pXfer, Bool directory = FALSE );
static Bool isDeclarationOfType( AsciiString blockType, AsciiString blockName, char *bufferToCheck );
static Bool isEndOfBlock( char *bufferToCheck );
@@ -329,30 +252,17 @@ public:
inline INILoadType getLoadType( void ) const { return m_loadType; }
inline UnsignedInt getLineNum( void ) const { return m_lineNum; }
- /** A map.ini is written by a map maker, often against another mod's objects, and one field
- this game does not know used to end the match before it started. Set, an unknown field
+ /** A map.ini is written by a map maker, often against objects this game does not have, and one
+ field this game does not know used to end the match before it started. Set, an unknown field
name is logged and its line skipped instead of throwing. */
inline void setSkipUnknownFields( Bool skip ) { m_skipUnknownFields = skip; }
- /** A patch INI loaded over a mod can name a special power or an object creation list the mod
- does not have. The reference raises this, and ThingTemplate::parseModuleName drops the module
+ /** A patch INI can name a special power or an object creation list the data it lands on does
+ not have. The reference raises this, and ThingTemplate::parseModuleName drops the module
it was read into. */
inline void setMissingReference( Bool missing ) { m_missingReference = missing; }
inline Bool hasMissingReference( void ) const { return m_missingReference; }
- /** -modfactions prefixes every word a mod names a block with, and a mod can name one after an
- engine word: The Power of the West has a ParticleSystem "Explosion", so "DamageType = Explosion"
- arrived as "M2~Explosion". A fixed list of names (an enum, Yes/No) is never a mod's, so its
- scanners read past the prefix. No retail name holds a '~'. */
- static const char *withoutModPrefix( const char *token )
- {
- const char *p = token;
- if (*p++ != 'M' || *p < '0' || *p > '9')
- return token;
- while (*p >= '0' && *p <= '9')
- ++p;
- return *p == '~' ? p + 1 : token;
- }
inline const char *getSeps( void ) const { return m_seps; }
inline const char *getSepsPercent( void ) const { return m_sepsPercent; }
inline const char *getSepsColon( void ) const { return m_sepsColon; }
@@ -524,7 +434,7 @@ protected:
AsciiString m_filename; ///< filename of file currently loading
INILoadType m_loadType; ///< load time for current file
UnsignedInt m_lineNum; ///< current line number that's been read
- char m_buffer[ INI_MAX_CHARS_PER_PREFIXED_LINE+1 ];///< one line of the file, room for its mod prefixes
+ char m_buffer[ INI_MAX_CHARS_PER_LINE+1 ];///< buffer to read file contents into
const char *m_seps; ///< for strtok parsing
const char *m_sepsPercent; ///< m_seps with percent delimiter as well
const char *m_sepsColon; ///< m_seps with colon delimiter as well
@@ -534,7 +444,7 @@ protected:
Bool m_skipUnknownFields; ///< log and skip an unknown field instead of throwing
Bool m_missingReference; ///< a patch named a special power or OCL that does not exist
#if defined(_DEBUG) || defined(_INTERNAL)
- char m_curBlockStart[ INI_MAX_CHARS_PER_PREFIXED_LINE+1 ]; ///< first line of cur block, a copy of m_buffer
+ char m_curBlockStart[ INI_MAX_CHARS_PER_LINE+1 ]; ///< first line of cur block
#endif
};
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/PlayerTemplate.h b/GeneralsMD/Code/GameEngine/Include/Common/PlayerTemplate.h
index 3961c755c..06ae9bd06 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/PlayerTemplate.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/PlayerTemplate.h
@@ -79,9 +79,6 @@ public:
PlayerTemplate();
inline void setNameKey(NameKeyType namekey) { m_nameKey = namekey; }
- /// -modfactions: the -mod this template came from, -1 for retail's own
- inline void setModIndex(Int mod) { m_modIndex = mod; }
- inline Int getModIndex() const { return m_modIndex; }
inline NameKeyType getNameKey() const { DEBUG_ASSERTCRASH(m_nameKey != NAMEKEY_INVALID, ("bad namekey")); return m_nameKey; }
inline AsciiString getName() const { return KEYNAME(m_nameKey); }
@@ -144,9 +141,8 @@ public:
AsciiString getScoreScreenMusic() const { return m_scoreScreenMusic; }
inline Bool isOldFaction( void ) const { return m_oldFaction; }
- /// a plain Random never draws it; a lobby's own pick of the Random pool may still tick it in. A mod's
- /// faction is always out of a plain Random: it plays only when somebody picks it.
- inline Bool isRandomExcluded( void ) const { return m_randomExcluded || m_modIndex >= 0; }
+ /// a plain Random never draws it; a lobby's own pick of the Random pool may still tick it in
+ inline Bool isRandomExcluded( void ) const { return m_randomExcluded; }
static const FieldParse* getFieldParse();
@@ -164,7 +160,6 @@ private:
friend class PlayerTemplateStore; ///< postProcessLoad empties a start template the loaded objects lack
NameKeyType m_nameKey;
- Int m_modIndex;
UnicodeString m_displayName;
AsciiString m_side, m_baseSide;
Handicap m_handicap; ///< initial baseline for Player capabilities
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h b/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h
index 9393c537e..362c6214e 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/ThingTemplate.h
@@ -649,9 +649,6 @@ public:
Bool isEquivalentTo(const ThingTemplate* tt) const;
- /// the -mod whose army this is, read off the "M<n>~" on its name; -1 for retail's
- Int getModIndex() const;
-
UnsignedByte getCrushableLevel() const { return m_crushableLevel; }
UnsignedByte getCrusherLevel() const { return m_crusherLevel; }
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Upgrade.h b/GeneralsMD/Code/GameEngine/Include/Common/Upgrade.h
index 3cb9b0d92..a224dfe4d 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/Upgrade.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/Upgrade.h
@@ -56,11 +56,9 @@ enum UpgradeStatusType : Int
};
//The maximum number of upgrades.
-// How many distinct upgrades the game may know about. A mod that adds its own runs into this, and
-// the failure is silent - the mask simply has no bit left for the new one. The mask is a bit
-// field, so raising it costs 48 bytes per player and per object that carries one. 512 ran out under
-// -modfactions with five mods (Contra, ShockWave, Shockwave Chaos, The End of Days and Tiberian Dawn
-// Redux) at The End of Days' upgrade 513, about 700 in all.
+// How many distinct upgrades the game may know about. Data that adds more runs into this, and
+// newUpgrade refuses the one past the end. The mask is a bit field, so raising it costs 48 bytes
+// per player and per object that carries one.
#define UPGRADE_MAX_COUNT 1024
typedef BitFlags<UPGRADE_MAX_COUNT, 6> UpgradeMaskType;
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/version.h b/GeneralsMD/Code/GameEngine/Include/Common/version.h
index ff007581e..a66de2342 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/version.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/version.h
@@ -43,8 +43,7 @@ public:
UnsignedInt getVersionNumber( void ); ///< Return a 4-byte integer suitable for WOLAPI
AsciiString getAsciiVersion( void ); ///< Return a human-readable version number
AsciiString getReleaseVersion( void ); ///< The fork's release number as the tags write it, "v2.6.0"
- UnicodeString getUnicodeVersion( void ); ///< Return a human-readable version number, with " [<mod>]" under -mod
- UnicodeString getUnicodeModName( void ); ///< TheGlobalData->m_modName as text, empty without -mod
+ UnicodeString getUnicodeVersion( void ); ///< Return a human-readable version number
UnicodeString getFullUnicodeVersion( void ); ///< Return a human-readable version number
AsciiString getAsciiBuildTime( void ); ///< Return a formated date/time string for build time
UnicodeString getUnicodeBuildTime( void ); ///< Return a formated date/time string for build time
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
index 547784a94..4d82f3388 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h
@@ -505,31 +505,6 @@ Int ControlBar_commandGroup( const class CommandButton *command );
* what does not fit goes on in the next row down with room, then in the rows above. */
Bool ControlBar_commandPlaces( const Int *types, const Int *groups, const Int *pinned, Int count, Int *places );
-/** Which command set slot each of `count` bar windows shows, -1 for none: `types` is what each slot
- * holds, GUI_COMMAND_NONE for an empty one, and `windowed` whether ControlBar.wnd has that slot's
- * window. A slot with a window shows itself. A mod drawn for a bigger bar (Contra's eighteen, whose
- * units keep attack move, guard and stop in 15, 17 and 18) names slots our fourteen have no window
- * for; such a button moves to an empty window, the three orders to Zero Hour's own 11, 13 and 14
- * when free, anything else to the first empty one. */
-void ControlBar_fitCommandSlots( const Int *types, const Bool *windowed, Int count, Int *shown );
-
-enum
-{
- COMMAND_GRID_NARROW_SLOTS = 14, ///< ButtonCommand01 to 14, the bar every set of Zero Hour's fits
- COMMAND_GRID_WIDE_STEP = 92, ///< one column of two cells, at the 1920x1080 the bar was drawn at
-};
-
-/** TRUE when one command set, `types` as ControlBar_fitCommandSlots takes them, shows more buttons
- * than the fourteen-slot grid has windows for, so ControlBar_fitCommandSlots would have to drop
- * some: a mod drawn for ControlBar Pro's eighteen (Contra's edit). A promotion screen's set, the
- * only one of Zero Hour's with a slot past 14, is laid out on its own screen and never counts. */
-Bool ControlBar_needsWideCommandGrid( const Int *types, Int count );
-
-/** Whether the bar uses its window for `slot`. spareWindows: our layout's 15 to 18 stand hidden past
- * the plate, which a mod's own ControlBar.wnd does not do; wide: ControlBar::isCommandGridWide. Our
- * narrow bar is the only one that leaves windows out. */
-Bool ControlBar_usesCommandWindow( Int slot, Bool spareWindows, Bool wide );
-
/** The page's keys past attack, hold position and move, which no command set has a button for either. */
enum OrderKeyExtra
{
@@ -1058,11 +1033,6 @@ public:
* set - because it remembers both the authored rectangle and the one it last handed out. */
void layoutPanels( void );
- /** TRUE when the loaded command sets need all eighteen command windows and our ControlBar.wnd
- * is the layout: the grid is then nine columns, one more at each end of the plate, and the
- * scheme draws its painting's <name>Wide copy. Fixed when the windows are looked up. */
- Bool isCommandGridWide( void ) const { return m_commandGridWide; }
-
/// Whether command set slot `slot` has a window on this bar, for what lays a set out without an object.
Bool hasCommandWindow( Int slot ) const { return m_commandWindows[ slot ] != NULL; }
@@ -1255,7 +1225,6 @@ protected:
IRegion2D m_panelRect[ CB_PANEL_COUNT ]; ///< screen rect of each panel, filled by layoutPanels()
ICoord2D m_panelOrigin; ///< where the frame was put, so the plates can follow it
- Bool m_commandGridWide; ///< see isCommandGridWide
Bool m_UIDirty; ///< the context UI must be re-evaluated
ControlBarSchemeManager *m_controlBarSchemeManager; ///< The Scheme singleton
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.h
index ccab0b354..f7c2eed21 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarScheme.h
@@ -81,7 +81,6 @@ public:
ICoord2D m_position; ///< the position we'll draw it at
ICoord2D m_size; ///< the size of the image needed when we draw it
Image *m_image; ///< the actual pointer to the mapped image
- const Image *m_wideImage; ///< "<image>Wide", drawn while the command grid is eighteen windows wide; NULL when none is mapped
// m_layer is where the image will get drawn, everything in layer 0-2 gets drawn during the forground draw
// the layers 3-5 gets drawn during the background draw
@@ -379,8 +378,6 @@ private:
//-----------------------------------------------------------------------------
// EXTERNALS //////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
-/// a mod's faction, which gets our American power tray (owner's call)
-Bool ControlBarIsModFaction( const PlayerTemplate *pt );
/// a side's picture of one family, prefix SSObserver, SSScore, FactionPicker or Gameinfo: the prefix and
/// the template's name (less "Faction" and "General" but for FactionPicker: SSScoreAmericaLaser,
/// FactionPickerFactionAmericaLaserGeneral), else the prefix and the base name of the country its base
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameText.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameText.h
index 018ba3560..ff17f2896 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameText.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameText.h
@@ -88,14 +88,6 @@ class GameTextInterface : public SubsystemInterface
/// the letter after '&' in the English text of this label (the game's own table and Patch.str,
/// before any translation), or 0: Classic's command keys are the English ones in every language
virtual WideChar fetchEnglishHotKey( const AsciiString& label ) { return 0; }
-
- /// -modfactions: read mod's own string file (its CSF and its Generals.str, the STR winning a
- /// label both carry) into a table of its own, with TheFileSystem focused on that mod. mod is
- /// the index into TheGlobalData->m_mods; a label "M<mod+1>~LABEL" fetches from that table first
- /// and falls back to the bare LABEL in ours.
- virtual void loadModStrings( Int mod ) {}
- /// TRUE when mod's own table carries label, compared without case like ours
- virtual Bool hasModLabel( Int mod, const char *label ) const { return FALSE; }
};
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/HotKey.h b/GeneralsMD/Code/GameEngine/Include/GameClient/HotKey.h
index 63aea2010..8eb38afa2 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/HotKey.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/HotKey.h
@@ -161,9 +161,6 @@ public:
/// FixedOrderKeys in Hotkeys.ini: FALSE gives the orders their labels' letters, as shipped
static Bool fixedOrderKeys( void );
static void setFixedOrderKeys( Bool fixed );
- /** The name Hotkeys.ini gives a button: a mod's own (-modfactions' "M<n>~") or, under a plain
- * -mod, the last mod's as "<scope>:<button>", retail's as it is; what findPlayerKey looks up. */
- static std::string fileButtonName( const AsciiString& button );
/// Hotkeys.ini out of the user data folder: the button letters afresh, its CommandMap blocks over
/// the records the MetaMap holds. A block that will not parse ends the file there.
diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h
index ff2cc8084..e62048aa7 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/AI.h
@@ -1039,13 +1039,10 @@ public:
void addSideInfo(AISideInfo *info);
void addFactionBuildList(AISideBuildList *buildList);
- /** A side's resource, defence and skill set entry, and its skirmish build list. Under -modfactions a
- * mod faction's own mod's AIData.ini is loaded under "M<n>~<side>" (AI::parseAiDataDefinition), so
- * modIndex asks for that first and falls back on retail's entry of the side when the mod has none.
- * NULL when neither has one. */
- const AISideInfo *findSideInfo( const AsciiString &side, Int modIndex ) const;
- const AISideBuildList *findBuildList( const AsciiString &side, Int modIndex ) const;
- const AISideInfo *findSideInfo( const Player *player ) const; ///< by the player's side and template's mod
+ /// a side's resource, defence and skill set entry, and its skirmish build list; NULL when it has none
+ const AISideInfo *findSideInfo( const AsciiString &side ) const;
+ const AISideBuildList *findBuildList( const AsciiString &side ) const;
+ const AISideInfo *findSideInfo( const Player *player ) const; ///< by the player's side
// --------------- inherited from Snapshot interface --------------
void crc( Xfer *xfer );
@@ -1209,8 +1206,6 @@ public:
enum FormationID getNextFormationID(void);
static void parseAiDataDefinition( INI* ini );
- /// the key a mod's AIData entries are filed under: "M<n>~America" for mod index n-1, the side itself for retail (-1)
- static AsciiString modSideKey( const AsciiString &side, Int modIndex );
static Int s_enemyScans; ///< see getEnemyScanCountThisFrame
static Real s_lastPathfindMS; ///< see getLastPathfindMS
diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/RankInfo.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/RankInfo.h
index 7f94c81a9..8bdd039b4 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/RankInfo.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/RankInfo.h
@@ -62,21 +62,17 @@ public:
void reset();
void update() { }
- /// mod: -modfactions, the 0-based mod whose own Rank.ini a faction climbs; -1, or a mod that ships
- /// none, is retail's
- Int getRankLevelCount(Int mod = -1) const;
+ Int getRankLevelCount() const;
// note that level is 1...n, NOT 0...n-1
- const RankInfo* getRankInfo(Int level, Int mod = -1) const;
+ const RankInfo* getRankInfo(Int level) const;
static void friend_parseRankDefinition(INI* ini);
private:
typedef std::vector<RankInfo*> RankInfoVec;
- const RankInfoVec& ranksFor(Int mod) const;
RankInfoVec m_rankInfos;
- std::vector<RankInfoVec> m_modRankInfos; ///< -modfactions: each mod's Rank.ini, loaded in its mod pass
};
extern RankInfoStore* TheRankInfoStore;
diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/SidesList.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/SidesList.h
index 0d022f5b3..86236c6df 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/SidesList.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/SidesList.h
@@ -166,23 +166,18 @@ public:
/// prepareForMP_or_Skirmish left SkirmishScripts.scb unread
Bool skirmishScriptsFromMap() const { return m_skirmishScriptsFromMap; }
/** The match is on a map the game ships, where the fork's own skirmish AI plays: one in the game's
- * Maps folder (EA's, or a mod's in its archives) or one the random map generator made. A player's
+ * Maps folder (EA's, loose or in its archives) or one the random map generator made. A player's
* own map, downloaded or hand-made, gets EA's AI and EA's SkirmishScripts.scb. Decided from the
* map's path, which every machine in the match and the replay agree on. */
Bool forkAIMap() const { return m_forkAIMap; }
static Bool isForkAIMapPath(const AsciiString& mapPath);
/** The skirmish side a computer player on pt copies its scripts from, and in *teams (when asked) the
- * record its teams are in. Under -modfactions a mod faction takes its own mod's side of the same
- * Side (that mod's SkirmishScripts.scb, loadModSkirmishScripts) and retail's when the mod ships
- * none; a retail faction takes retail's. A faction no script was written for (Turkiye) takes its
- * BaseSide's original faction's. NULL when there is none. */
+ * record its teams are in. A faction no script was written for (Turkiye) takes its BaseSide's
+ * original faction's. NULL when there is none. */
SidesInfo *findSkirmishSideFor(const PlayerTemplate *pt, TeamsInfoRec **teams);
/// findSkirmishSideFor's search for one Side name
- SidesInfo *findSkirmishSideNamed(const AsciiString& side, Int mod, TeamsInfoRec **teams);
- /// how well a skirmish side of candidateSide from candidateMod (-1 retail) fits a player of side from
- /// mod: 2 the player's own, 1 retail's standing in for a mod faction, 0 not at all
- static Int skirmishSideFit(const AsciiString& candidateSide, Int candidateMod, const AsciiString& side, Int mod);
+ SidesInfo *findSkirmishSideNamed(const AsciiString& side, TeamsInfoRec **teams);
Int getNumTeams() { return m_teamrec.getNumTeams(); }
void emptyTeams();
@@ -226,11 +221,10 @@ protected:
Bool m_skirmishScriptsFromMap;
Bool m_forkAIMap;
- /// -modfactions: each mod's SkirmishScripts.scb players and teams; and the standard file's players for
- /// sides the map has none for. Kept out of m_skirmishSides, which a map's own sides nearly fill
- std::vector<SidesInfo> m_modSkirmishSides;
- TeamsInfoRec m_modSkirmishTeamrec;
- void loadModSkirmishScripts(void);
+ /// the standard file's players and teams for sides the map has none for. Kept out of
+ /// m_skirmishSides, which a map's own sides nearly fill
+ std::vector<SidesInfo> m_standInSkirmishSides;
+ TeamsInfoRec m_standInSkirmishTeamrec;
Bool validateAllyEnemyList(const AsciiString& tname, AsciiString& allies);
};
diff --git a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameInfo.h b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameInfo.h
index 57141bd79..e805269d6 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameInfo.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameNetwork/GameInfo.h
@@ -84,7 +84,7 @@ UnsignedInt GetDefaultRandomPool( void );
/// the templates a Random pick draws from in this game; a pool the old-factions rule empties draws as plain Random
void GetRandomDraw( Int pick, Bool oldFactionsOnly, std::vector<Int> &draw );
/// a pick as a preferences file keeps it, a Random pool by its armies' template names: the pool's bits
-/// count candidates, and a mod loaded or dropped since the file was written renumbers them
+/// count candidates, and a faction added or dropped since the file was written renumbers them
AsciiString PlayerTemplatePreference( Int pick );
Int PlayerTemplateFromPreference( const AsciiString &text );
/// a pick as the slot string carries it: a Random pool as its mask in hex, the room's budget being 400 bytes
diff --git a/GeneralsMD/Code/GameEngine/Include/GameNetwork/LANAPI.h b/GeneralsMD/Code/GameEngine/Include/GameNetwork/LANAPI.h
index c36134ec8..c9bf404fb 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameNetwork/LANAPI.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameNetwork/LANAPI.h
@@ -54,7 +54,6 @@ static const Int g_lanMaxChatLength = 100;
static const Int m_lanMaxOptionsLength = MAX_LANAPI_PACKET_SIZE - ( 8 + (g_lanGameNameLength+1)*2 + 4 + (g_lanPlayerNameLength+1)*2
+ (g_lanLoginNameLength+1) + (g_lanHostNameLength+1) );
static const Int g_maxSerialLength = 23; // including the trailing '\0'
-static const Int g_lanModNameLength = 150; // the -mod list in a join request and its refusal; longer lists are cut
//
// Whether to put this machine's Windows login and computer name on the wire. EA cut the
@@ -124,7 +123,6 @@ public:
RET_GAME_GONE, // OnGameJoin
RET_BUSY, // OnGameCreate/Join/etc if another action is in progress
RET_UNKNOWN, // Default message for oddity
- RET_MOD_MISMATCH, // OnGameJoin: the INI CRCs differ and so do the two -mod names
RET_MAX
};
UnicodeString getErrorStringFromReturnType( ReturnType ret );
@@ -257,7 +255,6 @@ protected:
PendingActionType m_pendingAction; ///< What action are we performing?
UnsignedInt m_expiration; ///< When should we give up on our action?
UnsignedInt m_actionTimeout;
- UnicodeString m_joinDeniedHostMod; ///< The host's mod from the last RET_MOD_MISMATCH, empty for none
UnsignedInt m_directConnectRemoteIP;///< The IP address of the game we are direct connecting to.
// Resend timer ---------------------------------------------------------------------------
@@ -396,9 +393,6 @@ struct LANMessage
UnsignedInt exeCRC;
UnsignedInt iniCRC;
char serial[g_maxSerialLength];
- char modNamePad; ///< puts modName on an even offset, 70
- WideChar modName[g_lanModNameLength+1]; ///< the joiner's -mod list, empty for none
- UnsignedInt baseExeCRC; ///< the joiner's exe CRC before its mods mounted; older builds leave junk in both
} GameToJoin;
// GameJoined is sent with JOIN_ACCEPT
@@ -417,7 +411,6 @@ struct LANMessage
UnsignedInt gameIP;
UnsignedInt playerIP;
LANAPIInterface::ReturnType reason;
- WideChar modName[g_lanModNameLength+1]; ///< the host's -mod name with RET_MOD_MISMATCH, empty for none
} GameNotJoined;
// Accept is sent with SET_ACCEPT
@@ -474,9 +467,6 @@ static_assert(offsetof(LANMessage, PlayerInfo.playerName) == 38, "LANMessage::Pl
static_assert(offsetof(LANMessage, GameToJoin.exeCRC) == 38, "LANMessage::GameToJoin.exeCRC");
static_assert(offsetof(LANMessage, GameToJoin.iniCRC) == 42, "LANMessage::GameToJoin.iniCRC");
static_assert(offsetof(LANMessage, GameToJoin.serial) == 46, "LANMessage::GameToJoin.serial");
-static_assert(offsetof(LANMessage, GameToJoin.modName) == 70, "LANMessage::GameToJoin.modName");
-static_assert(offsetof(LANMessage, GameToJoin.baseExeCRC) == 372, "LANMessage::GameToJoin.baseExeCRC");
-static_assert(offsetof(LANMessage, GameNotJoined.modName) == 80, "LANMessage::GameNotJoined.modName");
static_assert(offsetof(LANMessage, GameJoined.slotPosition) == 76, "LANMessage::GameJoined.slotPosition");
static_assert(offsetof(LANMessage, GameNotJoined.reason) == 76, "LANMessage::GameNotJoined.reason");
static_assert(offsetof(LANMessage, Accept.isAccepted) == 68, "LANMessage::Accept.isAccepted");
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameAudio.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameAudio.cpp
index f85eea5f2..c0054fea2 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameAudio.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameAudio.cpp
@@ -269,12 +269,6 @@ void AudioManager::init()
// the original Generals campaigns' briefings and mission dialogue, which Zero Hour's files left out
ini.load( AsciiString( "Data\\INI\\SpeechReforged.ini" ), INI_LOAD_OVERWRITE, NULL );
- // -modfactions: each mod's own events under "M<n>~" names; AudioSettings and MiscAudio stay ours
- INI::loadModPasses( "Data\\INI\\Music.ini", NULL );
- INI::loadModPasses( "Data\\INI\\SoundEffects.ini", NULL );
- INI::loadModPasses( "Data\\INI\\Speech.ini", NULL );
- INI::loadModPasses( "Data\\INI\\Voice.ini", NULL );
-
// do the miscellaneous sound files last so that we find the audioeventrts associated with the events.
ini.load( AsciiString( "Data\\INI\\MiscAudio.ini" ), INI_LOAD_OVERWRITE, NULL);
@@ -1077,8 +1071,7 @@ AudioEventInfo *AudioManager::findAudioEventInfo( AsciiString eventName ) const
AudioEventInfoHash::const_iterator it;
it = m_allAudioEventInfo.find(eventName);
if (it == m_allAudioEventInfo.end()) {
- AsciiString retailName;
- return TheModNamespace.findRetailName(eventName, MODNAME_AUDIOEVENT, &retailName) ? findAudioEventInfo(retailName) : NULL;
+ return NULL;
}
return (*it).second;
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameMusic.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameMusic.cpp
index 92ffc16a5..9521b909f 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameMusic.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameMusic.cpp
@@ -107,7 +107,7 @@ const FieldParse MusicTrack::m_musicTrackFieldParseTable[] =
* rest of its own side's list: the three lowest calm, the four highest battle, the rest tense
* (experiments/proofs/2026-10-25/audio-music/classify.py in the wrapper). Game_Silent is the sixty
* seconds the scripts leave between two tracks; it has no side and is never picked, but while our
- * music plays it is held like the tracks are. A mod's own tracks are not here: its Music.ini tags
+ * music plays it is held like the tracks are. Any other track is not here: Music.ini tags
* them with MusicMood and MusicSide (buildTracks), and an untagged one stays the scripts'. */
struct DynamicTrack
{
@@ -288,7 +288,7 @@ void MusicManager::addAudioEvent( AudioEventRTS *eventToAdd )
// At calm the cycle's own next track is swapped for a calm one of its side, or a fight's music
// would play over a quiet base. The scripts' sixty seconds of silence stay as they are, and so
- // does the track of a mod's side that tagged no calm one.
+ // does the track of a side that tagged no calm one.
const AsciiString calm = !m_issuing && !m_inControl && track != NULL && track->side.isNotEmpty()
&& track->mood != MOOD_CALM && engaged() ? pickTrack( MOOD_CALM ) : AsciiString::TheEmptyString;
if (calm.isNotEmpty())
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
index bb588da30..4afec4fd8 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
@@ -28,14 +28,8 @@
#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine
#include "zhio.h"
-#include <algorithm>
-#include <string>
-
-#include "Common/ArchiveFileSystem.h"
#include "Common/CommandLine.h"
#include "Common/CRCDebug.h"
-#include "Common/file.h"
-#include "Common/LocalFileSystem.h"
#include "Common/OptionsCatalog.h"
#include "Common/version.h"
#include "GameClient/TerrainVisual.h" // for TERRAIN_LOD_MIN definition
@@ -2699,188 +2693,6 @@ Int parseUpdateImages(char *args[], int num)
return 1;
}
-/** The string value of "key" in mod.json, or empty. ponytail: a flat object of string values is
- * all the launcher writes, so this finds the key and reads to the closing quote, honouring only a
- * backslash escape; a real parser is for the day mod.json grows nesting. */
-static AsciiString modJsonString( const std::string &json, const char *key )
-{
- const char *space = " \t\r\n";
- std::string quoted = std::string( "\"" ) + key + "\"";
- size_t at = std::string::npos;
- // the key is the quoted name followed by a colon; the same text as somebody's value is not
- for (size_t found = json.find( quoted ); found != std::string::npos; found = json.find( quoted, found + 1 ))
- {
- size_t colon = json.find_first_not_of( space, found + quoted.size() );
- if (colon != std::string::npos && json[colon] == ':')
- {
- at = json.find_first_not_of( space, colon + 1 );
- break;
- }
- }
- // a number or anything else that is not a string is no name
- if (at == std::string::npos || json[at] != '"')
- return AsciiString();
-
- AsciiString value;
- for (++at; at < json.size() && json[at] != '"'; ++at)
- {
- if (json[at] == '\\' && at + 1 < json.size())
- ++at;
- value.concat( json[at] );
- }
- return value;
-}
-
-/** What the mod is called on the version line, in the replay and in a refused join: "<name> <version>"
- * from the folder's mod.json, else the folder's or the archive's own name. *bareName is the same
- * without the version, which is what -modfactions puts in front of a faction. */
-static AsciiString modIdentity( const AsciiString &modPath, Bool isDir, AsciiString *bareName )
-{
- AsciiString name;
- if (isDir)
- {
- AsciiString jsonPath = modPath;
- jsonPath.concat( "mod.json" );
- File *file = TheLocalFileSystem->openFile( jsonPath.str(), File::READ | File::BINARY );
- if (file != NULL)
- {
- Int size = file->size();
- char *contents = file->readEntireAndClose();
- std::string json( contents, size );
- delete [] contents;
-
- name = modJsonString( json, "name" );
- *bareName = name;
- AsciiString version = modJsonString( json, "version" );
- if (name.isNotEmpty() && version.isNotEmpty())
- {
- name.concat( ' ' );
- name.concat( version );
- }
- }
- }
- if (name.isEmpty())
- {
- // the last path component, without the trailing separator a folder was given and without ".big"
- std::string path( modPath.str() );
- while (!path.empty() && (path.back() == '\\' || path.back() == '/'))
- path.pop_back();
- size_t slash = path.find_last_of( "\\/" );
- if (slash != std::string::npos)
- path.erase( 0, slash + 1 );
- if (!isDir && path.size() > 4 && strcasecmp( path.c_str() + path.size() - 4, ".big" ) == 0)
- path.erase( path.size() - 4 );
- name = path.c_str();
- *bareName = name;
- }
- return name;
-}
-
-static Int addMod(char *args[], Int num, Bool isPatch)
-{
- if (TheWritableGlobalData && num > 1)
- {
- AsciiString modPath = args[1];
- // "." or ".." as a part would let a relative -mod climb out of the user folder, and give one
- // folder two names that the file system's prefix and archive checks read as two mods
- std::string parts( modPath.str() );
- std::replace( parts.begin(), parts.end(), '/', '\\' );
- parts = "\\" + parts + "\\";
- if (parts.find( "\\.\\" ) != std::string::npos || parts.find( "\\..\\" ) != std::string::npos)
- {
- DEBUG_LOG(("Mod path '%s' is refused: it holds a '.' or '..' part.\n", modPath.str()));
- return 2;
- }
- if (strchr(modPath.str(), ':') || modPath.startsWith("/") || modPath.startsWith("\\"))
- {
- // full path passed in. Don't append base path.
- }
- else
- {
- modPath.format("%s%s", TheGlobalData->getPath_UserData().str(), args[1]);
- }
- DEBUG_LOG(("Looking for mod '%s'\n", modPath.str()));
-
- if (!TheLocalFileSystem->doesFileExist(modPath.str()))
- {
- DEBUG_LOG(("Mod does not exist.\n"));
- return 2; // no such file/dir.
- }
-
- // now check for dir-ness
- struct stat statBuf;
- if (zh_stat(modPath.str(), &statBuf) != 0)
- {
- DEBUG_LOG(("Could not _stat() mod.\n"));
- return 2; // could not stat the file/dir.
- }
-
- if (statBuf.st_mode & S_IFDIR)
- {
- if (!modPath.endsWith("\\") && !modPath.endsWith("/"))
- modPath.concat('\\');
- DEBUG_LOG(("Mod dir is '%s'.\n", modPath.str()));
- }
- else
- {
- DEBUG_LOG(("Mod file is '%s'.\n", modPath.str()));
- }
- // repeatable: each -mod goes after the ones before it and wins over them (loadMods, FileSystem::modLooseFile)
- TheWritableGlobalData->m_mods.push_back( modPath );
- TheWritableGlobalData->m_modIsPatch.push_back( isPatch );
-
- AsciiString bareName;
- AsciiString name = modIdentity( modPath, (statBuf.st_mode & S_IFDIR) != 0, &bareName );
- TheWritableGlobalData->m_modNames.push_back( bareName );
- // a patch reads "ShockWave 1.201 + Tweak 1.0" in the version line, a replay and a refused join
- if (TheGlobalData->m_modName.isNotEmpty())
- TheWritableGlobalData->m_modName.concat( isPatch ? " + " : ", " );
- TheWritableGlobalData->m_modName.concat( name );
- DEBUG_LOG(("MOD %d name='%s' path='%s'%s\n", (Int)TheGlobalData->m_mods.size(), name.str(), modPath.str(), isPatch ? " patch" : ""));
-
- return 2;
- }
- return 1;
-}
-
-Int parseMod(char *args[], Int num)
-{
- return addMod( args, num, FALSE );
-}
-
-/** -modpatch <folder>: a mod that changes the one given before it file by file rather than bringing
- * armies of its own, or retail's files when it comes first. With no full -mod at all it is a plain -mod. */
-Int parseModPatch(char *args[], Int num)
-{
- return addMod( args, num, TRUE );
-}
-
-/** A mod's factions load beside retail's, each full mod's files apart, so a patch joins the full mod before it (retail's
- * files when none is) and the full mods alone are the faction sets, M1, M2 and so on. */
-static void foldModPatches()
-{
- GlobalData *data = TheWritableGlobalData;
- std::vector<AsciiString> mods;
- std::vector<AsciiString> names;
- for (size_t i = 0; i < data->m_mods.size(); ++i)
- {
- if (!data->m_modIsPatch[i])
- {
- mods.push_back( data->m_mods[i] );
- names.push_back( data->m_modNames[i] );
- data->m_modPatches.push_back( std::vector<AsciiString>() );
- continue;
- }
- if (mods.empty())
- data->m_retailPatches.push_back( data->m_mods[i] );
- else
- data->m_modPatches.back().push_back( data->m_mods[i] );
- DEBUG_LOG(("MODPATCH '%s' over %s\n", data->m_modNames[i].str(), mods.empty() ? "retail" : names.back().str()));
- }
- data->m_mods = mods;
- data->m_modNames = names;
-}
-
static CommandLineParam params[] =
{
{ "-noshellmap", parseNoShellMap },
@@ -2893,8 +2705,6 @@ static CommandLineParam params[] =
{ "-particleEdit", parseParticleEdit },
{ "-scriptDebug", parseScriptDebug },
{ "-playStats", parsePlayStats },
- { "-mod", parseMod },
- { "-modpatch", parseModPatch },
{ "-noshaders", parseNoShaders },
{ "-particlebounce", parseParticleBounce },
{ "-smoke", parseSmoke },
@@ -3129,24 +2939,6 @@ void parseCommandLine(int argc, char *argv[])
arg++;
}
}
-
- // Any full -mod's factions stand beside retail's, one mod or five; never merged over them. With no
- // full -mod there is nothing to keep apart, and the retail focus would have no tree to read; patches
- // alone then stack as plain mods.
- const std::vector<Bool> &isPatch = TheGlobalData->m_modIsPatch;
- TheWritableGlobalData->m_modFactions = std::find( isPatch.begin(), isPatch.end(), FALSE ) != isPatch.end();
- if (TheGlobalData->m_modFactions)
- foldModPatches();
- TheArchiveFileSystem->loadMods();
-
- // GameData.ini and the language check have already asked about files the mod may now supply
- if (TheGlobalData->m_modName.isNotEmpty())
- {
- DEBUG_LOG(("MODS %d loaded, last wins: %s\n", (Int)TheGlobalData->m_mods.size(), TheGlobalData->m_modName.str()));
- TheFileSystem->reset();
- // the mod's skirmish and multiplayer scripts are the ones the match runs, so they are the ones the join compares
- TheWritableGlobalData->computeExeCRC();
- }
}
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/DamageFX.cpp b/GeneralsMD/Code/GameEngine/Source/Common/DamageFX.cpp
index e20a78463..289788fab 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/DamageFX.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/DamageFX.cpp
@@ -280,8 +280,7 @@ const DamageFX *DamageFXStore::findDamageFX(AsciiString name) const
DamageFXMap::const_iterator it = m_dfxmap.find(namekey);
if (it == m_dfxmap.end())
{
- AsciiString retailName;
- return TheModNamespace.findRetailName(name, MODNAME_DAMAGEFX, &retailName) ? findDamageFX(retailName) : NULL;
+ return NULL;
}
else
{
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
index c47e371d8..dfe520199 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
@@ -205,19 +205,6 @@ void initSubsystem(SUBSYSTEM*& sysref, AsciiString name, SUBSYSTEM* sys, Xfer *p
TheSubsystemList->initSubsystem(sys, path1, path2, dirpath, pXfer, name);
}
-//-------------------------------------------------------------------------------------------------
-/** A store a faction is made of. With -modfactions the plain load sees retail's files only, and
- * then each mod's load under that mod's names (INI::loadModPasses); a mod's Default\ file never
- * loads. With no full -mod this is initSubsystem. */
-//-------------------------------------------------------------------------------------------------
-template<class SUBSYSTEM>
-void initFactionSubsystem(SUBSYSTEM*& sysref, AsciiString name, SUBSYSTEM* sys, Xfer *pXfer, const char* path1,
- const char* path2, const char* dirpath = NULL)
-{
- initSubsystem(sysref, name, sys, pXfer, path1, path2, dirpath);
- INI::loadModPasses(dirpath != NULL ? dirpath : path2, pXfer, dirpath != NULL);
-}
-
//-------------------------------------------------------------------------------------------------
#if defined(_WIN32)
extern HINSTANCE ApplicationHInstance; ///< our application instance
@@ -240,20 +227,6 @@ static void checksumFileContents( XferCRC &xferCRC, const char *path )
delete [] contents;
}
-/** The same for the command buttons and sets: with -modfactions each mod's copy after retail's, as
- * ControlBar::init loads them. */
-static void checksumFactionFile( XferCRC &xferCRC, const char *path )
-{
- checksumFileContents( xferCRC, path );
- for (Int mod = 0; TheGlobalData->m_modFactions && mod < (Int)TheGlobalData->m_mods.size(); ++mod)
- {
- TheFileSystem->setFocus( mod );
- if (TheFileSystem->doesFileExist( path ))
- checksumFileContents( xferCRC, path );
- TheFileSystem->setFocus( FILE_FOCUS_ALL );
- }
-}
-
//-------------------------------------------------------------------------------------------------
/** What a model's bytes hashed to, and the size and write time of the file they were read out of:
* the archive the model resolved to, or the loose model itself. */
@@ -354,12 +327,8 @@ static void checksumModels( XferCRC &xferCRC )
AsciiString model = *it;
model.toLower();
- // the file openFile will read: a mod's loose or archived copy first (FileSystem::modLooseFile)
- Bool inModArchive = FALSE;
- AsciiString source = TheFileSystem->modLooseFile( model, &inModArchive );
- if (source.isEmpty())
- source = TheLocalFileSystem->doesFileExist( model.str() ) && !inModArchive
- ? model : TheArchiveFileSystem->getArchiveFilenameForFile( model );
+ AsciiString source = TheLocalFileSystem->doesFileExist( model.str() )
+ ? model : TheArchiveFileSystem->getArchiveFilenameForFile( model );
ModelChecksum entry;
const Bool sourceKnown = TheLocalFileSystem->getFileInfo( source, &entry.source );
@@ -1140,14 +1109,11 @@ void GameEngine::init( int argc, char *argv[] )
#endif/////////////////////////////////////////////////////////////////////////////////////////////
- // -modfactions: which names each mod defines, read before any of its files load
- if (TheGlobalData->m_modFactions)
- TheModNamespace.scanMods();
- initFactionSubsystem(TheScienceStore,"TheScienceStore", MSGNEW("GameEngineSubsystem") ScienceStore(), &xferCRC, "Data\\INI\\Default\\Science.ini", "Data\\INI\\Science.ini");
+ initSubsystem(TheScienceStore,"TheScienceStore", MSGNEW("GameEngineSubsystem") ScienceStore(), &xferCRC, "Data\\INI\\Default\\Science.ini", "Data\\INI\\Science.ini");
// New sciences only: a name EA already defined stops the load
ini.load( AsciiString( "Data\\INI\\ScienceReforged.ini" ), INI_LOAD_MULTIFILE, &xferCRC );
initSubsystem(TheMultiplayerSettings,"TheMultiplayerSettings", MSGNEW("GameEngineSubsystem") MultiplayerSettings(), &xferCRC, "Data\\INI\\Default\\Multiplayer.ini", "Data\\INI\\Multiplayer.ini");
- // The fork's player colours, after EA's eight (or a mod's own list)
+ // The fork's player colours, after EA's eight
ini.load( AsciiString( "Data\\INI\\MultiplayerReforged.ini" ), INI_LOAD_OVERWRITE, &xferCRC );
initSubsystem(TheTerrainTypes,"TheTerrainTypes", MSGNEW("GameEngineSubsystem") TerrainTypeCollection(), &xferCRC, "Data\\INI\\Default\\Terrain.ini", "Data\\INI\\Terrain.ini");
initSubsystem(TheTerrainRoads,"TheTerrainRoads", MSGNEW("GameEngineSubsystem") TerrainRoadCollection(), &xferCRC, "Data\\INI\\Default\\Roads.ini", "Data\\INI\\Roads.ini");
@@ -1172,7 +1138,7 @@ void GameEngine::init( int argc, char *argv[] )
//
// Missing music used to end the process here, with setQuitting and not one word anywhere: the
// game started, the window appeared for a moment and it closed again. A player who deleted
- // Music.big to save space, or a mod that ships without music, got that and no way to find out
+ // Music.big to save space got that and no way to find out
// why. Music is not a thing the game needs to run - the audio manager already plays nothing
// when it has nothing - so say so in the log and carry on.
//
@@ -1192,9 +1158,8 @@ void GameEngine::init( int argc, char *argv[] )
initSubsystem(TheMessageStream,"TheMessageStream", createMessageStream(), NULL);
initSubsystem(TheSidesList,"TheSidesList", MSGNEW("GameEngineSubsystem") SidesList(), NULL);
initSubsystem(TheCaveSystem,"TheCaveSystem", MSGNEW("GameEngineSubsystem") CaveSystem(), NULL);
- // -modfactions: each mod's own Rank.ini, the table its factions climb (RankInfoStore::getRankInfo)
- initFactionSubsystem(TheRankInfoStore,"TheRankInfoStore", MSGNEW("GameEngineSubsystem") RankInfoStore(), &xferCRC, NULL, "Data\\INI\\Rank.ini");
- initFactionSubsystem(ThePlayerTemplateStore,"ThePlayerTemplateStore", MSGNEW("GameEngineSubsystem") PlayerTemplateStore(), &xferCRC, "Data\\INI\\Default\\PlayerTemplate.ini", "Data\\INI\\PlayerTemplate.ini");
+ initSubsystem(TheRankInfoStore,"TheRankInfoStore", MSGNEW("GameEngineSubsystem") RankInfoStore(), &xferCRC, NULL, "Data\\INI\\Rank.ini");
+ initSubsystem(ThePlayerTemplateStore,"ThePlayerTemplateStore", MSGNEW("GameEngineSubsystem") PlayerTemplateStore(), &xferCRC, "Data\\INI\\Default\\PlayerTemplate.ini", "Data\\INI\\PlayerTemplate.ini");
// The fork's own factions: a new name is added after EA's, an existing one is edited in place
ini.load( AsciiString( "Data\\INI\\PlayerTemplateReforged.ini" ), INI_LOAD_MULTIFILE, &xferCRC );
initSubsystem(TheParticleSystemManager,"TheParticleSystemManager", createParticleSystemManager(), NULL);
@@ -1207,7 +1172,7 @@ void GameEngine::init( int argc, char *argv[] )
#endif/////////////////////////////////////////////////////////////////////////////////////////////
- initFactionSubsystem(TheFXListStore,"TheFXListStore", MSGNEW("GameEngineSubsystem") FXListStore(), &xferCRC, "Data\\INI\\Default\\FXList.ini", "Data\\INI\\FXList.ini");
+ initSubsystem(TheFXListStore,"TheFXListStore", MSGNEW("GameEngineSubsystem") FXListStore(), &xferCRC, "Data\\INI\\Default\\FXList.ini", "Data\\INI\\FXList.ini");
/* The fork's own detonation light, on top of EA's list. It is a separate file rather than a
loose copy of FXList.ini because a loose copy shadows the whole 190K shipped file: it goes
stale against every patch, it cannot be reviewed, and - since it lands in the INI CRC below -
@@ -1215,25 +1180,25 @@ void GameEngine::init( int argc, char *argv[] )
TheFXListStore->setClassicDropsBlocks( TheGlobalData->m_classicGraphics );
ini.load( AsciiString( "Data\\INI\\FXListReforged.ini" ), INI_LOAD_OVERWRITE, &xferCRC );
TheFXListStore->setClassicDropsBlocks( FALSE );
- initFactionSubsystem(TheWeaponStore,"TheWeaponStore", MSGNEW("GameEngineSubsystem") WeaponStore(), &xferCRC, NULL, "Data\\INI\\Weapon.ini");
+ initSubsystem(TheWeaponStore,"TheWeaponStore", MSGNEW("GameEngineSubsystem") WeaponStore(), &xferCRC, NULL, "Data\\INI\\Weapon.ini");
/* Weapons of the fork's own that BalanceReforged.ini hands out. It cannot add one, and borrowing
- one of EA's that nothing fires broke under a mod whose Weapon.ini leaves it out (Contra's Paladin
- found no infantry laser and crashed); a new name here exists whatever Weapon.ini loaded. */
+ one of EA's that nothing fires broke whenever a Weapon.ini left it out (the Paladin found no
+ infantry laser and crashed); a new name here exists whatever Weapon.ini loaded. */
ini.load( AsciiString( "Data\\INI\\WeaponReforged.ini" ), INI_LOAD_OVERWRITE, &xferCRC );
/* Turkiye's own weapons. OVERWRITE rather than MULTIFILE: a patch file may only edit a weapon
that exists, and every one of these is new. */
ini.load( AsciiString( "Data\\INI\\TurkiyeWeaponReforged.ini" ), INI_LOAD_OVERWRITE, &xferCRC );
- initFactionSubsystem(TheObjectCreationListStore,"TheObjectCreationListStore", MSGNEW("GameEngineSubsystem") ObjectCreationListStore(), &xferCRC, "Data\\INI\\Default\\ObjectCreationList.ini", "Data\\INI\\ObjectCreationList.ini");
+ initSubsystem(TheObjectCreationListStore,"TheObjectCreationListStore", MSGNEW("GameEngineSubsystem") ObjectCreationListStore(), &xferCRC, "Data\\INI\\Default\\ObjectCreationList.ini", "Data\\INI\\ObjectCreationList.ini");
/* Lists EA left out or got wrong, before any object names one: a list parsed again is cleared
and replaced whole, and a new name is simply added. */
ini.load( AsciiString( "Data\\INI\\ObjectCreationListReforged.ini" ), INI_LOAD_OVERWRITE, &xferCRC );
- initFactionSubsystem(TheLocomotorStore,"TheLocomotorStore", MSGNEW("GameEngineSubsystem") LocomotorStore(), &xferCRC, NULL, "Data\\INI\\Locomotor.ini");
- initFactionSubsystem(TheSpecialPowerStore,"TheSpecialPowerStore", MSGNEW("GameEngineSubsystem") SpecialPowerStore(), &xferCRC, "Data\\INI\\Default\\SpecialPower.ini", "Data\\INI\\SpecialPower.ini");
+ initSubsystem(TheLocomotorStore,"TheLocomotorStore", MSGNEW("GameEngineSubsystem") LocomotorStore(), &xferCRC, NULL, "Data\\INI\\Locomotor.ini");
+ initSubsystem(TheSpecialPowerStore,"TheSpecialPowerStore", MSGNEW("GameEngineSubsystem") SpecialPowerStore(), &xferCRC, "Data\\INI\\Default\\SpecialPower.ini", "Data\\INI\\SpecialPower.ini");
/* Powers edited in place (a scan Frenzy should not give) and the Demolitions General's own
Rebel Ambush, before any object names one. */
ini.load( AsciiString( "Data\\INI\\SpecialPowerReforged.ini" ), INI_LOAD_MULTIFILE, &xferCRC );
- initFactionSubsystem(TheDamageFXStore,"TheDamageFXStore", MSGNEW("GameEngineSubsystem") DamageFXStore(), &xferCRC, NULL, "Data\\INI\\DamageFX.ini");
- initFactionSubsystem(TheArmorStore,"TheArmorStore", MSGNEW("GameEngineSubsystem") ArmorStore(), &xferCRC, NULL, "Data\\INI\\Armor.ini");
+ initSubsystem(TheDamageFXStore,"TheDamageFXStore", MSGNEW("GameEngineSubsystem") DamageFXStore(), &xferCRC, NULL, "Data\\INI\\DamageFX.ini");
+ initSubsystem(TheArmorStore,"TheArmorStore", MSGNEW("GameEngineSubsystem") ArmorStore(), &xferCRC, NULL, "Data\\INI\\Armor.ini");
initSubsystem(TheBuildAssistant,"TheBuildAssistant", MSGNEW("GameEngineSubsystem") BuildAssistant, NULL);
@@ -1246,7 +1211,7 @@ void GameEngine::init( int argc, char *argv[] )
- initFactionSubsystem(TheThingFactory,"TheThingFactory", createThingFactory(), &xferCRC, "Data\\INI\\Default\\Object.ini", NULL, "Data\\INI\\Object");
+ initSubsystem(TheThingFactory,"TheThingFactory", createThingFactory(), &xferCRC, "Data\\INI\\Default\\Object.ini", NULL, "Data\\INI\\Object");
/* The fork's balance, written over EA's numbers after every object, weapon and armor exists.
MULTIFILE edits a template in place and leaves every field the file does not name as EA
wrote it, so the file holds the changes and nothing else; an Armor block still replaces
@@ -1266,7 +1231,7 @@ void GameEngine::init( int argc, char *argv[] )
#endif/////////////////////////////////////////////////////////////////////////////////////////////
- initFactionSubsystem(TheUpgradeCenter,"TheUpgradeCenter", MSGNEW("GameEngineSubsystem") UpgradeCenter, &xferCRC, "Data\\INI\\Default\\Upgrade.ini", "Data\\INI\\Upgrade.ini");
+ initSubsystem(TheUpgradeCenter,"TheUpgradeCenter", MSGNEW("GameEngineSubsystem") UpgradeCenter, &xferCRC, "Data\\INI\\Default\\Upgrade.ini", "Data\\INI\\Upgrade.ini");
// An upgrade parsed again is edited in place, so this file names only what changes
ini.load( AsciiString( "Data\\INI\\UpgradeReforged.ini" ), INI_LOAD_MULTIFILE, &xferCRC );
/* Command buttons and sets, which the AI, the scripts and the build checks read: logic's, so
@@ -1285,16 +1250,11 @@ void GameEngine::init( int argc, char *argv[] )
initSubsystem(TheAI,"TheAI", MSGNEW("GameEngineSubsystem") AI(), &xferCRC, "Data\\INI\\Default\\AIData.ini", "Data\\INI\\AIData.ini");
- /* -modfactions: each mod's sides' build lists and skill sets, under "M<n>~<side>". Unlike the
- other faction files this one reads the mod's Default\ copy too: ShockWave and The End of Days
- keep their whole AIData there, as retail does, and End of Days' AIData.ini is an empty block. */
- INI::loadModPasses( "Data\\INI\\Default\\AIData.ini", &xferCRC );
- INI::loadModPasses( "Data\\INI\\AIData.ini", &xferCRC );
// SideInfo and SkirmishBuildList for the fork's factions: a side named again is edited, a new one added
ini.load( AsciiString( "Data\\INI\\AIDataReforged.ini" ), INI_LOAD_MULTIFILE, &xferCRC );
initSubsystem(TheGameLogic,"TheGameLogic", createGameLogic(), NULL);
initSubsystem(TheTeamFactory,"TheTeamFactory", MSGNEW("GameEngineSubsystem") TeamFactory(), NULL);
- initFactionSubsystem(TheCrateSystem,"TheCrateSystem", MSGNEW("GameEngineSubsystem") CrateSystem(), &xferCRC, "Data\\INI\\Default\\Crate.ini", "Data\\INI\\Crate.ini");
+ initSubsystem(TheCrateSystem,"TheCrateSystem", MSGNEW("GameEngineSubsystem") CrateSystem(), &xferCRC, "Data\\INI\\Default\\Crate.ini", "Data\\INI\\Crate.ini");
initSubsystem(ThePlayerList,"ThePlayerList", MSGNEW("GameEngineSubsystem") PlayerList(), NULL);
initSubsystem(TheRecorder,"TheRecorder", createRecorder(), NULL);
initSubsystem(TheRadar,"TheRadar", createRadar(), NULL);
@@ -1350,8 +1310,8 @@ void GameEngine::init( int argc, char *argv[] )
// TheCommandStore parses these without the checksum, and the AI builds and hunts from them
checksumFileContents( xferCRC, "Data\\INI\\Default\\CommandButton.ini" );
- checksumFactionFile( xferCRC, "Data\\INI\\CommandButton.ini" );
- checksumFactionFile( xferCRC, "Data\\INI\\CommandSet.ini" );
+ checksumFileContents( xferCRC, "Data\\INI\\CommandButton.ini" );
+ checksumFileContents( xferCRC, "Data\\INI\\CommandSet.ini" );
checksumFileContents( xferCRC, "Data\\INI\\CommandSetReforged.ini" );
checksumModels( xferCRC );
@@ -1527,7 +1487,7 @@ void GameEngine::init( int argc, char *argv[] )
{
// an unnamed enum, so the ErrorCode catch above does not take it
AsciiString why;
- why.format("GameEngine::init failed with INI error 0x%08x: game data (a mod's INI?) names something that is not there or cannot be used.", (UnsignedInt)code);
+ why.format("GameEngine::init failed with INI error 0x%08x: game data names something that is not there or cannot be used.", (UnsignedInt)code);
RELEASE_CRASH((why.str()));
}
@@ -2748,32 +2708,6 @@ static void updateHeadlessRun( void )
}
}
- // -modfactions: whose objects each side is made of, ten seconds in
- if (TheGlobalData->m_modFactions && frame == 300)
- {
- Int total[ MAX_PLAYER_COUNT ] = { 0 }, namespaced[ MAX_PLAYER_COUNT ] = { 0 };
- AsciiString example[ MAX_PLAYER_COUNT ];
- for (Object *obj = TheGameLogic->getFirstObject(); obj != NULL; obj = obj->getNextObject())
- {
- const Int index = obj->getControllingPlayer()->getPlayerIndex();
- ++total[ index ];
- if (strchr( obj->getTemplate()->getName().str(), '~' ) != NULL)
- {
- ++namespaced[ index ];
- if (example[ index ].isEmpty())
- example[ index ] = obj->getTemplate()->getName();
- }
- }
- for (Int i = 0; i < ThePlayerList->getPlayerCount() && i < MAX_PLAYER_COUNT; ++i)
- {
- Player *p = ThePlayerList->getNthPlayer( i );
- if (!p->isPlayableSide() || p->isPlayerObserver())
- continue;
- DEBUG_LOG(("MODNS frame %d player %d plays %s: %d objects, %d of them a mod's, e.g. %s\n", frame, i,
- p->getPlayerTemplate()->getName().str(), total[ i ], namespaced[ i ], example[ i ].str()));
- }
- }
-
/* A -video range that runs up to or past -maxframes keeps the run alive until its last picture is
drawn, which happens on the pass after the logic reaches that frame. */
Int maxGameFrames = TheGlobalData->m_maxGameFrames;
@@ -3572,7 +3506,7 @@ void GameEngine::execute( void )
{
}
/* A C++ throw carries no exception record, so the report's "Last error" stayed empty
- and named nothing (crash reports 1194 and 1198, both Shockwave Chaos matches). Say
+ and named nothing (crash reports 1194 and 1198). Say
what was thrown; a fault the SEH translator dumped keeps the old reason. */
char why[ 160 ];
try
@@ -3584,10 +3518,10 @@ void GameEngine::execute( void )
snprintf( why, sizeof(why), "Uncaught ErrorCode 0x%08x in GameEngine::update", (UnsignedInt)ec );
}
// The INI_* codes are an unnamed enum, so the ErrorCode catch does not take them: a
- // module meeting data it cannot use threw one at a mod's map load (reports 1893-1899).
+ // module meeting data it cannot use threw one at a map load (reports 1893-1899).
catch (decltype(INI_INVALID_DATA) code)
{
- snprintf( why, sizeof(why), "Uncaught INI error 0x%08x in GameEngine::update: game data (a mod's INI?) names something that is not there or cannot be used", (UnsignedInt)code );
+ snprintf( why, sizeof(why), "Uncaught INI error 0x%08x in GameEngine::update: game data names something that is not there or cannot be used", (UnsignedInt)code );
}
catch (XferStatus status)
{
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
index 51777271f..b50ef0d83 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
@@ -45,7 +45,6 @@
#include "BuildFingerprint.h" // ZH_BUILD_FINGERPRINT, generated at build time (N1)
#include "Common/EarlyOptions.h" // findUserDataDirectory
#include "Common/file.h"
-#include "Common/ArchiveFileSystem.h"
#include "Common/FileSystem.h"
#include "Common/GameAudio.h"
#include "Common/GameLOD.h" // STATIC_GAME_LOD_HIGH, whose step on the quality slider is the slider's default
@@ -1144,7 +1143,6 @@ GlobalData::GlobalData()
m_isBreakableMovie = FALSE;
m_breakTheMovie = FALSE;
- m_modFactions = FALSE;
setTimeOfDay( m_timeOfDay );
@@ -1293,7 +1291,6 @@ GlobalData::GlobalData()
m_useAlternateMouse = FALSE;
computeExeCRC();
- m_baseExeCRC = m_exeCRC;
} // end GlobalData
@@ -1445,10 +1442,7 @@ GlobalData *GlobalData::newOverride( void )
} // end newOveride
//-------------------------------------------------------------------------------------------------
-/** The build fingerprint, the version and the two multiplayer scripts as they resolve now: once at
- * construction, and again after -mod mounts its archives (parseCommandLine), since a mod's
- * SkirmishScripts.scb or MultiplayerScripts.scb is the one the match runs. Without -mod it runs once
- * and the value is what it always was. */
+/** The build fingerprint, the version and the multiplayer scripts, once at construction. */
//-------------------------------------------------------------------------------------------------
void GlobalData::computeExeCRC( void )
{
@@ -1461,29 +1455,13 @@ void GlobalData::computeExeCRC( void )
UnsignedInt version = TheVersion->getVersionNumber();
exeCRC.computeCRC( &version, sizeof(UnsignedInt) );
}
- // Add in MP scripts to the EXE CRC, since the game will go out of sync if they change
- // -modfactions: then each mod's own SkirmishScripts.scb, which its factions' computer players run
- // (SidesList::loadModSkirmishScripts)
+ // Add in MP scripts to the EXE CRC, since the game will go out of sync if they change,
// and EA's own SkirmishScripts.scb, which a player's own map runs (SidesList::prepareForMP_or_Skirmish)
- std::vector<Int> focus( 3, FILE_FOCUS_ALL );
- for (Int mod = 0; m_modFactions && mod < (Int)m_mods.size(); ++mod)
- focus.push_back( mod );
- for (size_t s = 0; s < focus.size(); ++s)
+ const char *scripts[] = { "Data\\Scripts\\SkirmishScripts.scb", "Data\\Scripts\\MultiplayerScripts.scb",
+ "Data\\Scripts\\SkirmishScriptsRetail.scb" };
+ for (size_t s = 0; s < ARRAY_SIZE( scripts ); ++s)
{
- const char *script = s == 1 ? "Data\\Scripts\\MultiplayerScripts.scb"
- : s == 2 ? "Data\\Scripts\\SkirmishScriptsRetail.scb" : "Data\\Scripts\\SkirmishScripts.scb";
- File *fp = NULL;
- if (focus[s] == FILE_FOCUS_ALL)
- {
- fp = TheFileSystem->openFile( script, File::READ | File::BINARY );
- }
- else
- {
- TheFileSystem->setFocus( focus[s] );
- if (TheFileSystem->doesFileExist( script ))
- fp = TheFileSystem->openFile( script, File::READ | File::BINARY );
- TheFileSystem->setFocus( FILE_FOCUS_ALL );
- }
+ File *fp = TheFileSystem->openFile( scripts[s], File::READ | File::BINARY );
if (fp == NULL)
continue;
unsigned char crcBlock[blockSize];
@@ -1495,38 +1473,18 @@ void GlobalData::computeExeCRC( void )
fp->close();
}
- // Two facts SidesList::prepareForMP_or_Skirmish reads that the files above may not show, hashed only
+ // A fact SidesList::prepareForMP_or_Skirmish reads that the files above do not show, hashed only
// when set so an ordinary machine's value is the one it always was. With no user data folder a
- // player's own map reads as one of the game's and gets the fork's AI; and a mod can ship a copy of
- // the fork's SkirmishScripts.scb byte for byte, which keeps EA's off a player's own map.
+ // player's own map reads as one of the game's and gets the fork's AI.
const Bool noUserDataDir = m_userDataDir.isEmpty();
if (noUserDataDir)
{
const UnsignedInt noUserData = 0x4E4F5544; // "NOUD"
exeCRC.computeCRC( &noUserData, sizeof( noUserData ) );
}
- Bool modScripts = FALSE;
- if (TheFileSystem && TheArchiveFileSystem)
- {
- Bool inModArchive = FALSE;
- modScripts = TheFileSystem->modLooseFile( AsciiString( "data\\Scripts\\SkirmishScripts.scb" ), &inModArchive ).isNotEmpty() || inModArchive;
- if (modScripts)
- {
- const UnsignedInt modScriptsMark = 0x4D4F4453; // "MODS"
- exeCRC.computeCRC( &modScriptsMark, sizeof( modScriptsMark ) );
- }
-
- // A mod's CommandSet.ini keeps its sets from the fork's corrections (CommandStore), and a copy
- // byte for byte of EA's would hash the same as no copy at all.
- if( TheFileSystem->modLooseFile( AsciiString( "Data\\INI\\CommandSet.ini" ), &inModArchive ).isNotEmpty() || inModArchive )
- {
- const UnsignedInt modSetsMark = 0x4D4F4443; // "MODC"
- exeCRC.computeCRC( &modSetsMark, sizeof( modSetsMark ) );
- }
- }
m_exeCRC = exeCRC.get();
- DEBUG_LOG(("EXE CRC: 0x%8.8X (no user data folder %d, a mod's skirmish scripts %d)\n", m_exeCRC, noUserDataDir, modScripts));
+ DEBUG_LOG(("EXE CRC: 0x%8.8X (no user data folder %d)\n", m_exeCRC, noUserDataDir));
}
//-------------------------------------------------------------------------------------------------
@@ -1603,7 +1561,7 @@ void GlobalData::parseGameDataDefinition( INI* ini )
TheWritableGlobalData->m_windowMode = TheWritableGlobalData->m_windowed
? WINDOW_MODE_WINDOWED : WINDOW_MODE_FULLSCREEN;
- // These are loop bounds into fixed arrays, allocation sizes and divisors, and a mod's GameData
+ // These are loop bounds into fixed arrays, allocation sizes and divisors, and a GameData.ini
// can hold anything. The road buffers index with 16 bits and allocate four past the maximum.
const Int maxRoadBufferSize = 65535 - 4;
GlobalData *data = TheWritableGlobalData;
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp
index 7b1bf8f34..502d71d5e 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp
@@ -41,7 +41,6 @@
#include "Common/file.h"
#include "Common/FileSystem.h"
#include "Common/GameAudio.h"
-#include "Common/GlobalData.h"
#include "Common/NameKeyGenerator.h"
#include "Common/Science.h"
#include "Common/StackDump.h" // g_LastErrorDump, see prepFile
@@ -504,406 +503,6 @@ void INI::load( AsciiString filename, INILoadType loadType, Xfer *pXfer )
} // end load
-//-------------------------------------------------------------------------------------------------
-/** -modfactions: one pass of path per -mod, each seeing only its own files and reading its own names
- * with the mod's prefix. With no full -mod this does nothing. */
-//-------------------------------------------------------------------------------------------------
-void INI::loadModPasses( const char *path, Xfer *pXfer, Bool directory )
-{
- // the engine tests bring the control bar and the particle systems up without any GlobalData
- if (TheGlobalData == NULL || !TheGlobalData->m_modFactions)
- return;
-
- for (Int mod = 0; mod < (Int)TheGlobalData->m_mods.size(); ++mod)
- {
- TheFileSystem->setFocus( mod );
- TheModNamespace.setActive( mod );
- INI ini;
- if (directory)
- ini.loadDirectory( AsciiString( path ), TRUE, INI_LOAD_OVERWRITE, pXfer );
- else if (TheFileSystem->doesFileExist( path ))
- ini.load( AsciiString( path ), INI_LOAD_OVERWRITE, pXfer );
- TheModNamespace.setActive( -1 );
- TheFileSystem->setFocus( FILE_FOCUS_ALL );
- }
-}
-
-//-------------------------------------------------------------------------------------------------
-// ModNamespace
-//-------------------------------------------------------------------------------------------------
-ModNamespace TheModNamespace;
-
-const char *const ModNamespace::FactionFiles[] =
-{
- "Data\\INI\\Science.ini", "Data\\INI\\PlayerTemplate.ini", "Data\\INI\\FXList.ini", "Data\\INI\\Weapon.ini",
- "Data\\INI\\ObjectCreationList.ini", "Data\\INI\\Locomotor.ini", "Data\\INI\\SpecialPower.ini",
- "Data\\INI\\DamageFX.ini", "Data\\INI\\Armor.ini", "Data\\INI\\Object", "Data\\INI\\Crate.ini", "Data\\INI\\Upgrade.ini",
- "Data\\INI\\CommandButton.ini", "Data\\INI\\CommandSet.ini", "Data\\INI\\ParticleSystem.ini",
- "Data\\INI\\MappedImages", "Data\\INI\\Music.ini",
- "Data\\INI\\SoundEffects.ini", "Data\\INI\\Speech.ini", "Data\\INI\\Voice.ini",
- NULL
-};
-
-/// where a mod's art and sound sit; a word in its INI that names one of these files is read as the mod's copy
-static const char *const ModAssetFolders[] = { "Art\\W3D\\", "Art\\Textures\\", "Data\\Audio\\" };
-
-/// the block keywords whose second word is a name the mod defines
-static const struct { const char *keyword; ModNameType type; } ModBlockTypes[] =
-{
- { "Object", MODNAME_OBJECT }, { "ObjectReskin", MODNAME_OBJECT }, { "ChildObject", MODNAME_OBJECT },
- { "Weapon", MODNAME_WEAPON }, { "Armor", MODNAME_ARMOR }, { "DamageFX", MODNAME_DAMAGEFX },
- { "Upgrade", MODNAME_UPGRADE }, { "Science", MODNAME_SCIENCE }, { "SpecialPower", MODNAME_SPECIALPOWER },
- { "CommandSet", MODNAME_COMMANDSET }, { "CommandButton", MODNAME_COMMANDBUTTON }, { "FXList", MODNAME_FXLIST },
- { "ObjectCreationList", MODNAME_OCL }, { "ParticleSystem", MODNAME_PARTICLESYSTEM },
- { "Locomotor", MODNAME_LOCOMOTOR }, { "PlayerTemplate", MODNAME_PLAYERTEMPLATE },
- { "MappedImage", MODNAME_MAPPEDIMAGE },
- { "AudioEvent", MODNAME_AUDIOEVENT }, { "DialogEvent", MODNAME_AUDIOEVENT }, { "MusicTrack", MODNAME_AUDIOEVENT },
- { "CrateData", MODNAME_CRATE },
-};
-
-void ModNamespace::scanMods( void )
-{
- m_mods.assign( TheGlobalData->m_mods.size(), Names() );
- for (Int mod = 0; mod < (Int)m_mods.size(); ++mod)
- {
- TheFileSystem->setFocus( mod );
- FilenameList files;
- for (const char *const *path = FactionFiles; *path != NULL; ++path)
- {
- if (strstr( *path, ".ini" ) == NULL)
- {
- AsciiString dir( *path );
- dir.concat( '\\' );
- TheFileSystem->getFileListInDirectory( dir, "*.ini", files, TRUE );
- }
- else if (TheFileSystem->doesFileExist( *path ))
- {
- files.insert( AsciiString( *path ) );
- }
- }
- for (FilenameListIter it = files.begin(); it != files.end(); ++it)
- {
- File *file = TheFileSystem->openFile( it->str(), File::READ );
- const Int size = file->size();
- char *contents = file->readEntireAndClose();
- std::string text( contents, size );
- delete [] contents;
- // as INI::readLine: a byte order mark would hide the first block's name
- if (text.compare( 0, 3, "\xEF\xBB\xBF" ) == 0)
- text.erase( 0, 3 );
- for (size_t start = 0; start < text.size(); )
- {
- size_t end = text.find( '\n', start );
- if (end == std::string::npos)
- end = text.size();
- scanLine( mod, text.substr( start, end - start ).c_str() );
- start = end + 1;
- }
- }
- finishScan( mod );
-
- FilenameList assetFiles;
- for (size_t folder = 0; folder < ARRAY_SIZE( ModAssetFolders ); ++folder)
- TheFileSystem->getFileListInDirectory( AsciiString( ModAssetFolders[ folder ] ), "*.*", assetFiles, TRUE );
- for (FilenameListIter it = assetFiles.begin(); it != assetFiles.end(); ++it)
- addAsset( mod, it->str() );
- TheGameText->loadModStrings( mod );
- TheFileSystem->setFocus( FILE_FOCUS_ALL );
-
- const Names &names = m_mods[ mod ];
- DEBUG_LOG(( "MODNS M%d~ is '%s': %d names from %d files, %d objects, %d weapons, %d upgrades, %d sciences, %d player templates, %d images, %d audio events, %d asset names\n",
- mod + 1, TheGlobalData->m_modNames[ mod ].str(), (Int)names.all.size(), (Int)files.size(),
- (Int)names.byType[ MODNAME_OBJECT ].size(), (Int)names.byType[ MODNAME_WEAPON ].size(),
- (Int)names.byType[ MODNAME_UPGRADE ].size(), (Int)names.byType[ MODNAME_SCIENCE ].size(),
- (Int)names.byType[ MODNAME_PLAYERTEMPLATE ].size(), (Int)names.byType[ MODNAME_MAPPEDIMAGE ].size(),
- (Int)names.byType[ MODNAME_AUDIOEVENT ].size(), (Int)names.assets.size() ));
- }
-}
-
-void ModNamespace::scanLine( Int mod, const char *line )
-{
- static const char *SPACE = " \t\r\n";
- static const char *WORD_END = " \t\r\n=";
- std::string text( line );
- const size_t comment = text.find( ';' );
- if (comment != std::string::npos)
- text.erase( comment );
-
- const size_t keywordAt = text.find_first_not_of( SPACE );
- if (keywordAt == std::string::npos)
- return;
- const size_t keywordEnd = text.find_first_of( WORD_END, keywordAt );
- if (keywordEnd == std::string::npos)
- return;
- const std::string keyword = text.substr( keywordAt, keywordEnd - keywordAt );
- size_t nameAt = text.find_first_not_of( SPACE, keywordEnd );
- if (nameAt == std::string::npos)
- return;
-
- if ((Int)m_mods.size() <= mod)
- m_mods.resize( mod + 1 );
- Names &names = m_mods[ mod ];
- if (keyword == "Side" || keyword == "BaseSide")
- {
- if (text[ nameAt ] == '=')
- nameAt = text.find_first_not_of( SPACE, nameAt + 1 );
- if (nameAt != std::string::npos)
- names.sides.insert( text.substr( nameAt, text.find_first_of( WORD_END, nameAt ) - nameAt ) );
- return;
- }
- // "Weapon = PRIMARY X" is a field, "Weapon X" a definition
- if (text[ nameAt ] == '=')
- return;
-
- for (size_t i = 0; i < ARRAY_SIZE( ModBlockTypes ); ++i)
- {
- if (keyword == ModBlockTypes[ i ].keyword)
- {
- const std::string name = text.substr( nameAt, text.find_first_of( WORD_END, nameAt ) - nameAt );
- names.all.insert( name );
- names.byType[ ModBlockTypes[ i ].type ].insert( name );
- return;
- }
- }
-}
-
-void ModNamespace::finishScan( Int mod )
-{
- // a side is compared as text everywhere (Side = GLA), and The End of Days names a CommandSet "GLA"
- Names &names = m_mods[ mod ];
- for (std::set<std::string>::const_iterator it = names.sides.begin(); it != names.sides.end(); ++it)
- names.all.erase( *it );
- // nor a word the parser reads for itself: The Power of the West has an "FXList No", and every
- // "IsGrantable = No" became "M2~No", which is no Bool
- static const char *const Reserved[] = { "none", "no", "yes", "true", "false", "end", "default" };
- for (std::set<std::string>::iterator it = names.all.begin(); it != names.all.end(); )
- {
- Bool reserved = FALSE;
- for (size_t i = 0; i < ARRAY_SIZE( Reserved ) && !reserved; ++i)
- reserved = strcasecmp( it->c_str(), Reserved[ i ] ) == 0;
- if (reserved)
- it = names.all.erase( it );
- else
- ++it;
- }
-}
-
-/// A-Z only: the result goes into the INI checksum, so no locale may decide it
-static std::string foldAscii( const std::string &text )
-{
- std::string folded( text );
- for (size_t i = 0; i < folded.size(); ++i)
- {
- if (folded[ i ] >= 'A' && folded[ i ] <= 'Z')
- folded[ i ] = (char)(folded[ i ] - 'A' + 'a');
- }
- return folded;
-}
-
-void ModNamespace::addAsset( Int mod, const char *fileName )
-{
- const char *slash = strrchr( fileName, '\\' );
- const std::string name = foldAscii( slash != NULL ? slash + 1 : fileName );
- const size_t dot = name.rfind( '.' );
- if (dot == std::string::npos)
- return;
- const std::string base = name.substr( 0, dot );
- const std::string extension = name.substr( dot + 1 );
- if ((Int)m_mods.size() <= mod)
- m_mods.resize( mod + 1 );
- std::set<std::string> &assets = m_mods[ mod ].assets;
- // INI names a model or a sound without its extension, and a texture as .tga when the file is a .dds
- if (extension == "w3d")
- assets.insert( base );
- else if (extension == "wav" || extension == "mp3")
- {
- // Sounds names the base, a MusicTrack or streamed event's Filename the whole file name
- assets.insert( base );
- assets.insert( name );
- }
- else if (extension == "dds" || extension == "tga")
- {
- assets.insert( base + ".tga" );
- assets.insert( base + ".dds" );
- }
- else
- assets.insert( name );
-}
-
-Bool ModNamespace::isAsset( const Names &names, const std::string &word )
-{
- const std::string name = foldAscii( word );
- if (names.assets.count( name ) != 0)
- return TRUE;
- // an animation is "<hierarchy>.<animation>", and the file is the animation's
- const size_t dot = name.find( '.' );
- if (dot != std::string::npos)
- return names.assets.count( name.substr( dot + 1 ) ) != 0;
- // a shadow or radius decal names its texture with no extension, and the engine appends ".tga"
- return names.assets.count( name + ".tga" ) != 0;
-}
-
-Bool ModNamespace::isAssetField( const std::string &field )
-{
- // what a mod pass reads that names a file: draw modules, trees and props, debris, beams, particles,
- // shadows, mapped images and audio. ShowSubObject and the bone fields stay out, their words are
- // names inside a model and can match a file
- static const char *const AssetFields[] =
- {
- "Model", "Animation", "IdleAnimation", "ModelName", "ModelNames", "AnimationSet", "TextureName",
- "Texture", "ParticleName", "TrackMarks", "ShadowTexture",
- "Sounds", "SoundsMorning", "SoundsEvening", "SoundsNight", "Attack", "Decay", "Filename",
- };
- for (size_t i = 0; i < ARRAY_SIZE( AssetFields ); ++i)
- {
- if (strcasecmp( field.c_str(), AssetFields[ i ] ) == 0)
- return TRUE;
- }
- return FALSE;
-}
-
-/// "0", "6", "-1.5", "25%": digits with at most a sign, points and a closing percent
-static Bool isNumber( const std::string &word )
-{
- Bool digit = FALSE;
- for (size_t i = 0; i < word.size(); ++i)
- {
- const char c = word[ i ];
- if (c >= '0' && c <= '9')
- digit = TRUE;
- else if (!(c == '.' || ((c == '-' || c == '+') && i == 0) || (c == '%' && i + 1 == word.size())))
- return FALSE;
- }
- return digit;
-}
-
-Bool ModNamespace::isNameOrAsset( const std::string &word, Bool assetField ) const
-{
- // A number is a number. An animation's distance and repeat count sit in a file field, and with a
- // texture called 6.dds in the mod "IdleAnimation = X.X 0 6" read "M2~6", which is no Int: a parse
- // error at load under -modfactions.
- if (isNumber( word ))
- return FALSE;
- const Names &names = m_mods[ m_active ];
- return names.all.count( word ) != 0 || (assetField && isAsset( names, word ));
-}
-
-Bool ModNamespace::isModLabel( const std::string &word, Bool ) const
-{
- // the engine tests read mod INI with no GameText up
- return word.find( ':' ) != std::string::npos && TheGameText != NULL
- && TheGameText->hasModLabel( m_active, word.c_str() );
-}
-
-Bool ModNamespace::rewriteLine( char *line, size_t capacity ) const
-{
- return prefixWords( line, capacity, &ModNamespace::isNameOrAsset );
-}
-
-Bool ModNamespace::rewriteLabels( char *line, size_t capacity ) const
-{
- return prefixWords( line, capacity, &ModNamespace::isModLabel );
-}
-
-Bool ModNamespace::prefixWords( char *line, size_t capacity, WordTest test ) const
-{
- char prefix[ 16 ];
- snprintf( prefix, sizeof( prefix ), "M%d~", m_active + 1 );
-
- // INI's own separators; readLine has already turned every other control character into a space
- std::string out;
- Bool first = TRUE;
- Bool assetField = FALSE;
- for (const char *p = line; *p != 0; )
- {
- if (*p == ' ' || *p == '=')
- {
- out += *p++;
- continue;
- }
- const char *start = p;
- while (*p != 0 && *p != ' ' && *p != '=')
- ++p;
- const std::string word( start, p - start );
- if (first)
- {
- // only a field that names a file: a bone or sub-object can share a model's name
- assetField = isAssetField( word );
- out += word;
- first = FALSE;
- continue;
- }
- // a file field may name a subfolder ("Sub\x.mp3"); the file is its last part. "OCL:OCL_X" is a
- // parser's keyword and a name: only the name may be the mod's
- const size_t at = assetField ? lastPathPart( word ) : namedAfterKeyword( word );
- out.append( word, 0, at );
- if ((this->*test)( word.substr( at ), assetField ))
- out += prefix;
- out.append( word, at, std::string::npos );
- }
- if (out.size() >= capacity)
- return FALSE;
- memcpy( line, out.c_str(), out.size() + 1 );
- return TRUE;
-}
-
-size_t ModNamespace::lastPathPart( const std::string &word )
-{
- const size_t slash = word.find_last_of( "\\/" );
- return slash == std::string::npos ? 0 : slash + 1;
-}
-
-size_t ModNamespace::namedAfterKeyword( const std::string &word )
-{
- // the keywords the colon parsers (OCLUpdate, BridgeBehavior, BoneFXUpdate, TransitionDamageFX,
- // AutoDepositUpdate) read before a name; a CSF label such as "OBJECT:Ranger" is none of them
- static const char *const Keywords[] = { "Faction", "OCL", "FX", "FXList", "PSys", "UpgradeType" };
- const size_t colon = word.find( ':' );
- if (colon == std::string::npos)
- return 0;
- const std::string keyword = word.substr( 0, colon );
- for (size_t i = 0; i < ARRAY_SIZE( Keywords ); ++i)
- {
- if (strcasecmp( keyword.c_str(), Keywords[ i ] ) == 0)
- return colon + 1;
- }
- return 0;
-}
-
-Bool ModNamespace::findRetailName( const AsciiString &name, ModNameType type, AsciiString *retailName ) const
-{
- const char *text = name.str();
- // image and sound names may have been lowercased on the way here
- if (m_mods.empty() || (text[ 0 ] != 'M' && text[ 0 ] != 'm'))
- return FALSE;
- char *tilde = NULL;
- const long mod = strtol( text + 1, &tilde, 10 );
- if (tilde == text + 1 || *tilde != '~' || mod < 1 || mod > (long)m_mods.size())
- return FALSE;
- if (m_mods[ mod - 1 ].byType[ type ].count( tilde + 1 ) != 0)
- return FALSE;
- *retailName = tilde + 1;
- return TRUE;
-}
-
-Bool ModNamespace::findRetailKey( NameKeyType key, ModNameType type, NameKeyType *retailKey ) const
-{
- AsciiString retailName;
- if (m_mods.empty() || !findRetailName( TheNameKeyGenerator->keyToName( key ), type, &retailName ))
- return FALSE;
- *retailKey = TheNameKeyGenerator->nameToKey( retailName );
- return TRUE;
-}
-
-AsciiString ModNamespace::modName( Int mod, ModNameType type, const AsciiString &name ) const
-{
- if (mod >= (Int)m_mods.size() || m_mods[ mod ].byType[ type ].count( name.str() ) == 0)
- return name;
- AsciiString prefixed;
- prefixed.format( "M%d~%s", mod + 1, name.str() );
- return prefixed;
-}
-
//-------------------------------------------------------------------------------------------------
/** Read a line from the already open file. Any comments will be remved and
* therefore ignored from any given line */
@@ -974,27 +573,12 @@ void INI::readLine( void )
} // end if
}
- // -modfactions: the mod's own names, before the checksum below reads the line
- if (TheModNamespace.getActive() >= 0 && !TheModNamespace.rewriteLine(m_buffer, sizeof(m_buffer)))
- {
- g_LastErrorDump.format("INI::readLine: line %d of '%s' is too long once its mod names are prefixed\n", m_lineNum, m_filename.str());
- DEBUG_LOG(("%s", g_LastErrorDump.str()));
- throw INI_BUFFER_TOO_SMALL;
- }
-
if (s_xfer)
{
s_xfer->xferUser( m_buffer, sizeof( char ) * strlen( m_buffer ) );
//DEBUG_LOG(("Xfer val is now 0x%8.8X in %s, line %s\n", ((XferCRC *)s_xfer)->getCRC(),
//m_filename.str(), m_buffer));
}
-
- if (TheModNamespace.getActive() >= 0 && !TheModNamespace.rewriteLabels(m_buffer, sizeof(m_buffer)))
- {
- g_LastErrorDump.format("INI::readLine: line %d of '%s' is too long once its mod labels are prefixed\n", m_lineNum, m_filename.str());
- DEBUG_LOG(("%s", g_LastErrorDump.str()));
- throw INI_BUFFER_TOO_SMALL;
- }
}
//-------------------------------------------------------------------------------------------------
@@ -1201,7 +785,6 @@ void INI::parseBitInInt32( INI *ini, void *instance, void *store, const void* us
/*static*/ Bool INI::scanBool(const char* token)
{
// translate string yes/no into TRUE/FALSE
- token = withoutModPrefix( token );
if( strcasecmp( token, "yes" ) == 0 )
return TRUE;
else if( strcasecmp( token, "no" ) == 0 )
@@ -1282,8 +865,8 @@ void INI::parseAsciiStringVectorAppend( INI* ini, void * /*instance*/, void *sto
else
missing = TRUE;
}
- // a patch whose every science the mod lacks keeps the mod's own: Contra has no Chem_SCIENCE_RebelAmbush1,
- // and an emptied list left its Toxin General's ambush buttons with nothing to buy or show
+ // a patch whose every science the loaded data lacks keeps the list it had: an emptied list left the
+ // Toxin General's ambush buttons with nothing to buy or show once Chem_SCIENCE_RebelAmbush1 was gone
if (missing && asv->empty())
*asv = before;
}
@@ -1293,7 +876,7 @@ void INI::parseAsciiStringVectorAppend( INI* ini, void * /*instance*/, void *sto
AsciiString INI::getNextQuotedAsciiString()
{
AsciiString result;
- char buff[INI_MAX_CHARS_PER_PREFIXED_LINE]; // a token of m_buffer, prefixes and all
+ char buff[INI_MAX_CHARS_PER_LINE];
const char *token = getNextTokenOrNull(); // if null, just leave an empty string
if (token != NULL)
@@ -1353,7 +936,7 @@ AsciiString INI::getNextAsciiString()
}
else
{
- static char buff[INI_MAX_CHARS_PER_PREFIXED_LINE];
+ static char buff[INI_MAX_CHARS_PER_LINE];
buff[0] = 0;
if (strlen(token) > 1)
{
@@ -1901,8 +1484,8 @@ void INI::parseObjectCreationList( INI* ini, void * /*instance*/, void *store, c
const ObjectCreationList *ocl = TheObjectCreationListStore->findObjectCreationList(token); // could be null!
if (!ocl && strcasecmp(token, "None") != 0 && ini->getLoadType() == INI_LOAD_MULTIFILE)
{
- // a patch INI loaded over a mod, as with a missing special power: FixesReforged.ini's Emperor
- // Gattling upgrade names Tank_OCL_OverlordGattlingCannon, which Contra does not have
+ // a patch INI naming a list the loaded data lacks, as with a missing special power: FixesReforged.ini's
+ // Emperor Gattling upgrade names Tank_OCL_OverlordGattlingCannon
DEBUG_LOG(("[LINE: %d in '%s'] object creation list '%s' does not exist; the reference is skipped.\n", ini->getLineNum(), ini->getFilename().str(), token));
ini->setMissingReference( TRUE );
return;
@@ -1950,9 +1533,9 @@ void INI::parseSpecialPowerTemplate( INI* ini, void * /*instance*/, void *store,
const SpecialPowerTemplate *sPowerT = TheSpecialPowerStore->findSpecialPowerTemplate( AsciiString( token ) );
if( !sPowerT && strcasecmp( token, "None" ) != 0 && ini->getLoadType() == INI_LOAD_MULTIFILE )
{
- // a patch INI loaded over a mod, as with a missing science (scanScience): Contra has no Nuke_ carpet
- // bomb. A module naming it is dropped; a button keeps the mod's own power, or Contra's Toxin
- // General lost his ambush shortcut to Chem_SuperweaponRebelAmbush.
+ // a patch INI naming a power the loaded data lacks, as with a missing science (scanScience). A
+ // module naming it is dropped; a button keeps the power it had, or the Toxin General lost his
+ // ambush shortcut to a missing Chem_SuperweaponRebelAmbush.
DEBUG_LOG(("[LINE: %d in '%s'] special power '%s' does not exist; the reference is skipped.\n", ini->getLineNum(), ini->getFilename().str(), token));
ini->setMissingReference( TRUE );
return;
@@ -2181,7 +1764,7 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList
//-------------------------------------------------------------------------------------------------
/*static*/ ScienceType INI::scanScience(INI* ini, const char* token)
{
- // a patch INI loaded over a mod can name a science the mod renamed or removed
+ // a patch INI can name a science the loaded data renamed or does not have
if (ini->getLoadType() == INI_LOAD_MULTIFILE && !TheScienceStore->isValidScience((ScienceType)NAMEKEY(token)))
{
DEBUG_LOG(("[LINE: %d in '%s'] science '%s' does not exist; the reference is skipped.\n", ini->getLineNum(), ini->getFilename().str(), token));
@@ -2238,7 +1821,6 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList
}
// search for matching name
- token = withoutModPrefix( token );
Int count = 0;
for(ConstCharPtrArray name = nameList; *name; name++, count++ )
{
@@ -2263,7 +1845,6 @@ void INI::initFromINIMulti( void *what, const MultiIniFieldParse& parseTableList
}
// search for matching name
- token = withoutModPrefix( token );
Bool found = false;
for( const LookupListRec* lookup = &lookupList[0]; lookup->name; lookup++ )
{
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandButton.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandButton.cpp
index 8f7c53da5..a53e289ef 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandButton.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandButton.cpp
@@ -36,22 +36,12 @@
#include "Common/SpecialPower.h"
#include "Common/CommandStore.h"
#include "GameClient/ControlBar.h"
-#include "Common/StackDump.h" // g_LastErrorDump
//-------------------------------------------------------------------------------------------------
/** Parse a command button */
//-------------------------------------------------------------------------------------------------
void INI::parseCommandButtonDefinition( INI *ini )
{
- /* A mod's Data\INI\Object\ folder is read with the objects, before TheCommandStore exists, and a
- CommandButton block in it (ZH 1944's zz_WW2_40_CommandSet.ini) read through a NULL store. The
- block parse's catch names the file and line; this says why. */
- if( TheCommandStore == NULL )
- {
- g_LastErrorDump.format( "A CommandButton block in '%s' is read before command buttons exist; it belongs in Data\\INI\\CommandButton.ini\n",
- ini->getFilename().str() );
- throw INI_INVALID_DATA;
- }
CommandStore::parseCommandButtonDefinition(ini);
}
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandSet.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandSet.cpp
index 4941f5796..5322644f0 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandSet.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INICommandSet.cpp
@@ -34,19 +34,11 @@
#include "Common/INI.h"
#include "Common/CommandStore.h"
-#include "Common/StackDump.h" // g_LastErrorDump
//-------------------------------------------------------------------------------------------------
/** Parse a command set */
//-------------------------------------------------------------------------------------------------
void INI::parseCommandSetDefinition( INI *ini )
{
- // as a CommandButton block: one a mod put among its objects comes before the store exists
- if( TheCommandStore == NULL )
- {
- g_LastErrorDump.format( "A CommandSet block in '%s' is read before command sets exist; it belongs in Data\\INI\\CommandSet.ini\n",
- ini->getFilename().str() );
- throw INI_INVALID_DATA;
- }
CommandStore::parseCommandSetDefinition(ini);
} // end parseCommandSetDefinition
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIControlBarScheme.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIControlBarScheme.cpp
index 1d3e129bb..429438451 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIControlBarScheme.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIControlBarScheme.cpp
@@ -92,7 +92,7 @@ void INI::parseControlBarSchemeDefinition( INI *ini )
CBScheme = ini->getLoadType() == INI_LOAD_MULTIFILE ? CBSchemeManager->findControlBarScheme( name ) : NULL;
if( CBScheme == NULL && ini->getLoadType() == INI_LOAD_MULTIFILE )
{
- // A mod that renamed or dropped the scheme leaves the edit nothing to apply to, and a new scheme
+ // An edit of a scheme no file defines has nothing to apply to, and a new scheme
// holding only the edited fields has no ScreenCreationRes. The block goes into a scheme that
// is thrown away, so the parse reaches its End.
DEBUG_LOG(( "[LINE: %d in '%s'] %s patches a control bar scheme that does not exist; the block is skipped.\n", ini->getLineNum(), ini->getFilename().str(), name.str() ));
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/MultiplayerSettings.cpp b/GeneralsMD/Code/GameEngine/Source/Common/MultiplayerSettings.cpp
index 2986d9e56..ea77d9029 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/MultiplayerSettings.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/MultiplayerSettings.cpp
@@ -86,8 +86,8 @@ MultiplayerSettings::MultiplayerSettings()
m_gotDefaultStartingMoney = false;
- // The fork's starting cash choices, whatever Multiplayer.ini (retail's 5k, 10k, 20k, 50k, or a
- // mod's) lists; the INI still names the default.
+ // The fork's starting cash choices, whatever Multiplayer.ini (retail's 5k, 10k, 20k, 50k) lists;
+ // the INI still names the default.
static const UnsignedInt choices[] = { 10000, 25000, 50000, 100000, 500000, 1000000, Money::UNLIMITED };
for ( size_t i = 0; i < sizeof( choices ) / sizeof( choices[0] ); ++i )
m_startingMoneyList.push_back( Money( choices[i] ) );
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp
index 23328c667..f01c4f1d9 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp
@@ -875,8 +875,8 @@ void Player::setDefaultTeam(void) {
if (dt == NULL) {
/* A skirmish slot takes the name of the skirmish side its general's scripts are written for
(initFromDict), drops its own teamplayer<n>, and gets its teams from those scripts instead. A
- general the skirmish scripts have no player for - a mod's, under the fork's SkirmishScripts.scb -
- is left with no team at all, and the AI read the NULL on its first pass. Every player is given
+ general the skirmish scripts have no player for is left with no team at all, and the AI read
+ the NULL on its first pass. Every player is given
its default team here, so the singleton validateSides would have added is made now. */
DEBUG_LOG(("Player::setDefaultTeam - %s had no %s, making it\n", m_playerName.str(), tname.str()));
Dict d;
@@ -916,7 +916,6 @@ void Player::initFromDict(const Dict* d)
// poorly-formed user maps might not, which would be bad, and could crash us later. so if it doesn't
// actually have a skirmish player defined for this side, declare it nonskirmish... the player won't
// really work, but it's better than crashing.
- // -modfactions: a mod faction may have a skirmish player of its own mod's scripts, or retail's of its side
skirmish = pt != NULL && TheSidesList->findSkirmishSideFor(pt, NULL) != NULL;
DEBUG_ASSERTCRASH(skirmish, ("Could not find skirmish player for side %s... quietly making into nonskirmish.", getSide().str()));
@@ -975,7 +974,6 @@ void Player::initFromDict(const Dict* d)
AsciiString mySide = getSide();
Int i;
AsciiString qualTemplatePlayerName;
- // -modfactions: a mod faction runs its own mod's skirmish scripts and teams when the mod ships them
TeamsInfoRec *skirmishTeams = NULL;
SidesInfo *skirmishSide = TheSidesList->findSkirmishSideFor(getPlayerTemplate(), &skirmishTeams);
const Bool found = skirmishSide != NULL;
@@ -2803,14 +2801,6 @@ Bool Player::hasPrereqsForScience(ScienceType t) const
return TheScienceStore->playerHasPrereqsForScience(this, t);
}
-//=============================================================================
-/** The rank table a player climbs: under -modfactions a mod faction's is its own mod's Rank.ini, so
- * it gets that mod's ranks, points and rank sciences ("M<n>~SCIENCE_Rank3") and nothing of retail's. */
-static Int rankMod(const Player *player)
-{
- return player->getPlayerTemplate() ? player->getPlayerTemplate()->getModIndex() : -1;
-}
-
//=============================================================================
/// returns TRUE if the player gained/lost levels as a result.
Bool Player::addSkillPoints(Int delta)
@@ -2820,8 +2810,8 @@ Bool Player::addSkillPoints(Int delta)
if( delta == 0 )
return false;
- Int levelCap = min( TheGameLogic->getRankLevelLimit(), TheRankInfoStore->getRankLevelCount(rankMod(this)) );
- Int pointCap = TheRankInfoStore->getRankInfo(levelCap, rankMod(this))->m_skillPointsNeeded; // Cap at lowest point of cap level, not highest.
+ Int levelCap = min( TheGameLogic->getRankLevelLimit(), TheRankInfoStore->getRankLevelCount() );
+ Int pointCap = TheRankInfoStore->getRankInfo(levelCap)->m_skillPointsNeeded; // Cap at lowest point of cap level, not highest.
Bool levelGained = FALSE;
m_skillPoints = min( pointCap, (m_skillPoints + delta) );
@@ -2863,7 +2853,7 @@ void Player::resetSciences()
for (Int i = 1; i <= m_rankLevel; ++i)
{
- const RankInfo* rank = TheRankInfoStore->getRankInfo(i, rankMod(this));
+ const RankInfo* rank = TheRankInfoStore->getRankInfo(i);
if (rank)
{
for (ScienceVec::const_iterator it = rank->m_sciencesGranted.begin(); it != rank->m_sciencesGranted.end(); ++it)
@@ -3048,12 +3038,12 @@ void Player::resetRank()
{
m_rankLevel = 1;
m_skillPoints = 0;
- const RankInfo* nextRank = TheRankInfoStore->getRankInfo(m_rankLevel+1, rankMod(this));
+ const RankInfo* nextRank = TheRankInfoStore->getRankInfo(m_rankLevel+1);
m_levelUp = nextRank ? nextRank->m_skillPointsNeeded : INT_MAX;
m_levelDown = 0;
m_sciences.clear();
m_sciencePurchasePoints = getPlayerTemplate() ? getPlayerTemplate()->getIntrinsicSciencePurchasePoints() : 0;
- const RankInfo* curRank = TheRankInfoStore->getRankInfo(m_rankLevel, rankMod(this));
+ const RankInfo* curRank = TheRankInfoStore->getRankInfo(m_rankLevel);
m_sciencePurchasePoints += curRank ? curRank->m_sciencePurchasePointsGranted : 0;
m_generalName = TheGameText? TheGameText->fetch("SCIENCE:GeneralName"):UnicodeString::TheEmptyString;
resetSciences();
@@ -3065,8 +3055,8 @@ Bool Player::setRankLevel(Int newLevel)
{
if (newLevel < 1)
newLevel = 1;
- else if (newLevel > TheRankInfoStore->getRankLevelCount(rankMod(this)))
- newLevel = TheRankInfoStore->getRankLevelCount(rankMod(this));
+ else if (newLevel > TheRankInfoStore->getRankLevelCount())
+ newLevel = TheRankInfoStore->getRankLevelCount();
if (newLevel > TheGameLogic->getRankLevelLimit())
newLevel = TheGameLogic->getRankLevelLimit();
@@ -3086,7 +3076,7 @@ Bool Player::setRankLevel(Int newLevel)
for (Int i = m_rankLevel + 1; i <= newLevel; ++i)
{
- const RankInfo* rank = TheRankInfoStore->getRankInfo(i, rankMod(this));
+ const RankInfo* rank = TheRankInfoStore->getRankInfo(i);
DEBUG_ASSERTCRASH(rank, ("rank should never be null here"));
if (rank)
{
@@ -3108,7 +3098,7 @@ Bool Player::setRankLevel(Int newLevel)
}
}
- const RankInfo* nextRank = TheRankInfoStore->getRankInfo(newLevel + 1, rankMod(this));
+ const RankInfo* nextRank = TheRankInfoStore->getRankInfo(newLevel + 1);
m_levelUp = nextRank ? nextRank->m_skillPointsNeeded : INT_MAX;
m_rankLevel = newLevel;
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp
index 4147d8f2c..89c83f680 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerTemplate.cpp
@@ -200,7 +200,6 @@ AsciiString PlayerTemplate::getStartingUnit( Int i ) const
//-----------------------------------------------------------------------------
PlayerTemplate::PlayerTemplate() :
m_nameKey(NAMEKEY_INVALID),
- m_modIndex(-1),
m_observer(false),
m_playableSide(false),
m_oldFaction(false),
@@ -309,7 +308,7 @@ void PlayerTemplateStore::update()
//-----------------------------------------------------------------------------
/** A faction whose start building is not among the loaded objects cannot start a match: Turkiye's
- * command center is an ObjectReskin of America's, skipped under a mod that has none, and the match
+ * command center is an ObjectReskin of America's, skipped when the data has none, and the match
* stopped at frame 0 placing it. The name is emptied, as Civilian's and Observer's are, and every
* faction list and the Random draw already leave those out. A missing start unit is dropped the
* same way. The data alone decides it, so every machine with the same files agrees. */
@@ -344,7 +343,7 @@ Int PlayerTemplateStore::getTemplateNumByName(AsciiString name) const
if (m_playerTemplates[num].getName().compareNoCase(name.str()) == 0)
return num;
}
- // a query: -side and the challenge menu ask with names a mod's data may not have
+ // a query: -side and the challenge menu ask with names the data may not have
return -1;
}
@@ -401,8 +400,7 @@ const PlayerTemplate* PlayerTemplateStore::findPlayerTemplate(NameKeyType nameke
if ((*it).getNameKey() == namekey)
return &(*it);
}
- NameKeyType retailKey;
- return TheModNamespace.findRetailKey(namekey, MODNAME_PLAYERTEMPLATE, &retailKey) ? findPlayerTemplate(retailKey) : NULL;
+ return NULL;
}
//-----------------------------------------------------------------------------
@@ -470,7 +468,6 @@ void PlayerTemplateStore::getAllSideStrings(AsciiStringList *outStringList)
PlayerTemplate npt;
ini->initFromINI( &npt, npt.getFieldParse() );
npt.setNameKey(namekey);
- npt.setModIndex(TheModNamespace.getActive());
ThePlayerTemplateStore->m_playerTemplates.push_back(npt);
}
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp
index b358e5a68..2707119aa 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ProductionPrerequisite.cpp
@@ -98,7 +98,7 @@ void ProductionPrerequisite::resolveNames()
aren't yet loaded in the world builder but will all go away later anyway etc */
DEBUG_ASSERTCRASH(m_prereqUnits[i].unit,("could not find prereq %s\n",m_prereqUnits[i].name.str()));
- // a mod can name an Object it never defines; the name stays so a later load can still
+ // the data can name an Object it never defines; the name stays so a later load can still
// resolve it and the build tooltip can say what is missing. Until then the prereq is
// unsatisfiable: nothing a player owns matches a NULL template.
if( m_prereqUnits[i].unit )
@@ -230,7 +230,7 @@ void ProductionPrerequisite::addUnitPrereq( const std::vector<AsciiString>& unit
} // end addUnitPrereq
//-------------------------------------------------------------------------------------------------
-// a prereq a mod names but never defines has no template, only its INI name (resolveNames)
+// a prereq the data names but never defines has no template, only its INI name (resolveNames)
static UnicodeString prereqDisplayName(const ThingTemplate *unit, const AsciiString &name)
{
if (unit)
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp
index c5e1a661c..15b0a9fe9 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp
@@ -96,10 +96,6 @@ ScienceType ScienceStore::getScienceFromInternalName(const AsciiString& name) co
{
if (name.isEmpty())
return SCIENCE_INVALID;
- // a science is its name's key, found or not, so the -modfactions retail fallback is asked every time
- AsciiString retailName;
- if (TheModNamespace.findRetailName(name, MODNAME_SCIENCE, &retailName))
- return getScienceFromInternalName(retailName);
NameKeyType nkt = TheNameKeyGenerator->nameToKey(name);
ScienceType st = (ScienceType)nkt;
return st;
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp
index 8066f4519..8e2fb1a67 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp
@@ -282,9 +282,6 @@ SpecialPowerTemplate* SpecialPowerStore::findSpecialPowerTemplatePrivate( AsciiS
if( m_specialPowerTemplates[ i ]->getName() == name )
return m_specialPowerTemplates[ i ];
- AsciiString retailName;
- if( TheModNamespace.findRetailName( name, MODNAME_SPECIALPOWER, &retailName ) )
- return findSpecialPowerTemplatePrivate( retailName );
return NULL; // not found
}
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RandomMapTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RandomMapTemplate.cpp
index 0d43b301a..9b13c58d9 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/RandomMapTemplate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/RandomMapTemplate.cpp
@@ -6060,7 +6060,7 @@ Bool rmgSynthesise( const RandomMapSettings& clamped, const std::vector<char>& e
return FALSE;
}
- // the template is a file off the disk or a mod: bytes that end early refuse it rather than read past it
+ // the template is a file off the disk: bytes that end early refuse it rather than read past it
Exemplar src;
Bool loaded = FALSE;
try
@@ -6976,12 +6976,12 @@ void rmgGenerateFromTemplate( const RandomMapSettings& clamped, std::vector<char
{
mapBytes.clear();
/* The towns are told apart by the object INI, so without it there is nothing to build: the same
- name must never stand for two maps. Under -mod the INI may call other things a building, which
- the join's INI checksum refuses before any map is built, so the name carries no mod. */
+ name must never stand for two maps. Another INI may call other things a building, which the
+ join's INI checksum refuses before any map is built. */
if( TheThingFactory == NULL )
return;
- // the CRC of the bytes read now, not the one the name was checked against: a mod mounted since
- // may have put another file under the path
+ // the CRC of the bytes read now, not the one the name was checked against: another file may have
+ // been put under the path since
std::vector<char> exemplar;
if( !readTemplate( clamped.m_template, exemplar ) || crcOfTemplate( exemplar ) != clamped.m_templateCRC )
{
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/ArchiveFileSystem.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/ArchiveFileSystem.cpp
index 765f0db83..5a9e86318 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/System/ArchiveFileSystem.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/System/ArchiveFileSystem.cpp
@@ -50,13 +50,8 @@
#include "Common/ArchiveFile.h"
#include "Common/ArchiveFileSystem.h"
#include "Common/AsciiString.h"
-#include "Common/file.h"
-#include "Common/GlobalData.h"
-#include "Common/LocalFileSystem.h"
#include "Common/PerfTimer.h"
-#include <vector>
-
#ifdef _INTERNAL
// for occasional debugging...
//#pragma optimize("", off)
@@ -112,7 +107,7 @@ ArchiveFileSystem *TheArchiveFileSystem = NULL;
//------------------------------------------------------
// ArchivedFileInfo
//------------------------------------------------------
-ArchiveFileSystem::ArchiveFileSystem() : m_focus( FILE_FOCUS_ALL )
+ArchiveFileSystem::ArchiveFileSystem()
{
}
@@ -130,37 +125,22 @@ ArchiveFileSystem::~ArchiveFileSystem()
}
void ArchiveFileSystem::loadIntoDirectoryTree(const ArchiveFile *archiveFile, const AsciiString& archiveFilename, Bool overwrite)
-{
- addToTree(m_rootDirectory, archiveFile, archiveFilename, overwrite);
-}
-
-void ArchiveFileSystem::addToTree(ArchivedDirectoryInfo &root, const ArchiveFile *archiveFile, const AsciiString& archiveFilename, Bool overwrite)
{
FilenameList filenameList;
archiveFile->getFileListInDirectory(AsciiString(""), AsciiString(""), AsciiString("*"), filenameList, TRUE);
- // a mod's maps never go in, merged or kept apart: the maps are ours (FileSystem::isMapPath)
- const Bool modArchive = modLayerOf(archiveFilename).isNotEmpty();
- Int mapsIgnored = 0;
- Int uiKept = 0;
-
FilenameListIter it = filenameList.begin();
while (it != filenameList.end()) {
- if (modArchive && FileSystem::isMapPath(*it)) {
- ++mapsIgnored;
- it++;
- continue;
- }
// add this filename to the directory tree.
AsciiString path = *it;
path.toLower();
AsciiString token;
AsciiString debugpath;
- ArchivedDirectoryInfo *dirInfo = &root;
+ ArchivedDirectoryInfo *dirInfo = &m_rootDirectory;
Bool infoInPath;
infoInPath = path.nextToken(&token, "\\/");
@@ -180,225 +160,16 @@ void ArchiveFileSystem::addToTree(ArchivedDirectoryInfo &root, const ArchiveFile
}
// token is the filename, and dirInfo is the directory that this file is in.
- AsciiString path2;
- path2 = debugpath;
- path2.concat(token);
- // a merged mod's interface file stays out where retail or the fork has one (FileSystem::isForkUIPath);
- // an image sheet of it is still read first, under its "ModUI~" name, for the images only the mod
- // has. A texture our sheets name stays out even where only its other extension is ours, because
- // the loader takes a .dds before the .tga it was asked for.
- ArchivedFileLocationMap::const_iterator held = dirInfo->m_files.find(token);
- const Bool oursHeld = held != dirInfo->m_files.end() && modLayerOf(held->second).isEmpty();
- if (modArchive && &root == &m_rootDirectory && (isOurUITexture(path2) || (oursHeld && FileSystem::isForkUIPath(path2))))
- {
- if (path2.startsWith("data\\ini\\mappedimages\\"))
- m_modUICopies[path2] = archiveFilename;
- ++uiKept;
- it++;
- continue;
- }
- if (held == dirInfo->m_files.end() || overwrite) {
+ if (dirInfo->m_files.find(token) == dirInfo->m_files.end() || overwrite) {
+ AsciiString path2;
+ path2 = debugpath;
+ path2.concat(token);
// DEBUG_LOG(("ArchiveFileSystem::loadIntoDirectoryTree - adding file %s, archived in %s\n", path2.str(), archiveFilename.str()));
dirInfo->m_files[token] = archiveFilename;
}
it++;
}
- if (mapsIgnored > 0)
- DEBUG_LOG(("ArchiveFileSystem - %d map files in %s are ignored, the maps are ours\n", mapsIgnored, archiveFilename.str()));
- if (uiKept > 0)
- DEBUG_LOG(("ArchiveFileSystem - %d interface files in %s are ignored, the interface is ours\n", uiKept, archiveFilename.str()));
-}
-
-Bool ArchiveFileSystem::isOurUITexture(const AsciiString& filename) const
-{
- AsciiString path = filename;
- path.toLower();
- return m_uiTextures.find(path) != m_uiTextures.end();
-}
-
-void ArchiveFileSystem::getModUICopies(const AsciiString& directory, std::vector<AsciiString> &names) const
-{
- AsciiString prefix = directory;
- prefix.toLower();
- prefix.concat('\\');
- for (std::map<AsciiString, AsciiString>::const_iterator it = m_modUICopies.begin(); it != m_modUICopies.end(); ++it)
- {
- if (it->first.startsWith(prefix.str()))
- {
- AsciiString name;
- name.format("%s%s", MOD_UI_COPY, it->first.str());
- names.push_back(name);
- }
- }
-}
-
-/// every texture our interface image sheets name, read from the sheets retail and the fork hold before
-/// any mod is in the tree; the loader may ask for either the .tga or the .dds of one
-void ArchiveFileSystem::collectUITextures()
-{
- FilenameList sheets;
- getFileListInDirectory(AsciiString(""), AsciiString("Data\\INI\\MappedImages\\"), AsciiString("*.ini"), sheets, TRUE);
- for (FilenameListIter sheet = sheets.begin(); sheet != sheets.end(); ++sheet)
- {
- if (!FileSystem::isForkUIPath(*sheet))
- continue;
- File *file = openFile(sheet->str());
- std::string text(file->size(), '\0');
- file->read(&text[0], (Int)text.size());
- file->close();
- size_t at = 0;
- while (at < text.size())
- {
- size_t end = text.find('\n', at);
- if (end == std::string::npos)
- end = text.size();
- std::string line = text.substr(at, end - at);
- at = end + 1;
- line = line.substr(0, line.find(';'));
- const size_t equals = line.find('=');
- if (equals == std::string::npos)
- continue;
- AsciiString key = line.substr(0, equals).c_str();
- AsciiString value = line.substr(equals + 1).c_str();
- key.trim();
- value.trim();
- if (key.compareNoCase("Texture") != 0 || value.isEmpty())
- continue;
- value.toLower();
- AsciiString path;
- path.format("art\\textures\\%s", value.str());
- m_uiTextures.insert(path);
- if (path.endsWith(".tga"))
- {
- AsciiString dds = std::string(path.str(), path.getLength() - 4).c_str();
- dds.concat(".dds");
- m_uiTextures.insert(dds);
- }
- }
- }
- DEBUG_LOG(("ArchiveFileSystem::loadMods - %d interface textures stay ours\n", (Int)m_uiTextures.size()));
-}
-
-/// the fork's upscaled art goes by its file name, ReforgedTextures.big and the like
-static Bool isReforgedArchiveName(const AsciiString &path)
-{
- const char *slash = strrchr(path.str(), '\\');
- const char *forward = strrchr(path.str(), '/');
- const char *name = path.str();
- if (slash != NULL && slash + 1 > name)
- name = slash + 1;
- if (forward != NULL && forward + 1 > name)
- name = forward + 1;
- return strncasecmp(name, "Reforged", 8) == 0;
-}
-
-void ArchiveFileSystem::loadMods() {
- if (TheGlobalData->m_mods.empty())
- return;
-
- // retail < mods < the fork: the fork's Reforged*.big already in the tree go back on top afterwards.
- // ReforgedUI.big is EA's interface pages redrawn cell by cell, and a mod that ships its own copy of a
- // page has its own cameos at its own coordinates in it, so that one stays under the mods.
- std::vector<AsciiString> forkArt;
- for (ArchiveFileMap::const_iterator it = m_archiveFileMap.begin(); it != m_archiveFileMap.end(); ++it)
- {
- if (isReforgedArchiveName(it->first) && !it->first.endsWithNoCase("ReforgedUI.big"))
- forkArt.push_back(it->first);
- }
-
- collectUITextures();
-
- // -modfactions loads retail's factions and each mod's from their own files (FileSystem::setFocus)
- if (TheGlobalData->m_modFactions)
- keepModsApart(TheGlobalData->m_mods.size());
-
- // In command-line order, each with overwrite: a later -mod wins over an earlier one, and all of them
- // over the retail archives. Under -modfactions a -modpatch goes over the full mod it was given
- // after, in that mod's own tree, or over retail's when it came first (-1). Inside one folder the
- // first name wins, as in Win32BIGFileSystem's plain pass, so a mod's "!!" or "00_" archive is its
- // patch: the folder goes in descending name order, each with overwrite.
- std::vector< std::pair<Int, AsciiString> > layers;
- for (size_t i = 0; i < TheGlobalData->m_retailPatches.size(); ++i)
- layers.push_back(std::make_pair(-1, TheGlobalData->m_retailPatches[i]));
- for (size_t i = 0; i < TheGlobalData->m_mods.size(); ++i)
- {
- layers.push_back(std::make_pair((Int)i, TheGlobalData->m_mods[i]));
- for (size_t p = 0; i < TheGlobalData->m_modPatches.size() && p < TheGlobalData->m_modPatches[i].size(); ++p)
- layers.push_back(std::make_pair((Int)i, TheGlobalData->m_modPatches[i][p]));
- }
- for (size_t layer = 0; layer < layers.size(); ++layer)
- {
- const AsciiString &mod = layers[layer].second;
- FilenameList archives;
- if (mod.endsWith("\\") || mod.endsWith("/"))
- TheLocalFileSystem->getFileListInDirectory(mod, AsciiString(""), AsciiString("*.big"), archives, TRUE);
- else
- archives.insert(mod);
-
- for (FilenameList::reverse_iterator it = archives.rbegin(); it != archives.rend(); ++it)
- {
- if (isReforgedArchiveName(*it))
- {
- DEBUG_LOG(("ArchiveFileSystem::loadMods - %s is ignored, the fork's own Reforged archives win\n", it->str()));
- continue;
- }
- ArchiveFile *archiveFile = openArchiveFile(it->str());
- if (archiveFile == NULL)
- {
- DEBUG_LOG(("ArchiveFileSystem::loadMods - could not openArchiveFile(%s)\n", it->str()));
- continue;
- }
- DEBUG_LOG(("ArchiveFileSystem::loadMods - loading %s into the directory tree.\n", it->str()));
- m_archiveLayer[*it] = mod;
- addModArchive(layers[layer].first, archiveFile, *it);
- }
- }
-
- for (size_t i = 0; i < forkArt.size(); ++i)
- {
- DEBUG_LOG(("ArchiveFileSystem::loadMods - %s back over the mods\n", forkArt[i].str()));
- loadIntoDirectoryTree(m_archiveFileMap[forkArt[i]], forkArt[i], TRUE);
- }
-}
-
-AsciiString ArchiveFileSystem::modLayerOf(const AsciiString& archiveFilename) const
-{
- std::map<AsciiString, AsciiString>::const_iterator it = m_archiveLayer.find(archiveFilename);
- return it == m_archiveLayer.end() ? AsciiString() : it->second;
-}
-
-void ArchiveFileSystem::keepModsApart(size_t modCount)
-{
- m_modRoots.assign(modCount, ArchivedDirectoryInfo());
-}
-
-void ArchiveFileSystem::addModArchive(Int mod, ArchiveFile *archiveFile, const AsciiString& archiveFilename)
-{
- m_archiveFileMap[archiveFilename] = archiveFile;
- // kept apart, a mod's files are reached only through its own focus or an "M<n>~" name: the merged
- // view stays retail's, so the menus, the lobby and every file a faction does not name are ours
- if (!m_modRoots.empty() && mod >= 0)
- {
- addToTree(m_modRoots[mod], archiveFile, archiveFilename, TRUE);
- m_archiveMod[archiveFilename] = mod;
- return;
- }
- loadIntoDirectoryTree(archiveFile, archiveFilename, TRUE);
-}
-
-const ArchivedDirectoryInfo &ArchiveFileSystem::focusedRoot() const
-{
- return m_focus < 0 ? m_rootDirectory : m_modRoots[m_focus];
-}
-
-Bool ArchiveFileSystem::inFocus(const AsciiString& archiveFilename) const
-{
- if (m_focus == FILE_FOCUS_ALL && m_modRoots.empty())
- return TRUE;
- std::map<AsciiString, Int>::const_iterator it = m_archiveMod.find(archiveFilename);
- const Int owner = it == m_archiveMod.end() ? FILE_FOCUS_RETAIL : it->second;
- return m_focus < 0 ? owner < 0 : owner == m_focus;
}
Bool ArchiveFileSystem::doesFileExist(const Char *filename) const
@@ -407,7 +178,7 @@ Bool ArchiveFileSystem::doesFileExist(const Char *filename) const
path.toLower();
AsciiString token;
- const ArchivedDirectoryInfo *dirInfo = &focusedRoot();
+ const ArchivedDirectoryInfo *dirInfo = &m_rootDirectory;
path.nextToken(&token, "\\/");
@@ -435,12 +206,6 @@ Bool ArchiveFileSystem::doesFileExist(const Char *filename) const
File * ArchiveFileSystem::openFile(const Char *filename, Int access /* = 0 */)
{
- if (strncmp(filename, MOD_UI_COPY, strlen(MOD_UI_COPY)) == 0)
- {
- const Char *path = filename + strlen(MOD_UI_COPY);
- return m_archiveFileMap[m_modUICopies[AsciiString(path)]]->openFile(path, access);
- }
-
AsciiString archiveFilename;
archiveFilename = getArchiveFilenameForFile(AsciiString(filename));
@@ -539,28 +304,6 @@ void ArchiveFileSystem::prioritizeLargerFiles(const AsciiString& directory, cons
}
AsciiString ArchiveFileSystem::getArchiveFilenameForFile(const AsciiString& filename) const
-{
- return archiveInTree(focusedRoot(), filename);
-}
-
-File *ArchiveFileSystem::openModFile(Int mod, const AsciiString& filename, Int access)
-{
- const AsciiString archive = archiveInTree(m_modRoots[mod], filename);
- return archive.isEmpty() ? NULL : m_archiveFileMap[archive]->openFile(filename.str(), access);
-}
-
-Bool ArchiveFileSystem::doesModFileExist(Int mod, const AsciiString& filename) const
-{
- return archiveInTree(m_modRoots[mod], filename).isNotEmpty();
-}
-
-Bool ArchiveFileSystem::getModFileInfo(Int mod, const AsciiString& filename, FileInfo *fileInfo) const
-{
- ArchiveFileMap::const_iterator it = m_archiveFileMap.find(archiveInTree(m_modRoots[mod], filename));
- return it != m_archiveFileMap.end() && it->second->getFileInfo(filename, fileInfo);
-}
-
-AsciiString ArchiveFileSystem::archiveInTree(const ArchivedDirectoryInfo &root, const AsciiString& filename)
{
AsciiString path;
path = filename;
@@ -568,7 +311,7 @@ AsciiString ArchiveFileSystem::archiveInTree(const ArchivedDirectoryInfo &root,
AsciiString token;
AsciiString debugpath;
- const ArchivedDirectoryInfo *dirInfo = &root;
+ const ArchivedDirectoryInfo *dirInfo = &m_rootDirectory;
path.nextToken(&token, "\\/");
@@ -617,18 +360,7 @@ void ArchiveFileSystem::getFileListInDirectory(const AsciiString& currentDirecto
{
ArchiveFileMap::const_iterator it = m_archiveFileMap.begin();
while (it != m_archiveFileMap.end()) {
- if (inFocus(it->first) && modLayerOf(it->first).isEmpty())
- it->second->getFileListInDirectory(currentDirectory, originalDirectory, searchName, filenameList, searchSubdirectories);
- else if (inFocus(it->first))
- {
- FilenameList modded;
- it->second->getFileListInDirectory(currentDirectory, originalDirectory, searchName, modded, searchSubdirectories);
- for (FilenameListIter name = modded.begin(); name != modded.end(); ++name)
- {
- if (!FileSystem::isMapPath(*name))
- filenameList.insert(*name);
- }
- }
+ it->second->getFileListInDirectory(currentDirectory, originalDirectory, searchName, filenameList, searchSubdirectories);
it++;
}
}
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/CommandStore.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/CommandStore.cpp
index 249e58ac3..ca84995b3 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/System/CommandStore.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/System/CommandStore.cpp
@@ -67,10 +67,6 @@ void CommandStore::init( void )
ini.load( AsciiString( "Data\\INI\\CommandButton.ini" ), INI_LOAD_OVERWRITE, NULL );
ini.load( AsciiString( "Data\\INI\\CommandSet.ini" ), INI_LOAD_OVERWRITE, NULL );
- // -modfactions: each mod's buttons and sets after retail's, under its names
- INI::loadModPasses( "Data\\INI\\CommandButton.ini", NULL );
- INI::loadModPasses( "Data\\INI\\CommandSet.ini", NULL );
-
// the fork's corrections to EA's buttons and sets, edited in place
ini.load( AsciiString( "Data\\INI\\CommandSetReforged.ini" ), INI_LOAD_MULTIFILE, NULL );
@@ -120,9 +116,6 @@ CommandButton *CommandStore::findNonConstCommandButton( const AsciiString& name
if( command->getName() == name )
return const_cast<CommandButton*>((const CommandButton*)command->getFinalOverride());
- AsciiString retailName;
- if( TheModNamespace.findRetailName( name, MODNAME_COMMANDBUTTON, &retailName ) )
- return findNonConstCommandButton( retailName );
return NULL; // not found
}
@@ -135,9 +128,6 @@ CommandSet* CommandStore::findNonConstCommandSet( const AsciiString& name )
if( set->getName() == name )
return const_cast<CommandSet*>((const CommandSet *) set);
- AsciiString retailName;
- if( TheModNamespace.findRetailName( name, MODNAME_COMMANDSET, &retailName ) )
- return findNonConstCommandSet( retailName );
return NULL; // set not found
}
@@ -248,29 +238,9 @@ CommandSet *CommandStore::newCommandSetOverride( CommandSet *setToOverride )
} // end if
else if( ini->getLoadType() == INI_LOAD_MULTIFILE )
{
- // The fork's sets are EA's with corrections. A mod that ships its own CommandSet.ini fills the
- // same names with its own buttons, and a set replaced whole took Contra's Demolitions General
- // his power tray and left its Air Force General two columns of promotions. The mod's set stays.
- Bool inModArchive = FALSE;
- if( TheFileSystem->modLooseFile( AsciiString( "Data\\INI\\CommandSet.ini" ), &inModArchive ).isNotEmpty() || inModArchive )
- {
- CommandSet *unused = newInstance(CommandSet)( name );
- ini->initFromINI( unused, unused->friend_getFieldParse() );
- unused->deleteInstance();
- return;
- }
-
// a patch file's set replaces the set whole, in place, so every pointer to it stays good
commandSet->friend_clearCommands();
}
- else if( ini->getLoadType() == INI_LOAD_OVERWRITE )
- {
- // two mods under -modfactions can both name a set "CommandSet GLA" once their Side names are
- // stripped; the later one wins, as a patch file's does, instead of refusing the whole load
- DEBUG_LOG(( "[LINE: %d in '%s'] commandset %s defined again, the later one replaces it\n",
- ini->getLineNum(), ini->getFilename().str(), name.str() ));
- commandSet->friend_clearCommands();
- }
else if( ini->getLoadType() != INI_LOAD_CREATE_OVERRIDES )
{
//Holy crap, this sucks to debug!!!
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/FileSystem.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/FileSystem.cpp
index db023e16b..667dbbcde 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/System/FileSystem.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/System/FileSystem.cpp
@@ -54,24 +54,14 @@
#include "Common/ArchiveFileSystem.h"
#include "Common/CDManager.h"
#include "Common/GameAudio.h"
-#include "Common/GlobalData.h"
#include "Common/LocalFileSystem.h"
#include "Common/PerfTimer.h"
#include "Common/RAMFile.h"
#include "Common/RandomMapGenerator.h"
-#include <set>
-#include <string>
-
DECLARE_PERF_TIMER(FileSystem)
-/// a drive or a root: the user data folder and the like, which a mod folder never stands in for
-static Bool isAbsolutePath( const AsciiString &path )
-{
- return strchr( path.str(), ':' ) != NULL || path.startsWith( "\\" ) || path.startsWith( "/" );
-}
-
//----------------------------------------------------------------------------
// Externals
//----------------------------------------------------------------------------
@@ -135,97 +125,11 @@ FileSystem *TheFileSystem = NULL;
// FileSystem::FileSystem
//============================================================================
-Int FileSystem::s_focus = FILE_FOCUS_ALL;
-
FileSystem::FileSystem()
{
}
-//============================================================================
-// FileSystem::setFocus
-//============================================================================
-
-void FileSystem::setFocus( Int focus )
-{
- s_focus = focus;
- TheArchiveFileSystem->setFocus( focus );
-}
-
-//============================================================================
-// FileSystem::focusedLooseFile
-//============================================================================
-
-AsciiString FileSystem::focusedLooseFile( const AsciiString& filename ) const
-{
- // retail is Run's own loose files under the patches given before any -mod (modLooseFile); a mod is
- // its folder's and its patches', and a mod that is one .big has none
- if (s_focus == FILE_FOCUS_RETAIL)
- {
- Bool inPatchArchive = FALSE;
- AsciiString patched = modLooseFile( filename, &inPatchArchive );
- if (patched.isNotEmpty() || inPatchArchive)
- return patched;
- return TheLocalFileSystem->doesFileExist( filename.str() ) ? filename : AsciiString();
- }
-
- return modFolderFile( s_focus, filename );
-}
-
-/** -modfactions: the folders a faction set's loose files come from, its -modpatch ones after the
- * mod's own so they win. FILE_FOCUS_RETAIL is the patches given before any -mod. */
-static std::vector<AsciiString> modLayers( Int mod )
-{
- if (mod < 0)
- return TheGlobalData->m_retailPatches;
- std::vector<AsciiString> layers( 1, TheGlobalData->m_mods[ mod ] );
- if (mod < (Int)TheGlobalData->m_modPatches.size())
- layers.insert( layers.end(), TheGlobalData->m_modPatches[ mod ].begin(), TheGlobalData->m_modPatches[ mod ].end() );
- return layers;
-}
-
-AsciiString FileSystem::modFolderFile( Int mod, const AsciiString& filename ) const
-{
- const std::vector<AsciiString> layers = modLayers( mod );
- for (size_t i = layers.size(); i-- > 0; )
- {
- if (!layers[i].endsWith( "\\" ) && !layers[i].endsWith( "/" ))
- continue;
- AsciiString path = layers[i];
- path.concat( filename );
- if (TheLocalFileSystem->doesFileExist( path.str() ))
- return path;
- }
- return AsciiString();
-}
-
-//============================================================================
-// FileSystem::splitModName
-//============================================================================
-
-Bool FileSystem::splitModName( const AsciiString& filename, Int *mod, AsciiString *bare )
-{
- if (TheGlobalData == NULL || !TheGlobalData->m_modFactions)
- return FALSE;
- const char *path = filename.str();
- const char *name = path;
- for (const char *p = path; *p != 0; ++p)
- {
- if (*p == '\\' || *p == '/')
- name = p + 1;
- }
- if ((name[ 0 ] != 'M' && name[ 0 ] != 'm') || name[ 1 ] < '0' || name[ 1 ] > '9')
- return FALSE;
- char *tilde = NULL;
- const long n = strtol( name + 1, &tilde, 10 );
- if (*tilde != '~' || n < 1 || n > (long)TheGlobalData->m_mods.size())
- return FALSE;
- *mod = (Int)n - 1;
- *bare = std::string( path, name - path ).c_str();
- bare->concat( tilde + 1 );
- return TRUE;
-}
-
//============================================================================
// FileSystem::~FileSystem
//============================================================================
@@ -269,8 +173,8 @@ void FileSystem::reset( void )
USE_PERF_TIMER(FileSystem)
// doesFileExist remembers its answer for the life of the process and this is the only place
- // that ever gets told the world underneath it changed. A "no" cached before a mod archive was
- // mounted, or before Win32BIGFileSystem::init re-loaded the Patch*.big over the plain pass, made
+ // that ever gets told the world underneath it changed. A "no" cached before
+ // Win32BIGFileSystem::init re-loaded the Patch*.big over the plain pass made
// that file invisible for the rest of the run - and the cache is keyed by name, so nothing else
// would ever ask again.
{
@@ -310,41 +214,6 @@ File* FileSystem::openFile( const Char *filename, Int access )
return NULL;
}
- const Bool readOnly = (access & (File::WRITE | File::CREATE | File::APPEND | File::TRUNCATE)) == 0;
- Int mod;
- AsciiString bare;
- if ( readOnly && splitModName( AsciiString( filename ), &mod, &bare ) )
- {
- AsciiString loose = modFolderFile( mod, bare );
- if ( loose.isNotEmpty() )
- return TheLocalFileSystem->openFile( loose.str(), access );
- return TheArchiveFileSystem->openModFile( mod, bare, access );
- }
- if ( readOnly && s_focus != FILE_FOCUS_ALL )
- {
- AsciiString loose = focusedLooseFile( AsciiString( filename ) );
- if ( loose.isNotEmpty() )
- return TheLocalFileSystem->openFile( loose.str(), access );
- return TheArchiveFileSystem->openFile( filename, access );
- }
-
- // a mod's copy, loose or archived, goes in front of Run's own loose files and every other archive;
- // writes stay where they were
- if ( readOnly )
- {
- Bool inModArchive = FALSE;
- AsciiString modded = modLooseFile( AsciiString( filename ), &inModArchive );
- if ( modded.isNotEmpty() )
- {
- DEBUG_LOG(( "FileSystem::openFile - mod file %s\n", modded.str() ));
- return TheLocalFileSystem->openFile( modded.str(), access );
- }
- if ( inModArchive )
- {
- return TheArchiveFileSystem->openFile( filename, access );
- }
- }
-
if ( TheLocalFileSystem != NULL )
{
file = TheLocalFileSystem->openFile( filename, access );
@@ -381,15 +250,6 @@ Bool FileSystem::doesFileExist(const Char *filename) const
if (isGeneratedMapPath( AsciiString( filename ) ))
return TRUE;
- Int mod;
- AsciiString bare;
- if (splitModName( AsciiString( filename ), &mod, &bare ))
- return modFolderFile( mod, bare ).isNotEmpty() || TheArchiveFileSystem->doesModFileExist( mod, bare );
-
- // the cache is the merged view's; a focus asks its own files every time (setFocus)
- if (s_focus != FILE_FOCUS_ALL)
- return focusedLooseFile( AsciiString( filename ) ).isNotEmpty() || TheArchiveFileSystem->doesFileExist( filename );
-
unsigned key=TheNameKeyGenerator->nameToLowercaseKey(filename);
{
std::lock_guard<std::mutex> lock( m_fileExistLock );
@@ -400,7 +260,7 @@ Bool FileSystem::doesFileExist(const Char *filename) const
// asked unlocked, so a slow disk does not hold the other thread up; two threads asking the same
// name both find the same answer and store it twice
- const Bool exists = TheLocalFileSystem->doesFileExist(filename) || modLooseFile(AsciiString(filename)).isNotEmpty()
+ const Bool exists = TheLocalFileSystem->doesFileExist(filename)
|| (TheArchiveFileSystem != NULL && TheArchiveFileSystem->doesFileExist(filename));
std::lock_guard<std::mutex> lock( m_fileExistLock );
@@ -414,220 +274,8 @@ Bool FileSystem::doesFileExist(const Char *filename) const
void FileSystem::getFileListInDirectory(const AsciiString& directory, const AsciiString& searchName, FilenameList &filenameList, Bool searchSubdirectories) const
{
USE_PERF_TIMER(FileSystem)
- // a mod's focus does not see Run's own loose files, retail's sees no mod's (setFocus)
- if (s_focus < 0)
- {
- TheLocalFileSystem->getFileListInDirectory(AsciiString(""), directory, searchName, filenameList, searchSubdirectories);
- }
+ TheLocalFileSystem->getFileListInDirectory(AsciiString(""), directory, searchName, filenameList, searchSubdirectories);
TheArchiveFileSystem->getFileListInDirectory(AsciiString(""), directory, searchName, filenameList, searchSubdirectories);
-
- // a mod's loose files listed under their game path, so a file it replaces is loaded once, from the mod (openFile)
- // TheGlobalData is not there yet while GameData.ini itself loads, and there is no -mod before it is
- // -modfactions' merged view is retail's with the patches given before any -mod, and a focus sees
- // its own mod and that mod's patches
- if (TheGlobalData == NULL || isAbsolutePath(directory))
- {
- return;
- }
- const std::vector<AsciiString> folders = TheGlobalData->m_modFactions ? modLayers(s_focus) : TheGlobalData->m_mods;
- for (size_t i = 0; i < folders.size(); ++i)
- {
- const AsciiString &modDir = folders[i];
- if (!modDir.endsWith("\\") && !modDir.endsWith("/"))
- {
- continue; // a .big, already in the archive tree
- }
- AsciiString modDirectory = modDir;
- modDirectory.concat(directory);
- FilenameList modded;
- TheLocalFileSystem->getFileListInDirectory(AsciiString(""), modDirectory, searchName, modded, searchSubdirectories);
- for (FilenameListIter it = modded.begin(); it != modded.end(); ++it)
- {
- AsciiString gamePath = it->str() + modDir.getLength();
- if (!isMapPath(gamePath))
- filenameList.insert(gamePath);
- }
- }
-}
-
-//============================================================================
-// FileSystem::modLooseFile
-//============================================================================
-AsciiString FileSystem::modLooseFile(const AsciiString& filename, Bool *inModArchive) const
-{
- if (inModArchive != NULL)
- {
- *inModArchive = FALSE;
- }
- // a folder is not a file: "" or "Maps\" would otherwise find the mod folder itself, which exists
- // -modfactions reaches a mod's files only by its focus or its "M<n>~" names, so here only the
- // patches given before any -mod go over retail's
- if (TheGlobalData == NULL || isAbsolutePath(filename) || filename.isEmpty() || filename.endsWith("\\") || filename.endsWith("/") || isMapPath(filename))
- {
- return AsciiString();
- }
- const std::vector<AsciiString> &mods = TheGlobalData->m_modFactions ? TheGlobalData->m_retailPatches : TheGlobalData->m_mods;
- if (mods.empty())
- {
- return AsciiString();
- }
-
- // The last -mod that has the file wins, whether it has it loose or in an archive: a later mod's
- // .big beats an earlier mod's loose copy. An archive is a mod's when loadMods loaded it for that
- // mod, not when its name merely starts with the mod's folder: a -mod naming the install folder, or
- // a folder above another -mod's, claimed every archive under it by the text alone.
- const AsciiString archive = TheArchiveFileSystem->getArchiveFilenameForFile(filename);
- const AsciiString archiveLayer = TheArchiveFileSystem->modLayerOf(archive);
- AsciiString loose;
- Bool archived = FALSE;
- for (size_t i = mods.size(); i-- > 0 && loose.isEmpty() && !archived; )
- {
- const AsciiString &mod = mods[i];
- const Bool isFolder = mod.endsWith("\\") || mod.endsWith("/");
- if (isFolder)
- {
- AsciiString path = mod;
- path.concat(filename);
- if (TheLocalFileSystem->doesFileExist(path.str()))
- {
- loose = path;
- break;
- }
- }
- archived = archiveLayer.isNotEmpty() && archiveLayer.compareNoCase(mod) == 0;
- }
-
- // ...except over a file the fork ships: retail < mods < the fork. That copy is the one the install
- // folder holds loose, and the plain lookup after this finds it.
- // The interface is ours whoever has it: a mod's loose .wnd, Language.ini or shell image is never
- // read; its archived copies were kept out of the tree in ArchiveFileSystem::addToTree.
- const Bool oursAlways = isForkUIPath(filename) || TheArchiveFileSystem->isOurUITexture(filename);
- if ((loose.isNotEmpty() || archived) && (oursAlways || (isForkOwnedPath(filename) && TheLocalFileSystem->doesFileExist(filename.str()))))
- {
- static std::set<std::string> reported;
- if (reported.insert(std::string(filename.str())).second)
- {
- DEBUG_LOG(("FileSystem - the mod's %s is ignored, our own copy wins (%s)\n",
- filename.str(), loose.isNotEmpty() ? loose.str() : archive.str()));
- }
- return AsciiString();
- }
-
- if (inModArchive != NULL)
- {
- *inModArchive = archived;
- }
- return loose;
-}
-
-//============================================================================
-// FileSystem::isMapPath
-//============================================================================
-Bool FileSystem::isMapPath(const AsciiString& filename)
-{
- // A mod's Maps.big carries its own edits of the stock maps under the same names (Contra's Twilight
- // Flame is not ours), and a lobby has to agree on one file: retail's and the fork's maps win always.
- return strncasecmp(filename.str(), "maps", 4) == 0 && (filename.str()[4] == '\\' || filename.str()[4] == '/');
-}
-
-//============================================================================
-// FileSystem::isForkOwnedPath
-//============================================================================
-Bool FileSystem::isForkOwnedPath(const AsciiString& filename)
-{
- // What the fork installs loose next to the exe: the launcher's payload, which is the post-build copy
- // of Code/Data (less Scenarios, Cinema and the shader cache).
- // Tests/test_gameengine.cpp walks Code/Data and fails when a master falls outside this. Retail's own
- // loose files (Data\Scripts\MultiplayerScripts.scb, the movies, the cursors) are not in it, so a mod
- // still replaces those. Nor is the fork's SkirmishScripts.scb, by the owner's call: a mod's skirmish
- // AI is written for its own generals, which the fork's has no players for, so a mod's scb wins whole
- // and the fork's C++ AI runs it. The fork's Reforged*.big are kept on top in ArchiveFileSystem::loadMods.
- AsciiString path = filename;
- path.toLower();
- std::string p(path.str());
- for (size_t i = 0; i < p.size(); ++i)
- {
- if (p[i] == '/')
- p[i] = '\\';
- }
- const auto starts = [&p](const char *prefix) { return p.compare(0, strlen(prefix), prefix) == 0; };
- const auto ends = [&p](const char *suffix) { size_t n = strlen(suffix); return p.size() >= n && p.compare(p.size() - n, n, suffix) == 0; };
-
- if (starts("data\\ini\\") && p.find('\\', strlen("data\\ini\\")) == std::string::npos && ends("reforged.ini"))
- return TRUE;
- if (starts("data\\ini\\mappedimages\\handcreated\\reforged") && ends(".ini"))
- return TRUE;
- if (p == "data\\ini\\modernwater.ini")
- return TRUE;
- return p == "data\\patch.str"
- || p == "data\\scripts\\skirmishscriptsretail.scb" // EA's own, for a player's own map
- || starts("data\\turkish\\") || starts("data\\german\\")
- || starts("data\\ukrainian\\") || starts("data\\russian\\") || starts("data\\french\\")
- || starts("art\\textures\\reforged")
- // Mehmetcik's own model and animations; the texture keeps EA's ZHCA_ prefix, which is what takes
- // the house colour
- || starts("art\\w3d\\trmehm_") || p == "art\\textures\\zhca_trmehmet.tga"
- // the engineer's own model, on the GLA Worker's skeleton and animations
- || p == "art\\w3d\\trengr_skn.w3d" || p == "art\\textures\\zhca_trengr.tga"
- // the Command Center's own barracks and its damaged, burning and rubble states
- || starts("art\\w3d\\trcmdhq") || starts("art\\textures\\trcmdhq_") || p == "art\\textures\\zhca_trcmdhq.tga"
- // the Altay's own model, its damaged state and the hulk, turret and gun it leaves
- || starts("art\\w3d\\traltay") || starts("art\\textures\\traltay_") || starts("art\\textures\\zhca_traltay")
- // the Airfield's own fortress field, its four shelter doors and its scaffold
- || starts("art\\w3d\\trairfld") || starts("art\\textures\\trairfld") || starts("art\\textures\\zhca_trairfld")
- // the Kizilelma's own model, its damaged and falling states, the hulk and the pieces it throws
- || starts("art\\w3d\\trkizilelma") || starts("art\\textures\\trkizilelma") || starts("art\\textures\\zhca_trkizilelma")
- // the Power Plant's own turbine hall, its upgraded, damaged, burning and rubble states and its scaffold
- || starts("art\\w3d\\trpwrplt") || starts("art\\textures\\trpwrplt") || starts("art\\textures\\zhca_trpwrplt")
- // the defences' own models: the Siper's tabya, the Patriot's hisar, the Radar Kulesi, the mine; their earth sheets
- || starts("art\\w3d\\trsiper") || starts("art\\w3d\\trpatriot") || starts("art\\w3d\\trradar") || p == "art\\w3d\\trmine.w3d"
- || starts("art\\textures\\trdef_")
- || starts("window\\")
- || p == "install_final.bmp";
-}
-
-//============================================================================
-// FileSystem::isForkUIPath
-//============================================================================
-Bool FileSystem::isForkUIPath(const AsciiString& filename)
-{
- // A mod integrates into our game and never brings its own interface: every window layout, the
- // fonts (Language.ini, HeaderTemplate.ini), the shell's colours and transitions and the image sheets
- // the shell and the HUD frames are cut from. The image sheets a mod's cameos live in
- // (SAUserInterface512 and the like) and the Generals Challenge portraits stay the mod's: those are
- // its units and its generals. The textures our sheets name are added in ArchiveFileSystem::loadMods.
- AsciiString path = filename;
- path.toLower();
- std::string p(path.str());
- for (size_t i = 0; i < p.size(); ++i)
- {
- if (p[i] == '/')
- p[i] = '\\';
- }
- if (p.compare(0, strlen("window\\"), "window\\") == 0)
- return TRUE;
- const size_t slash = p.find_last_of('\\');
- const std::string dir = slash == std::string::npos ? std::string() : p.substr(0, slash + 1);
- const std::string name = slash == std::string::npos ? p : p.substr(slash + 1);
- // Data\<language>\Language.ini and HeaderTemplate.ini
- if (dir.compare(0, strlen("data\\"), "data\\") == 0 && dir.find('\\', strlen("data\\")) == dir.size() - 1
- && (name == "language.ini" || name == "headertemplate.ini"))
- return TRUE;
- if ((dir == "data\\ini\\" || dir == "data\\ini\\default\\")
- && (name == "shellmenuscheme.ini" || name == "windowtransitions.ini" || name == "ingameui.ini" || name == "controlbarresizer.ini"))
- return TRUE;
- static const char *const sheets[] = { "handcreatedmappedimages.ini", "scshelluserinterface512.ini",
- "scsmshelluserinterface512.ini", "scgameuserinterface512.ini", "sclogosuserinterface512.ini",
- "scpurchasepowers512.ini", "sacontrolbar512.ini", "sncontrolbar512.ini", "sucontrolbar512.ini" };
- if (dir.compare(0, strlen("data\\ini\\mappedimages\\"), "data\\ini\\mappedimages\\") == 0)
- {
- for (size_t i = 0; i < sizeof(sheets) / sizeof(sheets[0]); ++i)
- {
- if (name == sheets[i])
- return TRUE;
- }
- }
- return FALSE;
}
//============================================================================
@@ -650,33 +298,6 @@ Bool FileSystem::getFileInfo(const AsciiString& filename, FileInfo *fileInfo) co
return TRUE;
}
- Int mod;
- AsciiString bare;
- if (splitModName(filename, &mod, &bare)) {
- AsciiString loose = modFolderFile(mod, bare);
- if (loose.isNotEmpty()) {
- return TheLocalFileSystem->getFileInfo(loose, fileInfo);
- }
- return TheArchiveFileSystem->getModFileInfo(mod, bare, fileInfo);
- }
-
- if (s_focus != FILE_FOCUS_ALL) {
- AsciiString loose = focusedLooseFile(filename);
- if (loose.isNotEmpty()) {
- return TheLocalFileSystem->getFileInfo(loose, fileInfo);
- }
- return TheArchiveFileSystem->getFileInfo(filename, fileInfo);
- }
-
- Bool inModArchive = FALSE;
- AsciiString modded = modLooseFile(filename, &inModArchive);
- if (modded.isNotEmpty()) {
- return TheLocalFileSystem->getFileInfo(modded, fileInfo);
- }
- if (inModArchive) {
- return TheArchiveFileSystem->getFileInfo(filename, fileInfo);
- }
-
if (TheLocalFileSystem->getFileInfo(filename, fileInfo)) {
return TRUE;
}
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp
index 344a830a9..8fc627637 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp
@@ -745,7 +745,7 @@ Bool GameState::saveCheckpoint( AsciiString filepath )
}
catch( ... )
{
- // the destructor throws away what was written; a mod object whose module cannot save
+ // the destructor throws away what was written; an object whose module cannot save
// costs the replay its rewind, not the whole game (report 1858)
DEBUG_LOG(( "GameState::saveCheckpoint - '%s' could not be written\n", filepath.str() ));
return FALSE;
@@ -757,7 +757,7 @@ Bool GameState::saveCheckpoint( AsciiString filepath )
/** loadGame for a checkpoint, with the recorder's turn between the reset and the load: the reset
* closes the replay, and the load's new game reads the players out of it. FALSE when the load
* failed part way: the half-loaded match is cleared, as a replay's end clears it, and the player
- * is told, so a mod object whose module cannot load ends the replay rather than the game. */
+ * is told, so an object whose module cannot load ends the replay rather than the game. */
// ------------------------------------------------------------------------------------------------
Bool GameState::loadCheckpoint( AsciiString filepath, const std::function< void( void ) > &afterReset )
{
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp b/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp
index 761904c40..8452e7462 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/System/Upgrade.cpp
@@ -383,9 +383,6 @@ const UpgradeTemplate *UpgradeCenter::findUpgradeByKey( NameKeyType key ) const
if( upgrade->getUpgradeNameKey() == key )
return upgrade;
- NameKeyType retailKey;
- if( TheModNamespace.findRetailKey( key, MODNAME_UPGRADE, &retailKey ) )
- return findUpgradeByKey( retailKey );
// item not found
return NULL;
}
@@ -418,7 +415,7 @@ const UpgradeTemplate *UpgradeCenter::requireUpgrade( const AsciiString &name, c
//-------------------------------------------------------------------------------------------------
UpgradeTemplate *UpgradeCenter::newUpgrade( const AsciiString& name )
{
- // every upgrade is one bit of UpgradeMaskType; -modfactions puts every mod's beside retail's
+ // every upgrade is one bit of UpgradeMaskType
if( m_nextTemplateMaskBit >= UPGRADE_MAX_COUNT )
{
DEBUG_LOG(( "Upgrade %s would be upgrade number %d, and UPGRADE_MAX_COUNT is %d\n", name.str(), m_nextTemplateMaskBit + 1, UPGRADE_MAX_COUNT ));
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/Module.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/Module.cpp
index c3f6bedcd..c98a04175 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/Module.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/Module.cpp
@@ -250,7 +250,7 @@ void UpgradeMuxData::performUpgradeFX(Object* obj) const
//-------------------------------------------------------------------------------------------------
/** The upgrade a TriggeredBy, ConflictsWith or RemovesUpgrades line names, or NULL when there is no
* such upgrade. EA threw INI_INVALID_DATA here, lazily, on the first object of the template, so a
- * mod naming an upgrade it never defines killed the map load with nothing in the crash report
+ * data naming an upgrade it never defines killed the map load with nothing in the crash report
* (reports 1893-1899). The name is said in the log and skipped instead, and looked up again the
* next time: a map.ini can define the upgrade for one match, so a miss is never kept in the shared
* module data, or a machine that played a match without that map would go on without the upgrade
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp
index 05e9e3371..4964eae4f 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingFactory.cpp
@@ -293,10 +293,6 @@ ThingTemplate *ThingFactory::findTemplateInternal( const AsciiString& name, Bool
return tIt->second;
}
- AsciiString retailName;
- if (TheModNamespace.findRetailName(name, MODNAME_OBJECT, &retailName))
- return findTemplateInternal(retailName, check);
-
#ifdef LOAD_TEST_ASSETS
if (!strncmp(name.str(), TEST_STRING, strlen(TEST_STRING)))
{
@@ -400,10 +396,9 @@ const ThingTemplate *ThingFactory::findSideReskin( const ThingTemplate *tmplate,
// skip a Toxin player's chassis was swapped for Chem_GLAVehicleTechnical itself, a unit with no
// weapon or locomotor: the Arms Dealer charged for a Technical and nothing drove out.
const ThingTemplate *found = NULL;
- const Int mod = tmplate->getModIndex();
for (const ThingTemplate *t = m_firstTemplate; t != NULL && found == NULL; t = t->friend_getNextTemplate())
{
- if (t->getDefaultOwningSide() == side && t->getModIndex() == mod && t->getBuildVariations().empty() && t->isEquivalentTo( tmplate ))
+ if (t->getDefaultOwningSide() == side && t->getBuildVariations().empty() && t->isEquivalentTo( tmplate ))
found = (const ThingTemplate *)t->getFinalOverride();
}
m_sideReskins[ key ] = found;
@@ -457,7 +452,7 @@ AsciiString TheThingTemplateBeingParsedName;
TheThingTemplateBeingParsedName = name;
#endif
- /* An ObjectReskin of an object that is not there - FixesReforged.ini's SupW_SDILasers under a mod that
+ /* An ObjectReskin of an object that is not there - FixesReforged.ini's SupW_SDILasers over data that
has no SDILasers - is skipped the same way as a patch of a missing object below, before a template
is made for it, instead of stopping the game at start. */
if( reskinFrom.isNotEmpty() )
@@ -477,9 +472,9 @@ AsciiString TheThingTemplateBeingParsedName;
if( !thingTemplate && ini->getLoadType() == INI_LOAD_MULTIFILE && reskinFrom.isEmpty() )
{
/* A patch names an object EA's files built, and a new template made from a name that finds
- nothing would change no unit. The name is missing when a mod's archives replaced EA's object
+ nothing would change no unit. The name is missing when other archives replaced EA's object
files, and BalanceReforged.ini's price for Nuke_ChinaGattlingCannon stopped the game at start
- on an install carrying AlternateINI's archives. The block is read into a
+ on such an install. The block is read into a
template that is thrown away, so the parse stays in step and the rest of the file still applies.
An ObjectReskin is new by design and still names an original that has to exist. */
DEBUG_LOG(( "[LINE: %d in '%s'] %s patches an object that does not exist; the block is skipped.\n", ini->getLineNum(), ini->getFilename().str(), name.str() ));
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp
index 1f8986e9d..0194edcb0 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/Thing/ThingTemplate.cpp
@@ -41,7 +41,6 @@
#define DEFINE_BUILDABLE_STATUS_NAMES // for BuildableStatusNames[]
#include "Common/DamageFX.h"
-#include "Common/FileSystem.h"
#include "Common/GameAudio.h"
#include "Common/GameCommon.h"
#include "Common/GlobalData.h"
@@ -610,9 +609,9 @@ void ThingTemplate::parseModuleName(INI* ini, void *instance, void* store, const
&& self->m_moduleBeingReplacedName.isNotEmpty()
&& self->m_moduleBeingReplacedName != tokenStr)
{
- /* A tag that holds a module of another type means a mod's data numbered the object's modules
- differently: Shockwave's Tank_ChinaBunker ModuleTag_05 is no StructureBody, and BalanceReforged.ini's
- replacement of it stopped the game at start. The module is read to its End and dropped, so the
+ /* A tag that holds a module of another type means the loaded data numbered the object's modules
+ differently from the patch: a Tank_ChinaBunker whose ModuleTag_05 is no StructureBody stopped the
+ game at start on BalanceReforged.ini's replacement of it. The module is read to its End and dropped, so the
parse stays in step, and parseReplaceModule puts the template back as it was before the block. */
DEBUG_LOG(("[LINE: %d - FILE: '%s'] ReplaceModule %s on %s holds a %s, not a %s; the block is skipped.\n",
ini->getLineNum(), ini->getFilename().str(), self->m_moduleBeingReplacedTag.str(), self->getName().str(),
@@ -635,7 +634,7 @@ void ThingTemplate::parseModuleName(INI* ini, void *instance, void* store, const
ModuleData* data = TheModuleFactory->newModuleDataFromINI(ini, tokenStr, type, moduleTagStr);
if (data == NULL)
{
- // a module name this exe does not have, usually a mod written for another build
+ // a module name this exe does not have, usually data written for another build
g_LastErrorDump.format("[LINE: %d - FILE: '%s'] Unknown module '%s' (%s) on %s\n",
ini->getLineNum(), ini->getFilename().str(), tokenStr.str(), moduleTagStr.str(), self->getName().str());
DEBUG_LOG(("%s", g_LastErrorDump.str()));
@@ -645,7 +644,7 @@ void ThingTemplate::parseModuleName(INI* ini, void *instance, void* store, const
{
/* read to its End and dropped: a special power module with no template faults placing the
object, and an upgrade with no list does nothing. Inside ReplaceModule the module it was
- to replace comes back, so the mod's own stands. */
+ to replace comes back, so the loaded data's own stands. */
DEBUG_LOG(("[LINE: %d - FILE: '%s'] %s %s on %s is skipped.\n",
ini->getLineNum(), ini->getFilename().str(), tokenStr.str(), moduleTagStr.str(), self->getName().str()));
self->m_replaceModuleSkipped = TRUE;
@@ -988,7 +987,7 @@ void ArmorTemplateSet::parseArmor( INI* ini, void *instance, void * /*store*/, c
return;
}
self->m_template = TheArmorStore->findArmorTemplate(name);
- // ThingTemplate::parseArmorTemplateSet passes over a patch file's set that names an armor a mod dropped
+ // ThingTemplate::parseArmorTemplateSet passes over a patch file's set that names an armor the data lacks
self->m_namesMissingArmor = (self->m_template == NULL);
}
@@ -1015,8 +1014,8 @@ void ThingTemplate::parseArmorTemplateSet( INI* ini, void *instance, void * /*st
ws.parseArmorTemplateSet(ini);
/* A patch file's set naming an armor the loaded data lacks would leave the object with no armor
- at all under those conditions, every hit at full damage: Contra has no ChemSuitHumanArmor, so
- FixesReforged.ini stripped its Rangers' Chemical Suits. The object keeps the set it had. */
+ at all under those conditions, every hit at full damage: on data with no ChemSuitHumanArmor,
+ FixesReforged.ini stripped the Rangers' Chemical Suits. The object keeps the set it had. */
if (ini->getLoadType() == INI_LOAD_MULTIFILE && ws.namesMissingArmor())
{
// a nameless template is ThingFactory's scratch for a patch of a missing object, logged there
@@ -1068,12 +1067,12 @@ void ThingTemplate::parseWeaponTemplateSet( INI* ini, void *instance, void * /*s
/* A patch file's set naming a weapon the loaded data lacks would arm the object with nothing in
that slot: FixesReforged.ini's Toxin Tunnel Defender and Stinger sets name EA's Chem_ rockets,
- which Contra's Weapon.ini leaves out, so Contra's own two went unarmed. The object keeps the
+ and a Weapon.ini that leaves them out left those two unarmed. The object keeps the
set it had, as a patch naming a missing object or module is passed over. */
if (ini->getLoadType() == INI_LOAD_MULTIFILE && ws.namesMissingWeapon())
{
// a nameless template is ThingFactory's scratch for a patch of a missing object, already logged
- // there and thrown away with everything in it (GC_Chem_GLAScudStorm under Contra)
+ // there and thrown away with everything in it
if (self->getName().isNotEmpty())
DEBUG_LOG(("[LINE: %d - FILE: '%s'] WeaponSet on %s names a weapon that is not defined; the set is skipped.\n",
ini->getLineNum(), ini->getFilename().str(), self->getName().str()));
@@ -1643,15 +1642,6 @@ UnsignedInt ThingTemplate::getMaxSimultaneousOfType() const
-//-------------------------------------------------------------------------------------------------
-Int ThingTemplate::getModIndex() const
-{
- Int mod = -1;
- AsciiString bareName;
- FileSystem::splitModName( getName(), &mod, &bareName );
- return mod;
-}
-
//-------------------------------------------------------------------------------------------------
Bool ThingTemplate::isEquivalentTo(const ThingTemplate* tt) const
{
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/version.cpp b/GeneralsMD/Code/GameEngine/Source/Common/version.cpp
index 8744cce74..3356d6847 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/version.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/version.cpp
@@ -29,9 +29,7 @@
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
-#include "Lib/WideCharFns.h"
#include "GameClient/GameText.h"
-#include "Common/GlobalData.h"
#include "Common/version.h"
Version *TheVersion = NULL; ///< The Version singleton
@@ -116,25 +114,9 @@ UnicodeString Version::getUnicodeVersion( void )
version.concat(UnicodeString(u" Internal"));
#endif
- // The replay header carries this string and playback compares it, so a modded replay names its mod
- // and is flagged as another version when it is opened without that mod.
- if (TheGlobalData->m_modName.isNotEmpty())
- {
- version.concat(UnicodeString(u" ["));
- version.concat(getUnicodeModName());
- version.concat(UnicodeString(u"]"));
- }
-
return version;
}
-UnicodeString Version::getUnicodeModName( void )
-{
- WideChar name[512]; // the whole -mod list; the replay header reads up to 1024 units back
- WideCharFromUtf8( TheGlobalData->m_modName.str(), name, ARRAY_SIZE(name) );
- return UnicodeString( name );
-}
-
UnicodeString Version::getFullUnicodeVersion( void )
{
UnicodeString version;
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp
index 8f7d9f65d..f6afa167c 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp
@@ -1128,8 +1128,7 @@ const FXList *FXListStore::findFXList(const char* name) const
// a Superweapon General's copy the fork's data names, which Classic dropped: EA's plain list is what he had
if (m_classicDroppedGeneralCopies && strncmp(name, "SupW_", 5) == 0)
return findFXList(name + 5);
- AsciiString retailName;
- return TheModNamespace.findRetailName(AsciiString(name), MODNAME_FXLIST, &retailName) ? findFXList(retailName.str()) : NULL;
+ return NULL;
}
//-------------------------------------------------------------------------------------------------
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
index 9ae4f2a8d..951d3d8a5 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp
@@ -380,62 +380,6 @@ Bool ControlBar_commandPlaces( const Int *types, const Int *groups, const Int *p
return fights;
}
-//-------------------------------------------------------------------------------------------------
-void ControlBar_fitCommandSlots( const Int *types, const Bool *windowed, Int count, Int *shown )
-{
- for( Int slot = 0; slot < count; slot++ )
- shown[ slot ] = ( windowed[ slot ] && types[ slot ] != GUI_COMMAND_NONE ) ? slot : -1;
-
- // the shared orders first, so a mod's own button past the bar cannot take their Zero Hour slot
- for( Int pass = 0; pass < 2; pass++ )
- {
- for( Int slot = 0; slot < count; slot++ )
- {
- if( windowed[ slot ] || types[ slot ] == GUI_COMMAND_NONE )
- continue;
- Int to = -1;
- switch( types[ slot ] )
- {
- case GUI_COMMAND_ATTACK_MOVE: to = 10; break;
- case GUI_COMMAND_GUARD:
- case GUI_COMMAND_GUARD_WITHOUT_PURSUIT:
- case GUI_COMMAND_GUARD_FLYING_UNITS_ONLY: to = 12; break;
- case GUI_COMMAND_STOP: to = 13; break;
- }
- if( ( to >= 0 ) != ( pass == 0 ) )
- continue;
- if( to < 0 || to >= count || !windowed[ to ] || shown[ to ] >= 0 )
- {
- to = -1;
- for( Int each = 0; each < count && to < 0; each++ )
- if( windowed[ each ] && shown[ each ] < 0 )
- to = each;
- }
- if( to >= 0 )
- shown[ to ] = slot;
- }
- }
-}
-
-//-------------------------------------------------------------------------------------------------
-Bool ControlBar_needsWideCommandGrid( const Int *types, Int count )
-{
- Int buttons = 0;
- for( Int slot = 0; slot < count; slot++ )
- {
- if( types[ slot ] == GUI_COMMAND_PURCHASE_SCIENCE )
- return FALSE;
- buttons += types[ slot ] != GUI_COMMAND_NONE ? 1 : 0;
- }
- return buttons > COMMAND_GRID_NARROW_SLOTS;
-}
-
-//-------------------------------------------------------------------------------------------------
-Bool ControlBar_usesCommandWindow( Int slot, Bool spareWindows, Bool wide )
-{
- return !spareWindows || wide || slot < COMMAND_GRID_NARROW_SLOTS;
-}
-
//-------------------------------------------------------------------------------------------------
void ControlBar_orderKeyPlaces( const Int *places, Int count, Bool fights, Int *keys )
{
@@ -739,9 +683,9 @@ Player *ControlBar::getWatchedPlayer( void )
return local;
}
-/** Puts one rank's command set on its windows, slot i on window i. Every promotion screen, Zero Hour's
- * and each mod's, numbers its windows down the columns the same way, so a mod's empty slots and its
- * columns are the ones its author laid out on ours too. The caller has hidden every window. */
+/** Puts one rank's command set on its windows, slot i on window i. Every promotion screen numbers its
+ * windows down the columns the same way, so a set's empty slots and its columns are the ones its
+ * author laid out. The caller has hidden every window. */
void ControlBar::populatePurchaseScienceRank( Player *player, const CommandSet *commandSet, GameWindow **windows, Int windowCount )
{
for( Int i = 0; i < windowCount; i++ )
@@ -1250,9 +1194,8 @@ void CommandSet::parseCommandButton( INI* ini, void *instance, void *store, cons
if( commandButton == NULL )
{
- /* A mod's CommandButton.ini can lack a button the fork's CommandSetReforged.ini names: Contra X
- Beta 2 has no Early_Command_ChinaCarpetBomb, and slot 2 of Infa_ChinaCommandCenterCommandSetUpgrade
- threw and stopped the game at start. The slot keeps what it held: empty for a new set and for a
+ /* A CommandButton.ini can lack a button a CommandSet names, and the unknown name threw and
+ stopped the game at start. The slot keeps what it held: empty for a new set and for a
patched one, which parseCommandSetDefinition clears first, the parent's button for a map.ini
override, which starts as a copy. Every reader already passes over an empty slot, and the
outcome depends only on the files, which are in the INI and map checksums. */
@@ -1325,7 +1268,6 @@ ControlBar::ControlBar( void )
{
Int i;
m_controlBarSchemeManager = NULL;
- m_commandGridWide = FALSE;
m_isObserverCommandBar = FALSE;
m_observerLookAtPlayer = NULL;
m_watchedSelection = NULL;
@@ -1519,8 +1461,8 @@ static const Real thePanelAnchorFraction[ ControlBar::CB_PANEL_COUNT ] = { 0.0f,
static const Real thePanelAnchorDesignX[ ControlBar::CB_PANEL_COUNT ] = { 0.0f, 400.0f, 800.0f };
//-------------------------------------------------------------------------------------------------
-/** ControlBar Pro's bar (xezon and FAS, MIT; Data/Window/ControlBarPro.txt), the bar of every side,
- * a mod faction's too (ControlBarIsModFaction). It was painted at 1920x1080 and goes on screen in
+/** ControlBar Pro's bar (xezon and FAS, MIT; Data/Window/ControlBarPro.txt), the bar of every side.
+ * It was painted at 1920x1080 and goes on screen in
* three pieces: the radar pinned bottom left, the command grid bottom centre and the selection with the general's buttons
* bottom right. Each is drawn at the screen's height alone, 1080 lines to one, so it keeps the
* painting's shape and never stretches across the width, and from 4:3 to 32:9 the world shows
@@ -2596,49 +2538,6 @@ void ControlBar::shutdownWindows( void )
} // end shutdownWindows
-//-------------------------------------------------------------------------------------------------
-/** Widen 'win' by 'step' pixels at both ends. Its children stay where they stood on screen, or with
- * 'carryChildren' move left with its left edge. */
-//-------------------------------------------------------------------------------------------------
-static void growSideways( GameWindow *win, Int step, Bool carryChildren )
-{
- if( win == NULL )
- return;
- Int x, y, w, h;
- win->winGetPosition( &x, &y );
- win->winGetSize( &w, &h );
- win->winSetPosition( x - step, y );
- win->winSetSize( w + 2 * step, h );
- if( carryChildren )
- return;
- for( GameWindow *child = win->winGetChild(); child; child = child->winGetNext() )
- {
- child->winGetPosition( &x, &y );
- child->winSetPosition( x + step, y );
- }
-}
-
-//-------------------------------------------------------------------------------------------------
-/** The first loaded command set the fourteen-window grid cannot hold (ControlBar_needsWideCommandGrid),
- * NULL when it holds them all. Every Zero Hour set fits, Reforged's and Turkiye's too. */
-//-------------------------------------------------------------------------------------------------
-static const CommandSet *commandSetPastNarrowGrid( void )
-{
- for( CommandSet *each = TheCommandStore->friend_getCommandSets(); each; each = each->friend_getNext() )
- {
- const CommandSet *set = (const CommandSet *)each->friend_getFinalOverride();
- Int types[ MAX_COMMANDS_PER_SET ];
- for( Int i = 0; i < MAX_COMMANDS_PER_SET; i++ )
- {
- const CommandButton *button = set->getCommandButton( i );
- types[ i ] = ( button && !BitTest( button->getOptions(), SCRIPT_ONLY ) ) ? button->getCommandType() : GUI_COMMAND_NONE;
- }
- if( ControlBar_needsWideCommandGrid( types, MAX_COMMANDS_PER_SET ) )
- return set;
- }
- return NULL;
-}
-
//-------------------------------------------------------------------------------------------------
/** Look up every window the bar drives, and lay the bar out. Re-callable: a resolution change
* rebuilds ControlBar.wnd and then calls this instead of replacing the whole ControlBar. */
@@ -2657,52 +2556,6 @@ void ControlBar::initWindows( void )
id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ControlBarParent" );
m_contextParent[ CP_MASTER ] = TheWindowManager->winGetWindowFromId( NULL, id );
- //
- // A mod whose sets hold more than fourteen buttons gets all eighteen windows, nine columns
- // of two, the plate one column longer at each end the way Contra's edit of ControlBar Pro
- // draws it. Our layout keeps ButtonCommand15 to 18 hidden past the plate's right end, one
- // and two columns on, so moving the whole grid a column left and widening what frames it puts
- // 01 to 18 down the columns from the new left end. This is done in the loader's own
- // stretched space before layoutPanels reads the authored rectangles, so the wide grid is the
- // one it remembers. A mod's own ControlBar.wnd keeps its grid as it drew it: its button 15
- // stands inside its CommandWindow.
- //
- m_commandGridWide = FALSE;
- Bool spareWindows = FALSE;
- {
- GameWindow *grid = barWindow( "ControlBar.wnd:CommandWindow" );
- GameWindow *first = barWindow( "ControlBar.wnd:ButtonCommand01" );
- GameWindow *third = barWindow( "ControlBar.wnd:ButtonCommand03" );
- GameWindow *spare = barWindow( "ControlBar.wnd:ButtonCommand15" );
- if( grid && first && third && spare )
- {
- ICoord2D gridAt, gridSize, firstAt, thirdAt, spareAt, spareSize;
- grid->winGetScreenPosition( &gridAt.x, &gridAt.y );
- grid->winGetSize( &gridSize.x, &gridSize.y );
- first->winGetScreenPosition( &firstAt.x, &firstAt.y );
- third->winGetScreenPosition( &thirdAt.x, &thirdAt.y );
- spare->winGetScreenPosition( &spareAt.x, &spareAt.y );
- spare->winGetSize( &spareSize.x, &spareSize.y );
- spareWindows = spareAt.x + spareSize.x > gridAt.x + gridSize.x;
- const CommandSet *wideSet = spareWindows ? commandSetPastNarrowGrid() : NULL;
- if( wideSet )
- {
- m_commandGridWide = TRUE;
- const Int step = thirdAt.x - firstAt.x;
- growSideways( grid, step, TRUE );
- growSideways( barWindow( "ControlBar.wnd:ControlBarProBlockInputProduction" ), step, TRUE );
- growSideways( barWindow( "ControlBar.wnd:UnderConstructionWindow" ), step, FALSE );
- growSideways( barWindow( "ControlBar.wnd:OCLTimerWindow" ), step, FALSE );
- growSideways( barWindow( "ControlBar.wnd:BeaconWindow" ), step, FALSE );
- growSideways( barWindow( "ControlBar.wnd:ControlBarProOverlayConstruction" ), step, TRUE );
- growSideways( barWindow( "ControlBar.wnd:ControlBarProOverlayOCLTimer" ), step, TRUE );
- growSideways( barWindow( "ControlBar.wnd:ControlBarProOverlayBeacon" ), step, TRUE );
- growSideways( barWindow( "ControlBar.wnd:ControlBarProBlockInputBeacon" ), step, TRUE );
- DEBUG_LOG(( "COMMANDGRID: eighteen windows, %s holds more than fourteen buttons\n", wideSet->getName().str() ));
- }
- }
- }
-
//
// These windows are new, so anything remembered about the last set of them is about
// addresses that may well have been handed back out. Re-anchor the bar as three uniformly
@@ -2792,15 +2645,6 @@ void ControlBar::initWindows( void )
} // end for i
- // the narrow grid leaves our spare four hidden and out of the bar's reach, the bar it always was
- for( i = 0; i < MAX_COMMANDS_PER_SET; i++ )
- if( !ControlBar_usesCommandWindow( i, spareWindows, m_commandGridWide ) )
- m_commandWindows[ i ] = NULL;
- Int windowCount = 0;
- for( i = 0; i < MAX_COMMANDS_PER_SET; i++ )
- windowCount += m_commandWindows[ i ] ? 1 : 0;
- DEBUG_LOG(( "COMMANDGRID: %d command windows, %s\n", windowCount, m_commandGridWide ? "nine columns" : "as laid out" ));
-
for( i = 0; i < MAX_PURCHASE_SCIENCE_RANK_1; i++ )
{
@@ -2873,7 +2717,7 @@ void ControlBar::initWindows( void )
setControlCommand(win, findCommandButton("NonCommand_IdleWorker") );
win->winSetTooltipFunc(commandButtonTooltip);
}
- // a mod's ControlBar.wnd has none of these, and a mod's CommandButton.ini none of the buttons
+ // retail's ControlBar.wnd has none of these, and retail's CommandButton.ini none of the buttons
static const char *const idleButtons[][ 2 ] =
{
{ "ControlBar.wnd:ButtonIdleInfantry", "NonCommand_IdleInfantry" },
@@ -5528,9 +5372,7 @@ void ControlBar::initSpecialPowershortcutBar( Player *player)
return;
m_currentlyUsedSpecialPowersButtons = pt->getSpecialPowerShortcutButtonCount();
AsciiString layoutName, tempName, windowName, parentName;
- // a mod faction's tray is our American one beside our American bar, whatever .wnd the mod names;
- // its buttons are still the mod's SpecialPowerShortcutCommandSet
- layoutName = ControlBarIsModFaction( pt ) ? AsciiString( "GenPowersShortcutBarUS.wnd" ) : pt->getSpecialPowerShortcutWinName();
+ layoutName = pt->getSpecialPowerShortcutWinName();
m_specialPowerLayout = TheWindowManager->winCreateLayout(layoutName);
m_specialPowerLayout->hide(TRUE);
@@ -5638,7 +5480,7 @@ static void drawPowerTraySlot( GameWindow *window, WinInstanceData *instData )
* anything slides it in, and it stays there, so the slide carries the slots and a new layout never
* fights it.
*
- * A scheme without the pieces, a mod's, keeps the shipped column, stretched with the bar on the
+ * A scheme without the pieces keeps the shipped column, stretched with the bar on the
* right edge and climbing from the top of the bar as 1.04's did. Either way the frame takes no
* click: it runs well past the powers, and once took every click over the battlefield and the
* promotion screen beside them. */
@@ -6025,9 +5867,9 @@ void ControlBar::populateSpecialPowerShortcut( Player *player)
// only by finding it on the map and selecting it. Every other faction's shortcut set is asked
// for a button that fires a power this player now holds and nothing above has shown. Powers
// behind a science are left out: a general's power is bought, never captured. "Holds" means
- // the very power the button names, not one of its kind: mods reuse the few power types for
- // unrelated powers (Contra's small Scud Storm is a carpet bomb by type), and a type match put
- // another faction's button in the tray that update then hid, an empty slot left behind.
+ // the very power the button names, not one of its kind: the few power types are shared by
+ // unrelated powers, and a type match put another faction's button in the tray that update then
+ // hid, an empty slot left behind.
//
for( Int t = 0; t < ThePlayerTemplateStore->getPlayerTemplateCount(); ++t )
{
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp
index dbf19219a..aabf5b1a6 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp
@@ -383,25 +383,13 @@ void ControlBar::populateCommand( Object *obj )
if( obj->getContain() && obj->getContain()->isDisplayedOnControlBar() )
doTransportInventoryUI( obj, commandSet );
- // what goes in each slot: the command set, slot for slot, and a button in a slot past our bar's
- // windows into an empty one (ControlBar_fitCommandSlots)
+ // what goes in each slot: the command set, slot for slot, a script only button and a slot with
+ // no window left empty
const CommandButton *slot[ MAX_COMMANDS_PER_SET ];
+ for( i = 0; i < MAX_COMMANDS_PER_SET; i++ )
{
- const CommandButton *set[ MAX_COMMANDS_PER_SET ];
- Int types[ MAX_COMMANDS_PER_SET ];
- Bool windowed[ MAX_COMMANDS_PER_SET ];
- Int shown[ MAX_COMMANDS_PER_SET ];
- for( i = 0; i < MAX_COMMANDS_PER_SET; i++ )
- {
- set[ i ] = commandSet->getCommandButton( i );
- types[ i ] = ( set[ i ] && !BitTest( set[ i ]->getOptions(), SCRIPT_ONLY ) ) ? set[ i ]->getCommandType() : GUI_COMMAND_NONE;
- windowed[ i ] = m_commandWindows[ i ] != NULL;
- }
- ControlBar_fitCommandSlots( types, windowed, MAX_COMMANDS_PER_SET, shown );
-
- // a window nothing is fitted to stays empty: its own slot is empty or script only
- for( i = 0; i < MAX_COMMANDS_PER_SET; i++ )
- slot[ i ] = shown[ i ] >= 0 ? set[ shown[ i ] ] : NULL;
+ const CommandButton *button = commandSet->getCommandButton( i );
+ slot[ i ] = ( m_commandWindows[ i ] && button && !BitTest( button->getOptions(), SCRIPT_ONLY ) ) ? button : NULL;
}
// a builder standing in for an empty selection offers its buildings, not its orders: nobody
@@ -1247,8 +1235,8 @@ CommandAvailability ControlBar::getCommandAvailability( const CommandButton *com
if( command->getCommandType() == GUI_COMMAND_SPECIAL_POWER_FROM_SHORTCUT
|| command->getCommandType() == GUI_COMMAND_SPECIAL_POWER_CONSTRUCT_FROM_SHORTCUT )
{
- // A shortcut whose SpecialPower named a power that does not exist (a mod's button, or a patch
- // button over a mod that lacks the power, INI::parseSpecialPowerTemplate) stands for nothing:
+ // A shortcut whose SpecialPower named a power that does not exist (INI::parseSpecialPowerTemplate)
+ // stands for nothing:
// it is hidden like a shortcut with no building behind it.
if (ThePlayerList && ThePlayerList->getLocalPlayer() && command->getSpecialPowerTemplate())
obj = ThePlayerList->getLocalPlayer()->findMostReadyShortcutSpecialPowerOfType( command->getSpecialPowerTemplate()->getSpecialPowerType() );
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp
index a31c04358..6da5c7a5d 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp
@@ -217,7 +217,6 @@ ControlBarSchemeImage::ControlBarSchemeImage( void )
m_position.x = m_position.y = 0;
m_size.x = m_size.y = 0;
m_image = NULL;
- m_wideImage = NULL;
m_layer = 0;
}
@@ -566,45 +565,6 @@ void ControlBarScheme::init(void)
resMultiplier.x = TheDisplay->getWidth()/INT_TO_REAL(m_ScreenCreationRes.x) ;
resMultiplier.y = TheDisplay->getHeight()/INT_TO_REAL(m_ScreenCreationRes.y);
- //
- // The eighteen-window grid (ControlBar::isCommandGridWide) stands on a plate one command column
- // longer at each end: the painting's "<name>Wide" copy (Tools/hud_command_bar.py). The toolbar
- // column moves out with the left end and the power rail runs the plate's new length. A scheme
- // whose painting has no wide copy, a mod's own, keeps its windows where it put them.
- //
- Bool wideCopy = FALSE;
- for( Int layer = 0; layer < MAX_CONTROL_BAR_SCHEME_IMAGE_LAYERS; layer++ )
- {
- for( ControlBarSchemeImageList::iterator it = m_layer[ layer ].begin(); it != m_layer[ layer ].end(); ++it )
- {
- ControlBarSchemeImage *schemeImage = *it;
- schemeImage->m_wideImage = NULL;
- if( schemeImage->m_image && TheMappedImageCollection )
- {
- AsciiString wideName = schemeImage->m_image->getName();
- wideName.concat( "Wide" );
- schemeImage->m_wideImage = TheMappedImageCollection->findImageByName( wideName );
- }
- wideCopy = wideCopy || schemeImage->m_wideImage != NULL;
- }
- }
- const Int wideStep = ( wideCopy && TheControlBar && TheControlBar->isCommandGridWide() )
- ? COMMAND_GRID_WIDE_STEP * m_ScreenCreationRes.x / 1920 : 0;
- ICoord2D chatUL = m_chatUL, chatLR = m_chatLR, workerUL = m_workerUL, workerLR = m_workerLR;
- ICoord2D optionsUL = m_optionsUL, optionsLR = m_optionsLR, beaconUL = m_beaconUL, beaconLR = m_beaconLR;
- ICoord2D powerBarUL = m_powerBarUL, powerBarLR = m_powerBarLR;
- chatUL.x -= wideStep;
- chatLR.x -= wideStep;
- // the idle worker heads the idle column at the grid's right end, so it goes out with that end
- workerUL.x += wideStep;
- workerLR.x += wideStep;
- optionsUL.x -= wideStep;
- optionsLR.x -= wideStep;
- beaconUL.x -= wideStep;
- beaconLR.x -= wideStep;
- powerBarUL.x -= wideStep;
- powerBarLR.x += wideStep;
-
win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:PopupCommunicator" ) );
if(win)
{
@@ -615,7 +575,7 @@ void ControlBarScheme::init(void)
GadgetButtonSetHiliteImage(win, m_buddyButtonHightlited);
GadgetButtonSetHiliteSelectedImage(win, m_buddyButtonPushed);
GadgetButtonSetDisabledImage(win, m_buddyButtonDisabled);
- placeSchemeWindow( win, chatUL, chatLR, resMultiplier );
+ placeSchemeWindow( win, m_chatUL, m_chatLR, resMultiplier );
}
win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonIdleWorker" ) );
if(win)
@@ -624,12 +584,11 @@ void ControlBarScheme::init(void)
GadgetButtonSetHiliteImage(win, m_idleWorkerButtonHightlited);
GadgetButtonSetHiliteSelectedImage(win, m_idleWorkerButtonPushed);
GadgetButtonSetDisabledImage(win, m_idleWorkerButtonDisabled);
- placeSchemeWindow( win, workerUL, workerLR, resMultiplier );
+ placeSchemeWindow( win, m_workerUL, m_workerLR, resMultiplier );
}
//
- // The idle infantry, vehicle and aircraft buttons stand in a column at the grid's right end and
- // go out with it on the wide grid, the way the toolbar column goes out with the left end. A
+ // The idle infantry, vehicle and aircraft buttons stand in a column at the grid's right end. A
// scheme that does not place one shrinks it to nothing rather than leave it at the .wnd's 0,0.
//
static const char *const idleNames[ IDLE_COUNT ] =
@@ -655,10 +614,7 @@ void ControlBarScheme::init(void)
GadgetButtonSetHiliteImage( win, image[ 1 ] );
GadgetButtonSetHiliteSelectedImage( win, image[ 2 ] );
GadgetButtonSetDisabledImage( win, image[ 3 ] );
- ICoord2D ul = m_idleUL[ i ], lr = m_idleLR[ i ];
- ul.x += wideStep;
- lr.x += wideStep;
- placeSchemeWindow( win, ul, lr, resMultiplier );
+ placeSchemeWindow( win, m_idleUL[ i ], m_idleLR[ i ], resMultiplier );
}
win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ExpBarForeground" ) );
@@ -673,7 +629,7 @@ void ControlBarScheme::init(void)
GadgetButtonSetHiliteImage(win, m_optionsButtonHightlited);
GadgetButtonSetHiliteSelectedImage(win, m_optionsButtonPushed);
GadgetButtonSetDisabledImage(win, m_optionsButtonDisabled);
- placeSchemeWindow( win, optionsUL, optionsLR, resMultiplier );
+ placeSchemeWindow( win, m_optionsUL, m_optionsLR, resMultiplier );
}
win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonPlaceBeacon" ) );
if(win)
@@ -682,7 +638,7 @@ void ControlBarScheme::init(void)
GadgetButtonSetHiliteImage(win, m_beaconButtonHightlited);
GadgetButtonSetHiliteSelectedImage(win, m_beaconButtonPushed);
GadgetButtonSetDisabledImage(win, m_beaconButtonDisabled);
- placeSchemeWindow( win, beaconUL, beaconLR, resMultiplier );
+ placeSchemeWindow( win, m_beaconUL, m_beaconLR, resMultiplier );
}
win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:MoneyDisplay" ) );
@@ -691,7 +647,7 @@ void ControlBarScheme::init(void)
win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:PowerWindow" ) );
if(win)
- placeSchemeWindow( win, powerBarUL, powerBarLR, resMultiplier );
+ placeSchemeWindow( win, m_powerBarUL, m_powerBarLR, resMultiplier );
win= TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonGeneral" ) );
if(win)
@@ -741,8 +697,7 @@ void ControlBarScheme::init(void)
//
// A painting whose plates outgrow ControlBar.wnd's input blockers names its own, so a click on
- // the new steel does not fall through to the world. The production blocker follows the wide
- // plate's two extra columns the way the power rail does.
+ // the new steel does not fall through to the world.
//
static const char *const blockNames[ BLOCK_COUNT ] =
{
@@ -759,13 +714,7 @@ void ControlBarScheme::init(void)
win = TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( blockNames[ i ] ) );
if( win == NULL )
continue;
- ICoord2D ul = m_blockUL[ i ], lr = m_blockLR[ i ];
- if( i == BLOCK_PRODUCTION )
- {
- ul.x -= wideStep;
- lr.x += wideStep;
- }
- placeSchemeWindow( win, ul, lr, resMultiplier );
+ placeSchemeWindow( win, m_blockUL[ i ], m_blockLR[ i ], resMultiplier );
}
//
@@ -1139,10 +1088,9 @@ void ControlBarSchemeManager::init( void )
// the fork's edits to EA's schemes, each block naming only what it changes
ini.load( AsciiString( "Data\\INI\\ControlBarSchemeReforged.ini" ), INI_LOAD_MULTIFILE, NULL );
// ControlBar Pro's schemes, the bar every side wears: each replaces EA's of the same name whole,
- // and under a single -mod the mod's of that name, so nothing above reaches it (a Debug build
- // asserts once a scheme, newControlBarScheme). -modfactions loads no mod's schemes at all.
- // A scheme of a name it does not have (a mod's ChinaSpecialWeaponsGeneral) stays the mod's, so the
- // ones read here are marked and findSchemeForFaction picks among them only.
+ // so nothing above reaches it (a Debug build asserts once a scheme, newControlBarScheme). A
+ // scheme of a name it does not have stays EA's, so the ones read here are marked and
+ // findSchemeForFaction picks among them only.
m_loadingControlBarPro = TRUE;
ini.load( AsciiString( "Data\\INI\\ControlBarProReforged.ini" ), INI_LOAD_OVERWRITE, NULL );
m_loadingControlBarPro = FALSE;
@@ -1270,19 +1218,6 @@ ControlBarScheme *ControlBarSchemeManager::findSchemeForSide( const AsciiString&
return best;
}
-//-----------------------------------------------------------------------------
-/** The owner's call: a mod's faction gets our American power tray, whatever .wnd the mod names. Its
- * buttons, cameos and portrait are still the mod's. That is a faction with a mod index, or any
- * faction under patches with no full -mod. The observer is
- * none. */
-//-----------------------------------------------------------------------------
-Bool ControlBarIsModFaction( const PlayerTemplate *pt )
-{
- if( pt == NULL || pt->getSide().isEmpty() || pt->getSide().compareNoCase( "Observer" ) == 0 )
- return FALSE;
- return pt->getModIndex() >= 0 || ( !TheGlobalData->m_mods.empty() && !TheGlobalData->m_modFactions );
-}
-
//-----------------------------------------------------------------------------
/** How each family of side pictures is named. SSObserver and SSScore take the template's name less a
* leading "Faction" and a trailing "General" (SSScoreAmericaLaser), FactionPicker the whole name
@@ -1306,8 +1241,8 @@ static const SideImageNames theSideImageNames[] =
//-----------------------------------------------------------------------------
/** Looked up by name, so a sheet that adds a picture for a general needs no INI edit and the player
* templates (in the INI checksum) stay as they are. Names are case blind, so GameinfoTurkiye finds
- * GameinfoTURKIYE and GameinfoBoss retail's GameinfoBOSS. A mod's faction is named M<n>~ and never
- * matches, so it gets the country its base side names, as does any general without a picture. */
+ * GameinfoTURKIYE and GameinfoBoss retail's GameinfoBOSS. A general without a picture gets the
+ * country its base side names. */
//-----------------------------------------------------------------------------
const Image *ControlBarSideImage( const PlayerTemplate *pt, const char *prefix )
{
@@ -1361,10 +1296,8 @@ const Image *ControlBarSideEmblem( const PlayerTemplate *pt )
//-----------------------------------------------------------------------------
/** The bar follows the country, and is always ControlBar Pro's. A side with a ControlBar Pro scheme of
* its own (Boss and Observer among them) wears it; any other wears its country's by name, the way
- * ControlBarPlateForSide reads a side, so a mod's ChinaCyberGeneral gets China's and its
- * AmericaCyberneticGeneral America's, whatever scheme the mod itself ships for that side (ShockWave's
- * ChinaSpecialWeaponsGeneral is EA's red China bar). A side of no country we know (Russia, ECA, the
- * civilians) wears America's. The squished bar does not come here. */
+ * ControlBarPlateForSide reads a side, so a ChinaTankGeneral without one gets China's. A side of no
+ * country we know (the civilians) wears America's. The squished bar does not come here. */
//-----------------------------------------------------------------------------
ControlBarScheme *ControlBarSchemeManager::findSchemeForFaction( const AsciiString& side ) const
{
@@ -1486,7 +1419,6 @@ void ControlBarSchemeManager::drawPainting( ICoord2D offset, Bool foreground )
const Int last = foreground ? CONTROL_BAR_SCHEME_FOREGROUND_IMAGE_LAYERS : MAX_CONTROL_BAR_SCHEME_IMAGE_LAYERS;
const Int width = TheDisplay->getWidth();
const Int height = TheDisplay->getHeight();
- const Bool wide = TheControlBar && TheControlBar->isCommandGridWide();
const ICoord2D barOffset = offset;
for( Int p = 0; p < ControlBar::CB_PANEL_COUNT; p++ )
@@ -1521,8 +1453,7 @@ void ControlBarSchemeManager::drawPainting( ICoord2D offset, Bool foreground )
design.hi.x = REAL_TO_INT_CEIL( ( schemeImage->m_position.x + schemeImage->m_size.x ) * toDesignX );
design.hi.y = REAL_TO_INT_CEIL( ( schemeImage->m_position.y + schemeImage->m_size.y ) * toDesignY );
ControlBarPanelDesignToScreen( p, &design, width, height, &rect );
- const Image *image = ( wide && schemeImage->m_wideImage ) ? schemeImage->m_wideImage : schemeImage->m_image;
- TheDisplay->drawImage( image, rect.lo.x + offset.x, rect.lo.y + offset.y,
+ TheDisplay->drawImage( schemeImage->m_image, rect.lo.x + offset.x, rect.lo.y + offset.y,
rect.hi.x + offset.x, rect.hi.y + offset.y );
}
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/FactionPicker.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/FactionPicker.cpp
index 9b0195d3c..327bffa77 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/FactionPicker.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/FactionPicker.cpp
@@ -22,7 +22,7 @@
// modal while it is up, in the front end's look (UIStyle.h): the armies on the left under their
// sides' headings with Random All and Custom Selection over them, the focused army's portrait, name
// and description on the right, Back and Confirm in the room's button row. It reads the armies from
-// the seat's own box, so whatever the box lists (the generals, a mod's sides, Observer where the room
+// the seat's own box, so whatever the box lists (the sides, the generals, Observer where the room
// has one) is what the screen offers, and it hands the pick back through the box. Every tile is one
// size whatever the box lists; a list taller than its place scrolls, with the wheel and a bar.
//
@@ -91,7 +91,7 @@ struct PickerCell
{
Int pick; ///< the box's item data: a template or PLAYERTEMPLATE_OBSERVER
Int poolBit; ///< its bit in a Random pool, -1 when it cannot go in one
- UnicodeString name; ///< the box's own line, so a mod's faction reads as the box has it
+ UnicodeString name; ///< the box's own line, so an army reads as the box has it
const Image *icon;
const Image *portrait;
UnicodeString strategy;
@@ -103,8 +103,6 @@ struct PickerCell
struct PickerGroup
{
AsciiString leadSide;
- AsciiString baseSide; ///< a mod's groups only
- Int mod;
UnicodeString name;
DisplayString *heading;
ICoord2D at;
@@ -311,34 +309,10 @@ static Bool canConfirm( void )
return s_focus >= 0 || !s_custom || tickedCount() > 0;
}
-/// "Contra - USA": EA's own word for a country where there is one, the mod's BaseSide as written otherwise
-static UnicodeString modGroupName( Int mod, const AsciiString &baseSide )
-{
- WideChar modName[ 128 ];
- WideCharFromUtf8( TheGlobalData->m_modNames[ mod ].str(), modName, ARRAY_SIZE( modName ) );
- UnicodeString name( modName );
- name.concat( u" - " );
- AsciiString label;
- label.format( "SIDE:%s", baseSide == "USA" ? "America" : baseSide.str() );
- Bool exists = FALSE;
- const UnicodeString country = TheGameText->fetch( label, &exists );
- if( exists )
- {
- name.concat( country );
- }
- else
- {
- UnicodeString written;
- written.translate( baseSide );
- name.concat( written );
- }
- return name;
-}
-
//-------------------------------------------------------------------------------------------------
/** The armies in the box, each under the first army of its side: a general's Side begins with his
* side's ("AmericaLaserGeneral" under "America"), so Turkiye, on America's BaseSide but a side of its
- * own, heads its own group, and a mod's sides stay with their mod. */
+ * own, heads its own group. */
static void buildCells( void )
{
std::vector<Int> candidates;
@@ -361,8 +335,6 @@ static void buildCells( void )
cell.label = NULL;
AsciiString side = "Observer";
- AsciiString baseSide;
- Int mod = -1;
if( pick == PLAYERTEMPLATE_OBSERVER )
{
cell.icon = TheMappedImageCollection->findImageByName( "FactionPickerObserver" );
@@ -374,14 +346,13 @@ static void buildCells( void )
{
const PlayerTemplate *pt = ThePlayerTemplateStore->getNthPlayerTemplate( pick );
side = pt->getSide();
- mod = pt->getModIndex();
for( size_t n = 0; n < candidates.size() && n < RANDOM_POOL_BITS; n++ )
{
if( candidates[ n ] == pick )
cell.poolBit = (Int)n;
}
- // our card for the army (FactionPickerFactionChinaNukeGeneral), a mod's or a general's without
- // one its country's; where no card is mapped, the challenge screen's pictures of a retail
+ // our card for the army (FactionPickerFactionChinaNukeGeneral), a general's without one its
+ // country's; where no card is mapped, the challenge screen's pictures of a retail
// general, else the side's logo
const Image *card = ControlBarSideImage( pt, "FactionPicker" );
const GeneralPersona *persona = TheChallengeGenerals->getGeneralByTemplateName( pt->getName() );
@@ -392,9 +363,7 @@ static void buildCells( void )
cell.strategy = TheGameText->fetch( pt->getTooltip() );
if( !pt->getGeneralFeatures().isEmpty() )
cell.features = TheGameText->fetch( pt->getGeneralFeatures() );
- baseSide = pt->getBaseSide();
- // every mod faction stays out of a plain Random, too many to name; the list of who it draws says so
- if( pt->isRandomExcluded() && mod < 0 )
+ if( pt->isRandomExcluded() )
{
if( !s_leftOut.isEmpty() )
s_leftOut.concat( u", " );
@@ -407,22 +376,17 @@ static void buildCells( void )
cell.label->setWordWrapCentered( TRUE );
}
- // A mod lists its generals in any order and its plain side last (Contra), so its groups go by
- // BaseSide: one heading a country, however many generals it brings.
size_t group = 0;
for( ; group < s_groups.size(); group++ )
{
- const PickerGroup &g = s_groups[ group ];
- if( g.mod == mod && ( mod >= 0 ? g.baseSide == baseSide : side.startsWith( g.leadSide ) ) )
+ if( side.startsWith( s_groups[ group ].leadSide ) )
break;
}
if( group == s_groups.size() )
{
PickerGroup lead;
lead.leadSide = side;
- lead.baseSide = baseSide;
- lead.mod = mod;
- lead.name = mod >= 0 ? modGroupName( mod, baseSide ) : cell.name;
+ lead.name = cell.name;
lead.heading = newText( lead.name, UIStyle::font( UIStyle::TEXT_HEADING ) );
lead.mask = 0;
s_groups.push_back( lead );
@@ -609,7 +573,7 @@ static void refresh( void )
UnicodeString confirm;
confirm.format( TheGameText->fetch( "GUI:FactionPickConfirm" ), name.str() );
s_confirmText->setText( UIStyle::capitals( confirm ) );
- // "Contra - USA Air Force General" is wider than the button in the heading's letters
+ // a long general's name ("USA Superweapon General") is wider than the button in the heading's letters
const UIStyle::TextSize sizes[] = { UIStyle::TEXT_HEADING, UIStyle::TEXT_STRONG, UIStyle::TEXT_BODY };
for( size_t each = 0; each < ARRAY_SIZE( sizes ); each++ )
{
@@ -1112,7 +1076,7 @@ void FactionPickerAttach( GameWindow *parent, const char *layoutFilename )
name.format( "%s:ComboBoxPlayerTemplate%d", layoutFilename, i );
GameWindow *combo = TheWindowManager->winGetWindowFromId( parent, NAMEKEY( name ) );
if( !combo )
- continue; // a mod's layout with fewer seats
+ continue; // a layout with fewer seats
combo->winSetInputFunc( comboInput );
combo->winSetSystemFunc( comboSystem );
if( !first )
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp
index abdd1a212..1fdfbfe49 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp
@@ -555,7 +555,7 @@ static void putUpgradeTargets( BuildTooltipCard &card, const UpgradeTemplate *up
//-------------------------------------------------------------------------------------------------
/** The class of `thing`'s unconditioned armour: TOOLTIP:Armor and the Armor block's name with its first
* "Armor" taken out (TankArmor reads TOOLTIP:ArmorTank, StructureArmorTough TOOLTIP:ArmorStructureTough).
- * A mod's armour the string table does not know shows that name itself. Empty when the set wears none. */
+ * An armour the string table does not know shows that name itself. Empty when the set wears none. */
//-------------------------------------------------------------------------------------------------
static UnicodeString armorClass( const ThingTemplate *thing )
{
@@ -1267,8 +1267,8 @@ void ControlBar::populateBuildTooltipLayout( const CommandButton *commandButton,
GadgetStaticTextSetText(win, name);
}
- // the price is drawn with its icon by the card now; a mod's copy of EA's layout still has the
- // window that used to say it, empty
+ // the price is drawn with its icon by the card now; EA's layout still has the window that used
+ // to say it, empty
static const NameKeyType costID = TheNameKeyGenerator->nameToKey( "ControlBarPopupDescription.wnd:StaticTextCost" );
win = TheWindowManager->winGetWindowFromId( m_buildToolTipLayout->getFirstWindow(), costID );
if( win )
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ChallengeMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ChallengeMenu.cpp
index 107a6d2a7..96983463d 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ChallengeMenu.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ChallengeMenu.cpp
@@ -145,7 +145,7 @@ Int findPositionButton( Int controlID )
//-------------------------------------------------------------------------------------------------
-// A general the loaded data cannot field: a mod's ChallengeMode.ini names a player template, a
+// A general the loaded data cannot field: a ChallengeMode.ini that names a player template, a
// campaign, a map or an opponent its files lack, and the game found out only at the start, in a
// crash. The data does not change while the game runs, so each is decided and logged once.
//-------------------------------------------------------------------------------------------------
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp
index a653bb5ba..e12dc8ace 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/GameInfoWindow.cpp
@@ -180,7 +180,7 @@ void RefreshGameInfoWindow(GameInfo *gameInfo, UnicodeString gameName)
}
else
{
- // our icon by name (GameinfoTURKIYE, a mod's its base side's), else the template's own
+ // our icon by name (GameinfoTURKIYE), else the template's own
const PlayerTemplate *fact = ThePlayerTemplateStore->getNthPlayerTemplate(playerTemplate);
const Image *icon = ControlBarSideImage(fact, "Gameinfo");
GadgetListBoxAddEntryImage(listBoxPlayers, icon ? icon : fact->getSideIconImage(),addedRow, 0, 22,25);
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp
index 34dff883c..f161d3412 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/MainMenu.cpp
@@ -285,8 +285,8 @@ static void showSelectiveButtons( Int show )
// over the menu pops: no mission button ever moves up or down, and Back's x is theirs.
static void showMissionMenu( const char *group )
{
- // a mod's Campaign.ini can leave a side's campaign out (End of Days has only the challenge ones);
- // setCampaign found none, and that side's panel comes up with Back alone
+ // a Campaign.ini can leave a side's campaign out; setCampaign found none, and that side's panel
+ // comes up with Back alone
Campaign *campaign = TheCampaignManager->getCurrentCampaign();
Mission *mission = campaign ? campaign->getNextMission( NULL ) : NULL;
Int backX, backY;
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp
index 0d7c84128..6fc69f29b 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp
@@ -1067,7 +1067,7 @@ static void setDefaults( void )
// Extra Animations (buildups) and Swaying Trees checkboxes
//
GadgetCheckBoxSetChecked( checkExtraAnimations, !TheGlobalData->m_useDrawModuleLOD);
- // the fork's box: a stock or modded OptionsMenu.wnd that wins over Run/Window has none
+ // the fork's box: a stock OptionsMenu.wnd that wins over Run/Window has none
if( checkTreeSway )
GadgetCheckBoxSetChecked( checkTreeSway, TheGlobalData->m_useTreeSway);
@@ -2694,23 +2694,6 @@ void OptionsMenuInit( WindowLayout *layout, void *userData )
UnicodeString releaseVersion;
releaseVersion.translate( TheVersion->getReleaseVersion() );
versionString.concat( releaseVersion );
- if (TheGlobalData->m_modName.isNotEmpty())
- {
- // the label is one line under the menu; a long -mod list keeps its start, the replay keeps all of it
- const Int MAX_MOD_CHARS = 48;
- UnicodeString mods = TheVersion->getUnicodeModName();
- if (mods.getLength() > MAX_MOD_CHARS)
- {
- UnicodeString cut;
- for (Int i = 0; i < MAX_MOD_CHARS - 3; ++i)
- cut.concat( mods.getCharAt( i ) );
- cut.concat( u"..." );
- mods = cut;
- }
- versionString.concat( u" [" );
- versionString.concat( mods );
- versionString.concat( u"]" );
- }
if (TheVersion->showFullVersion())
{
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenuHotkeys.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenuHotkeys.cpp
index aa44ef2db..e45168185 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenuHotkeys.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenuHotkeys.cpp
@@ -276,31 +276,19 @@ void findBars( void )
const CommandSet *set = thing ? TheControlBar->findCommandSet( thing->friend_getCommandSetString() ) : NULL;
if( set == NULL )
continue;
- const CommandButton *slots[ MAX_COMMANDS_PER_SET ];
- Int types[ MAX_COMMANDS_PER_SET ];
- for( Int slot = 0; slot < MAX_COMMANDS_PER_SET; slot++ )
- {
- const CommandButton *button = set->getCommandButton( slot );
- slots[ slot ] = ( button && !BitTest( button->getOptions(), SCRIPT_ONLY ) ) ? button : NULL;
- types[ slot ] = slots[ slot ] ? slots[ slot ]->getCommandType() : GUI_COMMAND_NONE;
- }
- // the windows as the bar fills them (ControlBar::populateCommand), so a slot here is the
- // slot a Name@slot key and the grid's letters mean: a set's button past the bar's
- // windows moves into an empty one. A mod's wide bar has all eighteen.
- Bool windowed[ MAX_COMMANDS_PER_SET ];
- Int shown[ MAX_COMMANDS_PER_SET ];
- for( Int slot = 0; slot < MAX_COMMANDS_PER_SET; slot++ )
- windowed[ slot ] = TheControlBar->hasCommandWindow( slot );
- ControlBar_fitCommandSlots( types, windowed, MAX_COMMANDS_PER_SET, shown );
BarObject object;
object.building = thing->isKindOf( KINDOF_STRUCTURE );
Bool any = FALSE;
for( Int slot = 0; slot < BAR_SLOTS; slot++ )
{
- object.slots[ slot ] = shown[ slot ] >= 0 ? slots[ shown[ slot ] ] : NULL;
+ // the windows as the bar fills them (ControlBar::populateCommand), so a slot here is the
+ // slot a Name@slot key and the grid's letters mean
+ const CommandButton *button = set->getCommandButton( slot );
+ if( !TheControlBar->hasCommandWindow( slot ) || ( button && BitTest( button->getOptions(), SCRIPT_ONLY ) ) )
+ button = NULL;
+ object.slots[ slot ] = button;
// a button with no picture is a blank cell on the bar that still holds its key and its
// place among the upgrades; it is not listed, and what only it builds is not reached
- const CommandButton *button = object.slots[ slot ];
if( button == NULL || button->getButtonImage() == NULL )
continue;
any = TRUE;
@@ -446,10 +434,10 @@ void fillButtons( void )
}
const std::map< std::string, WideChar > keys = buttonKeys();
const std::map< KeyText, std::vector< UnicodeString > > clashes = barClashes( object );
- // a cameo is 61 by 48 on the bar; a third of that keeps a bar's rows, eighteen on a mod's wide one, to a short scroll
+ // a cameo is 61 by 48 on the bar; a third of that keeps a bar's rows to a short scroll
const Int height = 22;
Int selectedRow = -1;
- // the bar's own order: two rows, seven or nine across, read down each column, 1 over 2
+ // the bar's own order: two rows, seven across, read down each column, 1 over 2
for( Int slot = 0; slot < BAR_SLOTS; slot++ )
{
const CommandButton *button = object->slots[ slot ];
@@ -457,7 +445,7 @@ void fillButtons( void )
continue;
const UnicodeString key = buttonKeyText( object, slot, keys );
const Bool waiting = s_capture == CAPTURE_BUTTON && button == s_button;
- const Bool changed = s_file.buttons.count( HotKeyManager::fileButtonName( button->getName() ) ) != 0;
+ const Bool changed = s_file.buttons.count( button->getName().str() ) != 0;
const Int at = GadgetListBoxAddEntryImage( s_buttonList, button->getButtonImage(), -1, 0, height, height * 61 / 48 );
GadgetListBoxAddEntryText( s_buttonList, buttonName( button ), changed ? CHANGED_COLOR : TEXT_COLOR, at, 1 );
GadgetListBoxAddEntryText( s_buttonList,
@@ -537,7 +525,7 @@ void updateNote( void )
else if( s_active == 1 && s_button )
{
const WideChar fixed = HotKeyManager::fixedKey( s_button->getName(), s_button->getCommandType() );
- const std::string name = HotKeyManager::fileButtonName( s_button->getName() );
+ const std::string name = s_button->getName().str();
changed = s_file.buttons.count( name ) != 0;
canChange = TRUE;
if( s_capture == CAPTURE_BUTTON )
@@ -611,9 +599,9 @@ void applySelected( const HotkeyBinding *binding, Bool backToGame )
else if( s_active == 1 && s_button )
{
if( backToGame )
- s_file.buttons.erase( HotKeyManager::fileButtonName( s_button->getName() ) );
+ s_file.buttons.erase( s_button->getName().str() );
else
- s_file.buttons[ HotKeyManager::fileButtonName( s_button->getName() ) ] = binding->key.size() == 5 ? binding->key.substr( 4 ) : std::string();
+ s_file.buttons[ s_button->getName().str() ] = binding->key.size() == 5 ? binding->key.substr( 4 ) : std::string();
}
s_capture = CAPTURE_NONE;
refresh();
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp
index d8405497e..a28c52794 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/SkirmishGameOptionsMenu.cpp
@@ -226,7 +226,7 @@ void skirmishUpdateSlotList( void );
void skirmishPositionStartSpots( void );
static void populateSkirmishBattleHonors( void );
// The turbo mode box, the only speed a skirmish has besides normal. It is the fork's control, so a
-// stock or modded SkirmishGameOptionsMenu.wnd that wins over Run/Window has none and plays at normal
+// stock SkirmishGameOptionsMenu.wnd that wins over Run/Window has none and plays at normal
// speed. The old game speed dropdown's "FPS" preference is left in the file and never read.
static Bool turboBoxChecked( void )
{
@@ -1266,7 +1266,7 @@ void InitSkirmishGameGadgets( void )
buttonRecordCloseID = NAMEKEY( "SkirmishGameOptionsMenu.wnd:ButtonRecordClose" );
recordPopover = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, NAMEKEY( "SkirmishGameOptionsMenu.wnd:RecordPopover" ) );
recordVeil = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, NAMEKEY( "SkirmishGameOptionsMenu.wnd:RecordVeil" ) );
- // a layout from before the record (retail's, or a mod's in the install folder) has neither, and
+ // a layout from before the record (retail's, in the install folder) has neither, and
// no Record button to open them
if ( recordPopover )
{
@@ -1617,7 +1617,7 @@ void SkirmishGameOptionsMenuInit( WindowLayout *layout, void *userData )
//updateSkirmishGameOptions();
//initSkirmishGameOptions();
- // the turbo box, which a stock or modded layout does not have (turboBoxChecked)
+ // the turbo box, which a stock layout does not have (turboBoxChecked)
GameWindow *checkBoxTurbo = TheWindowManager->winGetWindowFromId( parentSkirmishGameOptions, checkBoxTurboID );
if ( checkBoxTurbo )
GadgetCheckBoxSetChecked( checkBoxTurbo, prefs.getInt( "TurboMode", 0 ) != 0 );
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp
index 349072440..9112bbb69 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp
@@ -53,9 +53,7 @@
#include "Common/AudioEventRTS.h"
#include "Common/GameAudio.h"
#include "Common/Debug.h"
-#include "Common/GlobalData.h"
#include "GameClient/DisplayStringManager.h"
-#include "GameClient/GameFont.h"
#include "GameClient/GameWindow.h"
#include "GameClient/Gadget.h"
#include "GameClient/GameWindowManager.h"
@@ -89,34 +87,6 @@ static Int dropDownHeight( WinInstanceData *listInstData, Int lines, Bool scroll
return (fontHeight + (scrolls ? 1 : 2)) * lines + (scrolls ? 6 : 4);
}
-// A seat's Army field was cut for "China Tank General"; a mod's name in front of that runs into the
-// arrow. Only the picked label goes smaller, and the next short one is back at the combo's own size.
-static void fitFieldToLabel( GameWindow *combo, GameWindow *field, const UnicodeString &label )
-{
- static const Int FIELD_MARGIN = 6;
- static const Int SMALLEST_POINT_SIZE = 8;
-
- if( !TheGlobalData->m_modFactions )
- return;
-
- Int fieldWidth, fieldHeight;
- field->winGetSize( &fieldWidth, &fieldHeight );
-
- GameFont *font = combo->winGetFont();
- DisplayString *measured = TheDisplayStringManager->newDisplayString();
- measured->setFont( font );
- measured->setText( label );
- while( measured->getWidth() > fieldWidth - FIELD_MARGIN && font->pointSize > SMALLEST_POINT_SIZE )
- {
- font = TheFontLibrary->getFont( font->nameString, font->pointSize - 1, font->bold );
- measured->setFont( font );
- }
- TheDisplayStringManager->freeDisplayString( measured );
-
- if( font != field->winGetFont() )
- field->winSetFont( font );
-}
-
///////////////////////////////////////////////////////////////////////////////
// PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
@@ -502,7 +472,6 @@ WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg,
GadgetTextEntrySetTextColor(comboData->editBox, color);
- fitFieldToLabel(window, comboData->editBox, tempUString);
GadgetTextEntrySetText(comboData->editBox, tempUString);
TheWindowManager->winSendSystemMsg( window->winGetOwner(),
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp
index af5fd4675..217889518 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/LoadScreen.cpp
@@ -386,8 +386,8 @@ static void fitWidth( DisplayString *string, Int widest )
} while( words.getLength() > 0 && string->getWidth() > widest );
}
-/** The side's crest from the lobby: the three 144 pixel logos on one page. A mod's side brings its
- * own lobby glyph or nothing. */
+/** The side's crest from the lobby: the three 144 pixel logos on one page. A side on none of the
+ * three brings its own lobby glyph or nothing. */
static const Image *sideCrest( const PlayerTemplate *side )
{
const AsciiString base = side->getBaseSide();
@@ -993,7 +993,7 @@ void LoadScreenBoard::drawMatch( void )
TheDisplay->drawImage( m_mapImage, m_mapDrawn.lo.x, m_mapDrawn.lo.y, m_mapDrawn.hi.x, m_mapDrawn.hi.y );
// the lobby's map preview wears a button's edge
UIStyle::edge( m_mapBox.lo.x - 3, m_mapBox.lo.y - 3, mapSize + 6, mapSize + 6 );
- // the room's start spot: EA's ring (a mod's archives may leave it out), the colour in its middle
+ // the room's start spot: EA's ring (missing art draws no ring), the colour in its middle
const Int spot = mapSize * LOBBY_START_SPOT / LOBBY_MAP_PREVIEW;
const Image *ring = TheMappedImageCollection->findImageByName( "PlayerStart" );
for( size_t each = 0; each < m_spots.size(); each++ )
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/UIStyle.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/UIStyle.cpp
index 22ef7898c..3c6be9793 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/UIStyle.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/UIStyle.cpp
@@ -73,7 +73,7 @@ void shell( void )
{
const Int width = TheDisplay->getWidth();
const Int height = TheDisplay->getHeight();
- // both are retail art a mod's archives may leave out
+ // both are retail art an incomplete install may lack
const Image *still = TheMappedImageCollection->findImageByName( "MainMenuBackdrop" );
if( still )
TheDisplay->drawImage( still, 0, 0, width, height );
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameText.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GameText.cpp
index 22d75f268..bbc40cb34 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GameText.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GameText.cpp
@@ -114,14 +114,6 @@ struct StringLookUp
StringInfo *info;
};
-/// one -modfactions mod's own labels: info owns the strings, lut is sorted by compareLUT
-struct ModStringTable
-{
- StringInfo *info;
- StringLookUp *lut;
- Int count;
-};
-
//===============================
// CSFHeader
//===============================
@@ -170,21 +162,9 @@ class GameTextManager : public GameTextInterface
virtual void initMapStringFile( const AsciiString& filename );
virtual WideChar fetchEnglishHotKey( const AsciiString& label );
- virtual void loadModStrings( Int mod );
- virtual Bool hasModLabel( Int mod, const char *label ) const;
protected:
- /// -modfactions: each mod's own labels (English CSF and STR), by mod index; empty with no full -mod
- std::vector< ModStringTable > m_modStrings;
- /// each mod's CSF in the player's language, text only: never consulted for the label set
- std::vector< ModStringTable > m_modLangStrings;
- /// the mod index of a "M<n>~" label with a loaded table, or -1
- Int modLabelIndex( const char *label ) const;
- void readModTable( ModStringTable &table, const char *csf, const char *str );
- /// the mod's text for label: its language's CSF first, then its English CSF and STR
- StringLookUp *findModText( Int mod, const char *label ) const;
-
/// label (lower case) -> its English hotkey letter, filled once the table is read
std::map< std::string, WideChar > m_englishHotKeys;
@@ -230,15 +210,6 @@ class GameTextManager : public GameTextInterface
};
static int _cdecl compareLUT ( const void *, const void*);
-
-static StringLookUp *findModLabel( const ModStringTable &table, const char *label )
-{
- AsciiString lb = label;
- StringLookUp key;
- key.info = NULL;
- key.label = &lb;
- return (StringLookUp *) bsearch( &key, (void*) table.lut, table.count, sizeof(StringLookUp), compareLUT );
-}
//----------------------------------------------------------------------------
// Private Data
//----------------------------------------------------------------------------
@@ -564,16 +535,6 @@ void GameTextManager::deinit( void )
m_textCount = 0;
- for ( size_t mod = 0; mod < m_modStrings.size(); ++mod )
- {
- delete [] m_modStrings[ mod ].info;
- delete [] m_modStrings[ mod ].lut;
- delete [] m_modLangStrings[ mod ].info;
- delete [] m_modLangStrings[ mod ].lut;
- }
- m_modStrings.clear();
- m_modLangStrings.clear();
-
NoString *noString = m_noStringList;
DEBUG_LOG(("\n*** Missing strings ***\n"));
@@ -1448,23 +1409,6 @@ UnicodeString GameTextManager::fetch( const Char *label, Bool *exists )
return m_failed;
}
- // -modfactions: "M<n>~LABEL" is mod n-1's own LABEL, and ours when that mod has none
- if ( label[0] == 'M' && !m_modStrings.empty() )
- {
- Int mod = modLabelIndex( label );
- if ( mod >= 0 )
- {
- label += 3;
- StringLookUp *own = findModText( mod, label );
- if ( own )
- {
- if( exists )
- *exists = TRUE;
- return own->info->text;
- }
- }
- }
-
StringLookUp *lookUp;
StringLookUp key;
AsciiString lb;
@@ -1522,143 +1466,12 @@ UnicodeString GameTextManager::fetch( AsciiString label, Bool *exists )
return fetch(label.str(), exists);
}
-//============================================================================
-// GameTextManager::modLabelIndex
-//============================================================================
-
-Int GameTextManager::modLabelIndex( const char *label ) const
-{
- if ( label[0] != 'M' || label[1] < '1' || label[1] > '9' || label[2] != '~' )
- return -1;
- Int mod = label[1] - '1';
- return mod < (Int)m_modStrings.size() && m_modStrings[ mod ].lut != NULL ? mod : -1;
-}
-
-//============================================================================
-// GameTextManager::loadModStrings
-//============================================================================
-
-void GameTextManager::loadModStrings( Int mod )
-{
- if ( (Int)m_modStrings.size() <= mod )
- {
- ModStringTable none = { NULL, NULL, 0 };
- m_modStrings.resize( mod + 1, none );
- m_modLangStrings.resize( mod + 1, none );
- }
-
- // The label set decides which INI words get "M<n>~", so it may not depend on the player's
- // language: the English CSF and the STR only. The language's CSF is text alone, read first.
- AsciiString csfFile;
- csfFile.format(g_csfFile, "English");
- readModTable( m_modStrings[ mod ], csfFile.str(), g_strFile );
- AsciiString language = GetRegistryLanguage();
- csfFile.format(g_csfFile, language.str());
- readModTable( m_modLangStrings[ mod ], language.compareNoCase( "English" ) ? csfFile.str() : NULL, NULL );
-
- DEBUG_LOG(("MODNS M%d~ strings: %d labels\n", mod + 1, m_modStrings[ mod ].count));
-}
-
-//============================================================================
-// GameTextManager::readModTable
-//============================================================================
-
-void GameTextManager::readModTable( ModStringTable &table, const char *csf, const char *str )
-{
- // getCSFInfo sizes through our own count and language; keep ours
- Int ourCount = m_textCount;
- LanguageID ourLanguage = m_language;
- Int csfCount = csf && getCSFInfo( csf ) ? m_textCount : 0;
- m_textCount = ourCount;
- m_language = ourLanguage;
- Int strCount = 0;
- if ( str )
- getStringCount( str, strCount );
-
- table.info = NEW StringInfo[ csfCount + strCount ];
-
- // the parsers fill m_stringInfo from index 0: point it at the mod's table, the STR after the CSF
- StringInfo *ours = m_stringInfo;
- m_stringInfo = table.info;
- if ( csfCount )
- parseCSF( csf );
- m_stringInfo = table.info + csfCount;
- if ( strCount )
- parseStringFile( str );
- m_stringInfo = ours;
-
- // the STR's padding leaves empty entries behind; they are no label
- table.lut = NEW StringLookUp[ csfCount + strCount ];
- table.count = 0;
- for ( Int i = 0; i < csfCount + strCount; i++ )
- {
- if ( table.info[ i ].label.isEmpty() )
- continue;
- table.lut[ table.count ].info = &table.info[ i ];
- table.lut[ table.count ].label = &table.info[ i ].label;
- table.count++;
- }
- qsort( table.lut, table.count, sizeof(StringLookUp), compareLUT );
-
- // a label in both files: the entry further along, the STR's, wins, as the overlays do in init
- if ( table.count > 1 )
- {
- Int kept = 1;
- for ( Int i = 1; i < table.count; i++ )
- {
- if ( table.lut[i].label->compareNoCase( table.lut[kept - 1].label->str() ) == 0 )
- {
- if ( table.lut[i].info > table.lut[kept - 1].info )
- table.lut[kept - 1] = table.lut[i];
- continue;
- }
- table.lut[kept] = table.lut[i];
- kept++;
- }
- table.count = kept;
- }
-}
-
-//============================================================================
-// GameTextManager::findModText
-//============================================================================
-
-StringLookUp *GameTextManager::findModText( Int mod, const char *label ) const
-{
- StringLookUp *own = findModLabel( m_modLangStrings[ mod ], label );
- return own ? own : findModLabel( m_modStrings[ mod ], label );
-}
-
-//============================================================================
-// GameTextManager::hasModLabel
-//============================================================================
-
-Bool GameTextManager::hasModLabel( Int mod, const char *label ) const
-{
- return findModLabel( m_modStrings[ mod ], label ) != NULL;
-}
-
//============================================================================
// GameTextManager::fetchEnglishHotKey
//============================================================================
WideChar GameTextManager::fetchEnglishHotKey( const AsciiString& label )
{
- // a mod's own label: the letter after '&' in the mod's text, which is the mod's own key
- Int mod = m_modStrings.empty() ? -1 : modLabelIndex( label.str() );
- if ( mod >= 0 )
- {
- StringLookUp *own = findModText( mod, label.str() + 3 );
- if ( own )
- {
- const WideChar *amp = own->info->text.str();
- while ( *amp && *amp != u'&' )
- amp++;
- return ( *amp && amp[ 1 ] > u' ' ) ? amp[ 1 ] : 0;
- }
- return fetchEnglishHotKey( AsciiString( label.str() + 3 ) );
- }
-
AsciiString key = label;
key.toLower();
std::map< std::string, WideChar >::const_iterator it = m_englishHotKeys.find( key.str() );
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index 8863f3cea..b8da61d78 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -221,7 +221,7 @@ struct HudTray
* the border alone, as its shipped column does. What else is the side's is the plate under every
* readout, a piece of its own button sheet (<side>ProHudCellPlate in ReforgedHud<side>Powers). A
* sheet without the plate yet gets HudReadout_draw's solid one. A side no build is named for, an
- * observer's or a mod's, wears America's. */
+ * observer's, wears America's. */
//-------------------------------------------------------------------------------------------------
struct HudCellStyle
{
@@ -492,7 +492,7 @@ static void drawHudTab( const Image *art, const IRegion2D &tab, Int hangs, Displ
//-------------------------------------------------------------------------------------------------
/** The cameo a special power is fired from. A SpecialPowerTemplate carries no art of its own -
* the picture lives on whichever command button launches it - so the button list is what has to
- * be asked. A power with no button anywhere (a scripted one, a mod's) draws as an empty box
+ * be asked. A power with no button anywhere (a scripted one) draws as an empty box
* with its countdown in it, which is still the timer it was asked for. */
//-------------------------------------------------------------------------------------------------
static const CommandButton *powerButton( const SpecialPowerTemplate *powerTemplate )
@@ -558,7 +558,7 @@ static void drawHudCellBorder( const IRegion2D &cameo, Color border )
* INVALID_BUILD_PLACEMENT are two names in CursorININames[] that no shipped Mouse.ini ever
* defines, so asking for them left m_cursorInfo empty and drew nothing at all - the pointer
* simply vanished for as long as something was being placed. Honour the build cursors when art
- * for them does exist (a mod may add it), and otherwise fall back to cursors that are always
+ * for them does exist, and otherwise fall back to cursors that are always
* there: the crosshair for a spot that can be built on, the no-go pointer for one that cannot. */
//-------------------------------------------------------------------------------------------------
static Mouse::MouseCursor placementCursor( Bool legal )
@@ -1877,7 +1877,7 @@ void InGameUI::setRadiusCursor(RadiusCursorType cursorType, const SpecialPowerTe
// EA's guard marker is one picture, the ring with the shield in its middle, so sizing it to
// the wheeled radius stretched the shield too. The two are drawn apart (Tools/guard_marker.py):
// the ring at the radius, the shield, half the picture's width, at the size it has unwheeled.
- // A mod's own marker stays one picture
+ // any other marker texture stays one picture
m_radiusCursors[cursorType].createRadiusDecal(pos, radius, controller, m_curRadiusCursor, "ReforgedGuardRing");
m_radiusCursors[cursorType].createRadiusDecal(pos, unwheeled * 0.5f, controller, m_curRadiusCursorCentre, "ReforgedGuardCentre");
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp
index 0d0ad7767..6aed9eca8 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Input/Mouse.cpp
@@ -1091,7 +1091,7 @@ void Mouse::drawTooltip( void )
Color textColor = GMC(m_tooltipFrameTextColor);
if( !ControlBarDrawNinePieceBox( art.cursor, box, scale ) )
{
- // no art for it (a mod's sheet): Mouse.ini's box
+ // no art for it: Mouse.ini's box
TheDisplay->drawFillRect(xPos, yPos, boxWidth, boxHeight, GMC(m_tooltipBackColor));
TheDisplay->drawOpenRect(xPos, yPos, boxWidth, boxHeight, 1.0, COLOR(Border));
textColor = GMC(m_tooltipTextColor);
@@ -1290,7 +1290,7 @@ void INI::parseMouseCursorDefinition( INI* ini )
ini->initFromINI( cursorInfo, TheMouseCursorFieldParseTable );
// every platform's cursor table holds MAX_2D_CURSOR_DIRECTIONS images a cursor, and loads as many
- // as Directions says: more (mod data; shipped is 8) wrote past it
+ // as Directions says: more (shipped is 8) wrote past it
if( cursorInfo->numDirections > MAX_2D_CURSOR_DIRECTIONS )
cursorInfo->numDirections = MAX_2D_CURSOR_DIRECTIONS;
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp
index 56526d6c4..a81a8bcbd 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MapUtil.cpp
@@ -1257,9 +1257,8 @@ const MapMetaData *MapCache::findMap(AsciiString mapName)
// the start positions are dealt out, and that caller does not survive a no. Two ways to get
// here: a generated map is in the cache only if something staged it this run, and a replay, a
// save or a game somebody else is hosting names one that nothing here has built (the name
- // carries the settings, so it is built on the spot); and a mod's own Maps\MapCache.ini shadows
- // the shipped one, so a shipped map the mod's file leaves out - the Generals Challenge maps
- // under some mods - is in the archives but nowhere in the cache.
+ // carries the settings, so it is built on the spot); and a Maps\MapCache.ini that leaves a
+ // shipped map out, which is then in the archives but nowhere in the cache.
//
FileInfo fileInfo;
if (!TheFileSystem->getFileInfo(mapName, &fileInfo))
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp
index 395a790de..7bde1f480 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp
@@ -495,52 +495,28 @@ static WideChar fixedButtonKey( const AsciiString& lowerName, Int commandType )
return 0;
}
-/** The scope Hotkeys.ini names mod `mod`'s buttons by, "<scope>:<button>": the -mod folder's name,
- * lower case and without spaces. The launcher's Hotkeys page uses the same (hotkeys.js, modScope). */
-static std::string modScope( Int mod )
+/** The player's key for a button, into *letter; FALSE leaves it alone. */
+static Bool findPlayerKey( const std::map< std::string, WideChar >& keys, const std::string& bare, WideChar *letter )
{
- std::string path( TheGlobalData->m_mods[ mod ].str() );
- while( !path.empty() && ( path[ path.size() - 1 ] == '\\' || path[ path.size() - 1 ] == '/' ) )
- path.erase( path.size() - 1 );
- const size_t slash = path.find_last_of( "\\/" );
- if( slash != std::string::npos )
- path.erase( 0, slash + 1 );
- std::string scope;
- for( size_t at = 0; at < path.size(); at++ )
- if( !isspace( (unsigned char)path[ at ] ) )
- scope += (char)tolower( (unsigned char)path[ at ] );
- return scope;
-}
-
-/** A lower case button name without the "m<n>~" -modfactions puts on a mod's own names; *mod gets
- * that mod's index, or -1 for a name with no prefix. */
-static std::string withoutModPrefix( const char *lowerName, Int *mod )
-{
- *mod = -1;
- const char *tilde = strchr( lowerName, '~' );
- if( lowerName[ 0 ] != 'm' || tilde == NULL || tilde == lowerName + 1 )
- return lowerName;
- for( const char *digit = lowerName + 1; digit < tilde; digit++ )
- if( !isdigit( (unsigned char)*digit ) )
- return lowerName;
- *mod = atoi( lowerName + 1 ) - 1;
- return tilde + 1;
+ std::map< std::string, WideChar >::const_iterator it = keys.find( bare );
+ if( it == keys.end() )
+ return FALSE;
+ *letter = it->second;
+ return TRUE;
}
-static Bool findPlayerKey( const std::map< std::string, WideChar >& keys, const std::string& bare, Int ownMod, WideChar *letter );
-
/** The player's key for a button standing in command bar slot barSlot (-1 off the bar), into *letter:
* his "<button>@<barSlot + 1>" there, else his "<button>". FALSE leaves *letter alone. */
-static Bool findPlayerSlotKey( const std::map< std::string, WideChar >& keys, const std::string& bare, Int ownMod, Int barSlot, WideChar *letter )
+static Bool findPlayerSlotKey( const std::map< std::string, WideChar >& keys, const std::string& bare, Int barSlot, WideChar *letter )
{
if( barSlot >= 0 )
{
char at[ 16 ];
snprintf( at, sizeof( at ), "@%d", barSlot + 1 );
- if( findPlayerKey( keys, bare + at, ownMod, letter ) )
+ if( findPlayerKey( keys, bare + at, letter ) )
return TRUE;
}
- return findPlayerKey( keys, bare, ownMod, letter );
+ return findPlayerKey( keys, bare, letter );
}
/** How strongly the command button win, in command bar slot barSlot or -1, holds key, the map's
@@ -552,45 +528,15 @@ static Int keyClaim( GameWindow *win, const AsciiString& key, Int barSlot )
const CommandButton *command = (const CommandButton *)GadgetButtonGetData( win );
AsciiString lower = command->getName();
lower.toLower();
- Int mod = -1;
- const std::string bare = withoutModPrefix( lower.str(), &mod );
WideChar letter = 0;
- if( findPlayerSlotKey( s_playerButtonKeys, bare, mod, barSlot, &letter ) )
+ if( findPlayerSlotKey( s_playerButtonKeys, std::string( lower.str() ), barSlot, &letter ) )
return letter != 0 && HotKeyManager::nameOf( letter ) == key ? 1 : 0;
if( s_commandBarGrid && barSlot >= 0 )
return 0;
- const WideChar fixed = fixedButtonKey( AsciiString( bare.c_str() ), command->getCommandType() );
+ const WideChar fixed = fixedButtonKey( lower, command->getCommandType() );
return fixed != 0 && HotKeyManager::nameOf( fixed ) == key ? 2 : 0;
}
-/** The player's key for a button, into *letter; FALSE leaves it alone. A mod's own button (ownMod,
- * under -modfactions) takes only its mod's "<scope>:<button>" entry. A plain name, which under a
- * plain -mod may be any loaded mod's, takes the last loaded mod's scoped entry that exists, then
- * the unscoped one, which is retail's. */
-static Bool findPlayerKey( const std::map< std::string, WideChar >& keys, const std::string& bare, Int ownMod, WideChar *letter )
-{
- std::map< std::string, WideChar >::const_iterator it;
- const Int modCount = TheGlobalData ? (Int)TheGlobalData->m_mods.size() : 0;
- for( Int mod = modCount - 1; mod >= 0; mod-- )
- {
- if( ownMod >= 0 && mod != ownMod )
- continue;
- it = keys.find( modScope( mod ) + ":" + bare );
- if( it != keys.end() )
- {
- *letter = it->second;
- return TRUE;
- }
- }
- if( ownMod >= 0 )
- return FALSE;
- it = keys.find( bare );
- if( it == keys.end() )
- return FALSE;
- *letter = it->second;
- return TRUE;
-}
-
static Bool isOneOf( WideChar letter, const WideChar *letters, Int count )
{
for( Int each = 0; each < count; each++ )
@@ -643,23 +589,7 @@ WideChar HotKeyManager::fixedKey( const AsciiString& button, Int commandType )
{
AsciiString lower = button;
lower.toLower();
- Int ownMod = -1;
- return fixedButtonKey( AsciiString( withoutModPrefix( lower.str(), &ownMod ).c_str() ), commandType );
-}
-
-//-----------------------------------------------------------------------------
-std::string HotKeyManager::fileButtonName( const AsciiString& button )
-{
- AsciiString lower = button;
- lower.toLower();
- Int ownMod = -1;
- withoutModPrefix( lower.str(), &ownMod );
- std::string name( button.str() );
- if( ownMod >= 0 )
- return modScope( ownMod ) + ":" + name.substr( name.find( '~' ) + 1 );
- if( !TheGlobalData->m_mods.empty() && !TheGlobalData->m_modFactions )
- return modScope( (Int)TheGlobalData->m_mods.size() - 1 ) + ":" + name;
- return name;
+ return fixedButtonKey( lower, commandType );
}
//-----------------------------------------------------------------------------
@@ -671,12 +601,10 @@ WideChar HotKeyManager::buttonKeyIn( const AsciiString& button, WideChar labelKe
return 0;
AsciiString lower = button;
lower.toLower();
- Int ownMod = -1;
- const std::string bare = withoutModPrefix( lower.str(), &ownMod );
// the player's letter first, his for this slot before his for the button, a fixed order's
// included: the fixed letter is only its default. With the grid on, the bar's place is next
WideChar letter = labelKey;
- const Bool chosen = findPlayerSlotKey( keys, bare, ownMod, barSlot, &letter );
+ const Bool chosen = findPlayerSlotKey( keys, std::string( lower.str() ), barSlot, &letter );
if( !chosen && s_commandBarGrid && barSlot >= 0 )
{
const Bool upgrade = commandType == GUI_COMMAND_PLAYER_UPGRADE || commandType == GUI_COMMAND_OBJECT_UPGRADE;
@@ -684,7 +612,7 @@ WideChar HotKeyManager::buttonKeyIn( const AsciiString& button, WideChar labelKe
}
if( !chosen )
{
- const WideChar fixed = fixedButtonKey( AsciiString( bare.c_str() ), commandType );
+ const WideChar fixed = fixedButtonKey( lower, commandType );
if( fixed != 0 )
return fixed;
}
@@ -1004,7 +932,7 @@ std::vector< HotkeyCommandRow > Hotkeys_commandRows( const std::string& commandM
unbound.push_back( commandRow( "AUTO_GARRISON", "CONTROL" ) );
unbound.push_back( commandRow( "AUTO_REPAIR", "CONTROL" ) );
// the orders the bar's fixed places press (orderAtPlace in ControlBar.cpp). Their buttons take
- // a letter from the button's label, which a mod's CommandSet names, so without these rows a mod
+ // a letter from the button's label, which the CommandSet names, so without these rows a set
// whose guard button sat elsewhere or had no letter left guard with no key a player could set
static const char *const ORDERS[] = { "TOGGLE_ATTACKMOVE", "TOGGLE_FORCEATTACK", "TOGGLE_GUARD", "TOGGLE_MOVE", "HOLD_POSITION" };
for( size_t each = 0; each < sizeof( ORDERS ) / sizeof( ORDERS[ 0 ] ); each++ )
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/RadiusDecal.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/RadiusDecal.cpp
index 365c8a14e..32f0115c1 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/RadiusDecal.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/RadiusDecal.cpp
@@ -157,7 +157,7 @@ static void parseRetiredField( INI *, void *, void *, const void * )
{ "OpacityThrobTime", INI::parseDurationUnsignedInt,NULL, offsetof( RadiusDecalTemplate, m_opacityThrobTime ) },
{ "Color", INI::parseColorInt, NULL, offsetof( RadiusDecalTemplate, m_color ) },
{ "OnlyVisibleToOwningPlayer", INI::parseBool, NULL, offsetof( RadiusDecalTemplate, m_onlyVisibleToOwningPlayer ) },
- // the aura rings' fields; a mod written for them may name them, and an unknown field throws
+ // the retired aura rings' fields; data written for them may still name them, and an unknown field throws
{ "SpinTime", parseRetiredField, NULL, 0 },
{ "LightReference", parseRetiredField, NULL, 0 },
{ "LightScaleMin", parseRetiredField, NULL, 0 },
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp
index 9aa28c0bc..a9e6ae583 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/CampaignManager.cpp
@@ -466,7 +466,7 @@ void CampaignManager::xfer( Xfer *xfer )
if( xfer->getXferMode() == XFER_LOAD )
{
setCampaignAndMission( currentCampaign, currentMission );
- // a save from other data (a mod's, or one since changed) names a campaign or a mission this
+ // a save from other data (one since changed) names a campaign or a mission this
// Campaign.ini lacks; the load fails with the error box instead of a mission that is not there
if( currentCampaign.isNotEmpty() && ( m_currentCampaign == NULL || ( currentMission.isNotEmpty() && m_currentMission == NULL ) ) )
{
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp
index 7e755363a..2db65314d 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/Image.cpp
@@ -37,7 +37,6 @@
#define DEFINE_IMAGE_STATUS_NAMES
#include "Lib/BaseType.h"
-#include "Common/ArchiveFileSystem.h"
#include "Common/LocalFileSystem.h"
#include "Common/Debug.h"
#include "Common/INI.h"
@@ -233,8 +232,7 @@ const Image *ImageCollection::findImageByName( const AsciiString& name )
std::map<unsigned,Image *>::iterator i=m_imageMap.find(TheNameKeyGenerator->nameToLowercaseKey(name));
if (i!=m_imageMap.end())
return i->second;
- AsciiString retailName;
- return TheModNamespace.findRetailName(name, MODNAME_MAPPEDIMAGE, &retailName) ? findImageByName(retailName) : NULL;
+ return NULL;
} // end findImageByName
//-------------------------------------------------------------------------------------------------
@@ -263,23 +261,11 @@ void ImageCollection::load( Int textureSize )
// construct path to the mapped images folder of the correct texture size
sprintf( buffer, "Data\\INI\\MappedImages\\TextureSize_%d", textureSize );
- // a merged mod's own copies of our interface sheets first: the images only it has (its cameos) are
- // read from them, and ours, loaded after, take back every name both define (FileSystem::isForkUIPath)
- std::vector<AsciiString> modCopies;
- TheArchiveFileSystem->getModUICopies( AsciiString( buffer ), modCopies );
- TheArchiveFileSystem->getModUICopies( AsciiString( "Data\\INI\\MappedImages\\HandCreated" ), modCopies );
- for (size_t i = 0; i < modCopies.size(); ++i)
- ini.load( modCopies[ i ], INI_LOAD_OVERWRITE, NULL );
-
// load all the ine files in that directory
ini.loadDirectory( AsciiString( buffer ), TRUE, INI_LOAD_OVERWRITE, NULL );
ini.loadDirectory("Data\\INI\\MappedImages\\HandCreated", TRUE, INI_LOAD_OVERWRITE, NULL );
- // -modfactions: each mod's cameos and HUD art under its own "M<n>~" names
- INI::loadModPasses( buffer, NULL, TRUE );
- INI::loadModPasses( "Data\\INI\\MappedImages\\HandCreated", NULL, TRUE );
-
} // end load
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp
index d77f84369..34d4a043d 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp
@@ -3902,8 +3902,6 @@ void ParticleSystemManager::init( void )
/// Read INI data and build templates
INI ini;
ini.load( AsciiString( "Data\\INI\\ParticleSystem.ini" ), INI_LOAD_OVERWRITE, NULL );
- // -modfactions: each mod's systems after retail's, under its names
- INI::loadModPasses( "Data\\INI\\ParticleSystem.ini", NULL );
// The fork's own systems, beside EA's 1088 rather than in a loose copy of all of them
m_classicReadingForkSystems = TheGlobalData && TheGlobalData->m_classicGraphics;
ini.load( AsciiString( "Data\\INI\\ParticleSystemReforged.ini" ), INI_LOAD_OVERWRITE, NULL );
@@ -4237,11 +4235,6 @@ ParticleSystemTemplate *ParticleSystemManager::findTemplate( const AsciiString &
if (find != m_templateMap.end()) {
sysTemplate = (*find).second;
}
- else {
- AsciiString retailName;
- if (TheModNamespace.findRetailName(name, MODNAME_PARTICLESYSTEM, &retailName))
- sysTemplate = findTemplate(retailName);
- }
return sysTemplate;
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp
index 00bdf7c5f..cfc012d5e 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AI.cpp
@@ -35,7 +35,6 @@
#include "Common/PerfTimer.h"
#include "Common/Player.h"
#include "Common/PlayerList.h"
-#include "Common/PlayerTemplate.h"
#include "Common/ThingFactory.h"
#include "Common/ThingTemplate.h"
#include "Common/Xfer.h"
@@ -93,33 +92,29 @@ void TAiData::addFactionBuildList(AISideBuildList *buildList)
m_sideBuildLists = buildList;
}
-const AISideInfo *TAiData::findSideInfo( const AsciiString &side, Int modIndex ) const
+const AISideInfo *TAiData::findSideInfo( const AsciiString &side ) const
{
- const AsciiString own = AI::modSideKey( side, modIndex );
for (const AISideInfo *info = m_sideInfo; info != NULL; info = info->m_next)
{
- if (info->m_side == own)
+ if (info->m_side == side)
return info;
}
- return modIndex >= 0 ? findSideInfo( side, -1 ) : NULL;
+ return NULL;
}
-const AISideBuildList *TAiData::findBuildList( const AsciiString &side, Int modIndex ) const
+const AISideBuildList *TAiData::findBuildList( const AsciiString &side ) const
{
- const AsciiString own = AI::modSideKey( side, modIndex );
for (const AISideBuildList *build = m_sideBuildLists; build != NULL; build = build->m_next)
{
- if (build->m_side == own)
+ if (build->m_side == side)
return build;
}
- return modIndex >= 0 ? findBuildList( side, -1 ) : NULL;
+ return NULL;
}
const AISideInfo *TAiData::findSideInfo( const Player *player ) const
{
- // a map player whose faction is gone (an obsolete map) has no template, and plays retail's side
- const PlayerTemplate *pt = player->getPlayerTemplate();
- return findSideInfo( player->getSide(), pt != NULL ? pt->getModIndex() : -1 );
+ return findSideInfo( player->getSide() );
}
TAiData::~TAiData()
@@ -552,67 +547,11 @@ void AI::parseAiDataDefinition( INI* ini )
} // end if
- /* -modfactions: a mod's pass (INI::loadModPasses) takes only its sides' entries, filed under
- "M<n>~<side>" with its names already prefixed, so its factions build and train its own things.
- The tuning in the rest of the block stays the fork's, mods fit the fork. */
- const Int mod = TheModNamespace.getActive();
- if (mod >= 0)
- {
- TAiData *modData = NEW TAiData;
- // the mod's AIData.ini goes over its Default\AIData.ini: what the first filed seeds this parse, so a
- // SideInfo field the second leaves out keeps the first's value, as retail's two files merge
- const AsciiString prefix = modSideKey( AsciiString::TheEmptyString, mod );
- for (AISideInfo **link = &TheAI->m_aiData->m_sideInfo; *link != NULL; )
- {
- AISideInfo *info = *link;
- if (!info->m_side.startsWith( prefix ))
- {
- link = &info->m_next;
- continue;
- }
- *link = info->m_next;
- const AsciiString side( info->m_side.str() + prefix.getLength() );
- info->m_side = side;
- modData->addSideInfo( info );
- }
- ini->initFromINI( modData, TheAIFieldParseTable );
- Int sides = 0;
- while (modData->m_sideInfo != NULL)
- {
- AISideInfo *info = modData->m_sideInfo;
- modData->m_sideInfo = info->m_next;
- info->m_side = modSideKey( info->m_side, mod );
- TheAI->m_aiData->addSideInfo( info );
- ++sides;
- }
- Int buildLists = 0;
- while (modData->m_sideBuildLists != NULL)
- {
- AISideBuildList *build = modData->m_sideBuildLists;
- modData->m_sideBuildLists = build->m_next;
- build->m_side = modSideKey( build->m_side, mod );
- TheAI->m_aiData->addFactionBuildList( build );
- ++buildLists;
- }
- delete modData;
- DEBUG_LOG(( "MODNS M%d~ AIData from %s: %d sides, %d skirmish build lists\n", mod + 1, ini->getFilename().str(), sides, buildLists ));
- return;
- }
-
// parse the ini weapon definition
ini->initFromINI( TheAI->m_aiData, TheAIFieldParseTable );
}
-AsciiString AI::modSideKey( const AsciiString &side, Int modIndex )
-{
- if (modIndex < 0)
- return side;
- AsciiString key;
- key.format( "M%d~%s", modIndex + 1, side.str() );
- return key;
-}
-
@@ -823,7 +762,7 @@ static void priorityFunc(Object *obj, void *userData)
* (aiFramesToKill, the AI's matchup arithmetic), plus the frames to drive into reach. So a
* wounded enemy goes before a fresh one of its kind.
*
- * Worth is 'ThreatValue' where a mod sets it and build cost where it does not; the shipped INI
+ * Worth is 'ThreatValue' where the data sets it and build cost where it does not; the shipped INI
* sets it nowhere.
*
* The tiers keep two old rules above the armour. Anything that can shoot back outranks anything
@@ -883,7 +822,7 @@ extern Bool AIAttackMove_shouldRetaliate( UnsignedInt lastDamageFrame, UnsignedI
Bool alreadyFightingTheAttacker, Bool canAttackTheAttacker );
static const Int AI_SHOT_ME_FRAMES = LOGICFRAMES_PER_SECOND;
-/** What a target is worth: ThreatValue where a mod sets it, else what its player pays for it. */
+/** What a target is worth: ThreatValue where the data sets it, else what its player pays for it. */
static Int AI_targetValue( const Object *victim )
{
const ThingTemplate *tmpl = victim->getTemplate();
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp
index ea516d194..228384f5b 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp
@@ -3288,19 +3288,6 @@ static Real templateFramesToKill( const ThingTemplate *attacker, const ThingTemp
return frames;
}
-static Int playerArmyMod( const Player *player )
-{
- const PlayerTemplate *faction = player->getPlayerTemplate();
- return faction != NULL ? faction->getModIndex() : -1;
-}
-
-/** A mod's America carries retail's side name, so a scan of every template by side or by kind walks
- * into the other army: a retail Ranger's job went to a mod's cheaper rifleman nobody can train here. */
-static Bool isOwnArmy( const Player *player, const ThingTemplate *tmpl )
-{
- return tmpl->getModIndex() == playerArmyMod( player );
-}
-
/*static*/ void AIPlayer::prepareMatchupTables( void )
{
theFramesToKillCache.clear();
@@ -3308,14 +3295,13 @@ static Bool isOwnArmy( const Player *player, const ThingTemplate *tmpl )
theDetectsStealthCache.clear();
Bool skirmishAI = FALSE;
- typedef std::pair<AsciiString, Int> SideInMod;
- std::vector<SideInMod> sides;
+ std::vector<AsciiString> sides;
for( Int i = 0; i < ThePlayerList->getPlayerCount(); ++i )
{
Player *player = ThePlayerList->getNthPlayer( i );
if( player->isSkirmishAIPlayer() )
skirmishAI = TRUE;
- const SideInMod side( player->getSide(), playerArmyMod( player ) );
+ const AsciiString side = player->getSide();
if( std::find( sides.begin(), sides.end(), side ) == sides.end() )
sides.push_back( side );
}
@@ -3332,7 +3318,7 @@ static Bool isOwnArmy( const Player *player, const ThingTemplate *tmpl )
{
if( tmpl->friend_getBuildCost() <= 0 || tmpl->isKindOf( KINDOF_STRUCTURE ) || tmpl->getBuildable() == BSTATUS_NO )
continue;
- if( std::find( sides.begin(), sides.end(), SideInMod( tmpl->getDefaultOwningSide(), tmpl->getModIndex() ) ) != sides.end() )
+ if( std::find( sides.begin(), sides.end(), tmpl->getDefaultOwningSide() ) != sides.end() )
units.push_back( tmpl );
}
for( size_t a = 0; a < units.size(); ++a )
@@ -3593,8 +3579,8 @@ static AITeamCapability teamCapability( const TeamPrototype *proto, const Player
if( tmpl == NULL )
continue; // a map's team naming a unit this game does not have
- // the same question the game itself answers when it builds the object, one INI edit away from
- // being right for a mod's own detector
+ // the same question the game itself answers when it builds the object, so a new detector in
+ // the data counts without a table here
if( templateDetectsStealth( tmpl ) )
cap.m_detectsStealth = TRUE;
@@ -3631,7 +3617,7 @@ static Bool unlocksStealthUnit( const Player *player, ScienceType science )
{
for( const ThingTemplate *tmpl = TheThingFactory->firstTemplate(); tmpl; tmpl = tmpl->friend_getNextTemplate() )
{
- if( !templateCanStealth( tmpl ) || !isOwnArmy( player, tmpl ) )
+ if( !templateCanStealth( tmpl ) )
continue;
for( Int p = 0; p < tmpl->getPrereqCount(); ++p )
{
@@ -6068,7 +6054,7 @@ void AIPlayer::doExpansion( void )
//
// What this faction calls a supply centre: whatever is already flagged as one on the build
- // list. Faction-correct and mod-correct without a table, and if the AI has never had one it
+ // list. Faction-correct without a table, and if the AI has never had one it
// has nothing to expand with anyway.
//
AsciiString supplyCenterName;
@@ -10570,7 +10556,7 @@ void AIPlayer::trainFavoured( void )
/** The doctrine: what a side fields that the other generals of its side do not. The skirmish scripts'
* teams are written per side, and an Air Force General built 2 jets' worth of aircraft in 983 units
* off them, a Tank General as many soldiers as tanks. So each side's signature units are worked out
- * from the data, which gives a mod's new side one as well:
+ * from the data, which gives a new side one as well:
*
* - the roster: every fighting unit a building of the side offers on its buttons;
* - each unit against the same unit at every other general of the same BaseSide, the name behind a
@@ -10617,11 +10603,11 @@ static AsciiString doctrineKey( const ThingTemplate *tmpl )
}
/** Every fighting unit a side's buildings offer, in template order. */
-static void doctrineRoster( const AsciiString &side, Int mod, std::vector<const ThingTemplate *> *out )
+static void doctrineRoster( const AsciiString &side, std::vector<const ThingTemplate *> *out )
{
for( const ThingTemplate *building = TheThingFactory->firstTemplate(); building; building = building->friend_getNextTemplate() )
{
- if( !building->isKindOf( KINDOF_STRUCTURE ) || building->getModIndex() != mod || building->getDefaultOwningSide() != side )
+ if( !building->isKindOf( KINDOF_STRUCTURE ) || building->getDefaultOwningSide() != side )
continue;
const CommandSet *commandSet = TheCommandStore->findCommandSet( building->friend_getCommandSetString() );
for( Int i = 0; commandSet && i < MAX_COMMANDS_PER_SET; ++i )
@@ -10698,7 +10684,6 @@ void AIPlayer::ensureDoctrine( void )
if( faction == NULL || !runsOwnAI() )
return;
- const Int mod = faction->getModIndex();
const std::vector<AsciiString> &named = faction->getAIDoctrine();
for( size_t n = 0; n < named.size(); ++n )
{
@@ -10712,16 +10697,16 @@ void AIPlayer::ensureDoctrine( void )
if( named.empty() )
{
std::vector<const ThingTemplate *> mine;
- doctrineRoster( faction->getSide(), mod, &mine );
+ doctrineRoster( faction->getSide(), &mine );
std::vector< std::vector<const ThingTemplate *> > siblings;
for( Int i = 0; i < ThePlayerTemplateStore->getPlayerTemplateCount(); ++i )
{
const PlayerTemplate *other = ThePlayerTemplateStore->getNthPlayerTemplate( i );
- if( other == faction || !other->isPlayableSide() || other->isObserver() || other->getModIndex() != mod ||
+ if( other == faction || !other->isPlayableSide() || other->isObserver() ||
other->getBaseSide() != faction->getBaseSide() || other->getSide() == faction->getSide() )
continue;
std::vector<const ThingTemplate *> roster;
- doctrineRoster( other->getSide(), mod, &roster );
+ doctrineRoster( other->getSide(), &roster );
if( !roster.empty() )
siblings.push_back( roster );
}
@@ -13730,9 +13715,9 @@ static const UpgradeTemplate *helixUpgradeOn( const ThingTemplate *tmpl, Int kin
return NULL;
}
-/** A Helix of this kind flies the napalm bomb flyRaid drops. A mod's Helix can carry a "Bomb" upgrade
- * on its buttons and drop something else, or nothing the AI knows: ShockWave's under -modfactions
- * came out as a raider with no such power and the raid read a null one. */
+/** A Helix of this kind flies the napalm bomb flyRaid drops. A Helix can carry a "Bomb" upgrade on
+ * its buttons and drop something else, or nothing the AI knows, and the raid then read a null
+ * power. */
static Bool helixCarriesNapalmBomb( const ThingTemplate *tmpl )
{
const ModuleInfo &modules = tmpl->getBehaviorModuleInfo();
@@ -17627,7 +17612,7 @@ void AIPlayer::answerFire( void )
//----------------------------------------------------------------------------------------------------------
/** The cheapest thing this player could build that can walk somewhere and is not needed elsewhere.
* Faction-agnostic on purpose - it lands on the Ranger, the Red Guard, the Rebel and the
- * Technical without a per-side table to keep, and on whatever a mod's cheapest unit is. */
+ * Technical without a per-side table to keep. */
static const ThingTemplate *cheapestScoutTemplate( Player *player )
{
const ThingTemplate *best = NULL;
@@ -17641,7 +17626,7 @@ static const ThingTemplate *cheapestScoutTemplate( Player *player )
continue; // those have a job
if( t->isKindOf( KINDOF_AIRCRAFT ) || t->isKindOf( KINDOF_IMMOBILE ) )
continue;
- if( !isOwnArmy( player, t ) || !player->canBuild( t ) )
+ if( !player->canBuild( t ) )
continue;
Int cost = t->calcCostToBuild( player );
@@ -18102,7 +18087,7 @@ Bool AIPlayer::nextScoutTarget( Int slot, const Coord3D *from, Coord3D *pos )
//----------------------------------------------------------------------------------------------------------
/** The cheapest infantry this player can build that can walk into a building and own it. Read off
* the command set rather than a per-faction table, so it lands on the Ranger, the Rebel and the
- * Red Guard - and on whatever a mod gave the ability to. */
+ * Red Guard - and on whatever else the data gives the ability to. */
static const ThingTemplate *cheapestCapturerTemplate( Player *player )
{
const ThingTemplate *best = NULL;
@@ -18112,7 +18097,7 @@ static const ThingTemplate *cheapestCapturerTemplate( Player *player )
{
if( !t->isKindOf( KINDOF_INFANTRY ) || t->isKindOf( KINDOF_DOZER ) )
continue;
- if( !isOwnArmy( player, t ) || !player->canBuild( t ) )
+ if( !player->canBuild( t ) )
continue;
const Int cost = t->calcCostToBuild( player );
@@ -18522,7 +18507,7 @@ static Bool couldBuildUnit( Player *player, const ThingTemplate *tmpl )
//----------------------------------------------------------------------------------------------------------
/** This one takes a vehicle by walking into it. Asked of the object rather than of a faction table,
- * so it lands on the GLA Hijacker and on anything a mod gave the same collide to. */
+ * so it lands on the GLA Hijacker and on anything else the data gives the same collide to. */
static Bool carriesHijackModule( const Object *obj )
{
for( BehaviorModule **m = obj->getBehaviorModules(); *m; ++m )
@@ -18544,7 +18529,7 @@ static const ThingTemplate *cheapestHijackerTemplate( Player *player )
for( const ThingTemplate *t = TheThingFactory->firstTemplate(); t; t = t->friend_getNextTemplate() )
{
- if( !t->isKindOf( KINDOF_INFANTRY ) || !isOwnArmy( player, t ) || !couldBuildUnit( player, t ) )
+ if( !t->isKindOf( KINDOF_INFANTRY ) || !couldBuildUnit( player, t ) )
continue;
const Int cost = t->calcCostToBuild( player );
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp
index 3737ce90a..25e197bef 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AISkirmishPlayer.cpp
@@ -1518,24 +1518,9 @@ void AISkirmishPlayer::newMap( void )
/* Get our proper build list. */
AsciiString mySide = m_player->getSide();
DEBUG_LOG(("AI Player side is %s\n", mySide.str()));
- // -modfactions: a mod faction's own mod's list ("M<n>~America", its AIData.ini), retail's of the side without one
- const PlayerTemplate *pt = m_player->getPlayerTemplate();
- const Int mod = pt != NULL ? pt->getModIndex() : -1; // no template: a map whose faction is gone
- const AISideBuildList *build = TheAI->getAiData()->findBuildList( mySide, mod );
+ const AISideBuildList *build = TheAI->getAiData()->findBuildList( mySide );
if (build) {
BuildListInfo *buildList = build->m_buildList->duplicate();
- // a mod without a list of its own gets retail's, read as the mod's own building of each name
- // where the mod has one. Before this its command center was torn down below and put back as
- // retail's.
- const Bool retailList = mod >= 0 && build->m_side == mySide;
- for (BuildListInfo *info = buildList; retailList && info != NULL; info = info->getNext())
- {
- AsciiString modName;
- modName.format("M%d~%s", mod + 1, info->getTemplateName().str());
- const ThingTemplate *modPlan = TheThingFactory->findTemplate( modName );
- if (modPlan != NULL)
- info->setTemplateName( modPlan->getName() );
- }
adjustBuildList(buildList); // adjust to our start position.
m_player->setBuildList(buildList);
computeCenterAndRadiusOfBase(&m_baseCenter, &m_baseRadius);
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp
index 1c13b442a..f79db76d9 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Map/SidesList.cpp
@@ -46,16 +46,12 @@
#include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
-#include <algorithm>
-
#include "Common/DataChunk.h"
#include "Common/FileSystem.h"
#include "Common/GameState.h"
#include "Common/GlobalData.h"
#include "Common/PlayerTemplate.h"
#include "Common/RandomMapGenerator.h"
-#include "Common/ThingFactory.h"
-#include "Common/ThingTemplate.h"
#include "Common/WellKnownKeys.h"
#include "Common/Xfer.h"
#include "GameLogic/AI.h"
@@ -431,8 +427,8 @@ SidesInfo *SidesList::findSkirmishSideInfo(AsciiString name, Int* index /*= NULL
}
static AsciiString static_readPlayerNames[MAX_PLAYER_COUNT];
-static Dict static_readPlayerDicts[MAX_PLAYER_COUNT]; ///< beside the names, for a mod's scripts (loadModSkirmishScripts)
-static TeamsInfoRec static_readModTeams; ///< a mod's ScriptTeams, before its players are renamed
+static Dict static_readPlayerDicts[MAX_PLAYER_COUNT]; ///< beside the names, for the factions of the file's players
+static TeamsInfoRec static_readTeams; ///< the file's ScriptTeams, before its players are matched
/**
* ParsePlayersDataChunk - read players names data chunk.
@@ -464,257 +460,53 @@ static Bool ParsePlayersDataChunk(DataChunkInput &file, DataChunkInfo *info, voi
}
/// a SkirmishScripts.scb's ScriptTeams, kept whole until its players are known
-/// (loadModSkirmishScripts, prepareForMP_or_Skirmish)
-static Bool ParseModTeamsDataChunk(DataChunkInput &file, DataChunkInfo *info, void *userData)
+/// (prepareForMP_or_Skirmish)
+static Bool ParseTeamsDataChunk(DataChunkInput &file, DataChunkInfo *info, void *userData)
{
while (!file.atEndOfChunk()) {
Dict teamDict = file.readDict();
- static_readModTeams.addTeam(&teamDict);
+ static_readTeams.addTeam(&teamDict);
}
return true;
}
-/** What a mod's skirmish scripts call its own: its kept players and their default teams under
- * "M<n>~", and what they build, upgrade, research, fire or press read as the mod's where it defines
- * one. Script, flag and counter names stay, Player::initFromDict qualifies those per player. */
-struct ModScriptNames
-{
- Int mod;
- AsciiString prefix;
- std::vector<AsciiString> players;
-
- Bool isPlayer(const AsciiString& name) const
- {
- return std::find(players.begin(), players.end(), name) != players.end();
- }
- AsciiString player(const AsciiString& name) const
- {
- if (!isPlayer(name))
- return name;
- AsciiString renamed = prefix;
- renamed.concat(name);
- return renamed;
- }
- /// a player's default team is "team<player>" (Player::setDefaultTeam), so it follows the player
- AsciiString team(const AsciiString& name) const
- {
- if (!name.startsWith("team") || !isPlayer(AsciiString(name.str() + 4)))
- return name;
- AsciiString renamed = "team";
- renamed.concat(player(AsciiString(name.str() + 4)));
- return renamed;
- }
- void parameter(Parameter *parm) const
- {
- ModNameType type;
- switch (parm->getParameterType())
- {
- case Parameter::SIDE: parm->friend_setString(player(parm->getString())); return;
- case Parameter::TEAM: parm->friend_setString(team(parm->getString())); return;
- case Parameter::OBJECT_TYPE: type = MODNAME_OBJECT; break;
- case Parameter::UPGRADE: type = MODNAME_UPGRADE; break;
- case Parameter::SCIENCE: type = MODNAME_SCIENCE; break;
- case Parameter::SPECIAL_POWER: type = MODNAME_SPECIALPOWER; break;
- case Parameter::COMMAND_BUTTON:
- case Parameter::COMMANDBUTTON_ABILITY:
- case Parameter::COMMANDBUTTON_ALL_ABILITIES: type = MODNAME_COMMANDBUTTON; break;
- default: return;
- }
- const AsciiString modded = TheModNamespace.modName(mod, type, parm->getString());
- if (type != MODNAME_OBJECT || !namesMapObject(parm->getString(), modded))
- parm->friend_setString(modded);
- }
- /** Maps stay retail's under every mod, so what stands on them is retail's: a mod's script asking
- * after a SupplyDock means the map's, and M<n>~SupplyDock stands nowhere. Contra's stash trucks
- * never left home for a pile. */
- Bool namesMapObject(const AsciiString& name, const AsciiString& modded) const
- {
- const ThingTemplate *modTemplate = TheThingFactory->findTemplate(modded, FALSE);
- if (modTemplate == NULL || modded == name || TheThingFactory->findTemplate(name, FALSE) == NULL)
- return FALSE;
- for (Int i = 0; i < ThePlayerTemplateStore->getPlayerTemplateCount(); ++i)
- {
- const PlayerTemplate *faction = ThePlayerTemplateStore->getNthPlayerTemplate(i);
- if (faction->getModIndex() == mod && faction->getSide() == modTemplate->getDefaultOwningSide())
- return FALSE;
- }
- return TRUE;
- }
- void script(Script *s) const
- {
- for (OrCondition *orCondition = s->getOrCondition(); orCondition; orCondition = orCondition->getNextOrCondition())
- {
- for (Condition *condition = orCondition->getFirstAndCondition(); condition; condition = condition->getNext())
- {
- for (Int i = 0; i < condition->getNumParameters(); ++i)
- parameter(condition->getParameter(i));
- }
- }
- ScriptAction *const actions[] = { s->getAction(), s->getFalseAction() };
- for (Int list = 0; list < 2; ++list)
- {
- for (ScriptAction *action = actions[list]; action; action = action->getNext())
- {
- for (Int i = 0; i < action->getNumParameters(); ++i)
- parameter(action->getParameter(i));
- }
- }
- }
- void scripts(ScriptList *list) const
- {
- for (Script *s = list->getScript(); s; s = s->getNext())
- script(s);
- for (ScriptGroup *group = list->getScriptGroup(); group; group = group->getNext())
- {
- for (Script *s = group->getScript(); s; s = s->getNext())
- script(s);
- }
- }
-};
-
-/** -modfactions: each mod's own SkirmishScripts.scb, for its factions' computer players. A player of
- * the file whose faction the mod defines (FactionAmerica read as M<n>~FactionAmerica) is kept with
- * its scripts and teams, renamed so it never meets retail's player of the same name. */
-void SidesList::loadModSkirmishScripts(void)
-{
- m_modSkirmishSides.clear();
- m_modSkirmishTeamrec.clear();
- if (TheGlobalData == NULL || !TheGlobalData->m_modFactions)
- return;
-
- const AsciiString path = "data\\Scripts\\SkirmishScripts.scb";
- for (Int mod = 0; mod < (Int)TheGlobalData->m_mods.size(); ++mod)
- {
- // the stream reads the whole file as it opens, so the focus is back before the parse
- TheFileSystem->setFocus(mod);
- CachedFileInputStream theInputStream;
- const Bool opened = TheFileSystem->doesFileExist(path.str()) && theInputStream.open(path);
- TheFileSystem->setFocus(FILE_FOCUS_ALL);
- if (!opened)
- continue;
-
- DataChunkInput file(&theInputStream);
- file.registerParser( AsciiString("PlayerScriptsList"), AsciiString::TheEmptyString, ScriptList::ParseScriptsDataChunk );
- file.registerParser( AsciiString("ScriptsPlayers"), AsciiString::TheEmptyString, ParsePlayersDataChunk );
- file.registerParser( AsciiString("ScriptTeams"), AsciiString::TheEmptyString, ParseModTeamsDataChunk );
- const Bool parsed = file.parse(this);
- ScriptList *scripts[MAX_PLAYER_COUNT];
- const Int count = ScriptList::getReadScripts(scripts);
-
- ModScriptNames names;
- names.mod = mod;
- names.prefix.format("M%d~", mod + 1);
- const size_t firstSide = m_modSkirmishSides.size();
- for (Int i = 0; i < count; ++i)
- {
- // a file written without the players' dicts names its factions only through the map's player of that name
- AsciiString fileFaction = static_readPlayerDicts[i].getAsciiString(TheKey_playerFaction);
- SidesInfo *mapSide = findSkirmishSideInfo(static_readPlayerNames[i]);
- if (fileFaction.isEmpty() && mapSide != NULL)
- fileFaction = mapSide->getDict()->getAsciiString(TheKey_playerFaction);
- const AsciiString faction = TheModNamespace.modName(mod, MODNAME_PLAYERTEMPLATE, fileFaction);
- const PlayerTemplate *pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(faction));
- if (!parsed || scripts[i] == NULL || pt == NULL || pt->getModIndex() != mod || !pt->isPlayableSide())
- {
- if (scripts[i])
- scripts[i]->deleteInstance();
- continue;
- }
- names.players.push_back(static_readPlayerNames[i]);
- Dict sideDict(static_readPlayerDicts[i]);
- sideDict.setAsciiString(TheKey_playerName, names.player(static_readPlayerNames[i]));
- sideDict.setAsciiString(TheKey_playerFaction, pt->getName());
- m_modSkirmishSides.push_back(SidesInfo());
- m_modSkirmishSides.back().init(&sideDict);
- m_modSkirmishSides.back().setScriptList(scripts[i]);
- }
- for (size_t s = firstSide; s < m_modSkirmishSides.size(); ++s)
- names.scripts(m_modSkirmishSides[s].getScriptList());
-
- const NameKeyType unitKeys[] = { TheKey_teamUnitType1, TheKey_teamUnitType2, TheKey_teamUnitType3,
- TheKey_teamUnitType4, TheKey_teamUnitType5, TheKey_teamUnitType6, TheKey_teamUnitType7, TheKey_teamTransport };
- Int teams = 0;
- for (Int t = 0; t < static_readModTeams.getNumTeams(); ++t)
- {
- Dict teamDict(*static_readModTeams.getTeamInfo(t)->getDict());
- const AsciiString owner = teamDict.getAsciiString(TheKey_teamOwner);
- if (!names.isPlayer(owner))
- continue;
- teamDict.setAsciiString(TheKey_teamOwner, names.player(owner));
- teamDict.setAsciiString(TheKey_teamName, names.team(teamDict.getAsciiString(TheKey_teamName)));
- for (size_t k = 0; k < ARRAY_SIZE(unitKeys); ++k)
- {
- Bool exists = FALSE;
- const AsciiString unit = teamDict.getAsciiString(unitKeys[k], &exists);
- if (exists)
- teamDict.setAsciiString(unitKeys[k], TheModNamespace.modName(mod, MODNAME_OBJECT, unit));
- }
- m_modSkirmishTeamrec.addTeam(&teamDict);
- ++teams;
- }
- DEBUG_LOG(("MODNS M%d~ SkirmishScripts.scb: %d of %d players kept, %d teams%s\n", mod + 1,
- (Int)(m_modSkirmishSides.size() - firstSide), count, teams, parsed ? "" : ", unreadable"));
-
- static_readModTeams.clear();
- for (Int i = 0; i < MAX_PLAYER_COUNT; ++i)
- {
- static_readPlayerNames[i].clear();
- static_readPlayerDicts[i].clear();
- }
- }
-}
-
-Int SidesList::skirmishSideFit(const AsciiString& candidateSide, Int candidateMod, const AsciiString& side, Int mod)
-{
- if (candidateSide != side)
- return 0;
- if (candidateMod == mod)
- return 2;
- return candidateMod < 0 ? 1 : 0;
-}
-
SidesInfo *SidesList::findSkirmishSideFor(const PlayerTemplate *pt, TeamsInfoRec **teams)
{
- SidesInfo *found = findSkirmishSideNamed(pt->getSide(), pt->getModIndex(), teams);
+ SidesInfo *found = findSkirmishSideNamed(pt->getSide(), teams);
/* A faction the map's skirmish scripts were never written for (the fork's own, Turkiye) takes the
scripts of the original faction it is built on. */
if (found == NULL)
{
const AsciiString oldSide = ThePlayerTemplateStore->getOldFactionSide(pt->getBaseSide());
if (!oldSide.isEmpty() && oldSide != pt->getSide())
- found = findSkirmishSideNamed(oldSide, pt->getModIndex(), teams);
+ found = findSkirmishSideNamed(oldSide, teams);
}
return found;
}
-SidesInfo *SidesList::findSkirmishSideNamed(const AsciiString& side, Int mod, TeamsInfoRec **teams)
+SidesInfo *SidesList::findSkirmishSideNamed(const AsciiString& side, TeamsInfoRec **teams)
{
- SidesInfo *best = NULL;
- Int bestFit = 0;
- for (size_t i = 0; i < m_modSkirmishSides.size() && bestFit < 2; ++i)
+ for (size_t i = 0; i < m_standInSkirmishSides.size(); ++i)
{
- const PlayerTemplate *spt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(m_modSkirmishSides[i].getDict()->getAsciiString(TheKey_playerFaction)));
- if (skirmishSideFit(spt->getSide(), spt->getModIndex(), side, mod) == 2)
+ const PlayerTemplate *spt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(m_standInSkirmishSides[i].getDict()->getAsciiString(TheKey_playerFaction)));
+ if (spt->getSide() == side)
{
- best = &m_modSkirmishSides[i];
- bestFit = 2;
if (teams)
- *teams = &m_modSkirmishTeamrec;
+ *teams = &m_standInSkirmishTeamrec;
+ return &m_standInSkirmishSides[i];
}
}
- for (Int i = 0; i < m_numSkirmishSides && bestFit < 2; ++i)
+ for (Int i = 0; i < m_numSkirmishSides; ++i)
{
const PlayerTemplate *spt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(m_skirmishSides[i].getDict()->getAsciiString(TheKey_playerFaction)));
- const Int fit = spt ? skirmishSideFit(spt->getSide(), spt->getModIndex(), side, mod) : 0;
- if (fit > bestFit)
+ if (spt && spt->getSide() == side)
{
- best = &m_skirmishSides[i];
- bestFit = fit;
if (teams)
*teams = &m_skirmishTeamrec;
+ return &m_skirmishSides[i];
}
}
- return best;
+ return NULL;
}
/*static*/ Bool SidesList::isForkAIMapPath(const AsciiString& mapPath)
@@ -797,18 +589,15 @@ void SidesList::prepareForMP_or_Skirmish(void)
m_skirmishScriptsFromMap = gotScripts;
if (gotScripts)
DEBUG_LOG(("Skirmish map brings its own scripts: fork AI off, map %s\n", TheGlobalData->m_mapName.str()));
- loadModSkirmishScripts();
+ m_standInSkirmishSides.clear();
+ m_standInSkirmishTeamrec.clear();
if (!gotScripts) {
AsciiString path = "data\\Scripts\\SkirmishScripts.scb";
// A player's own map gets EA's scripts as EA shipped them: the fork's file carries its own
- // openings and its Hard without the free cash. A -mod that ships its own SkirmishScripts.scb
- // keeps it, since that is the file that resolves; a mod with none (art only) changes nothing.
- // Either way the exe CRC hashes the resolved file and this one (GlobalData::computeExeCRC), so
- // two machines that disagree here never share a match.
+ // openings and its Hard without the free cash. The exe CRC hashes both files
+ // (GlobalData::computeExeCRC), so two machines that disagree here never share a match.
const char *retail = "data\\Scripts\\SkirmishScriptsRetail.scb";
- Bool inModArchive = FALSE;
- const Bool modScripts = TheFileSystem->modLooseFile(path, &inModArchive).isNotEmpty() || inModArchive;
- if (!m_forkAIMap && !modScripts && TheFileSystem->doesFileExist(retail))
+ if (!m_forkAIMap && TheFileSystem->doesFileExist(retail))
path = retail;
DEBUG_LOG(("Skirmish map using standard scripts %s: fork AI %s, map %s\n", path.str(),
m_forkAIMap ? "on" : "off", TheGlobalData->m_mapName.str()));
@@ -819,10 +608,10 @@ void SidesList::prepareForMP_or_Skirmish(void)
DataChunkInput file( pStrm );
file.registerParser( AsciiString("PlayerScriptsList"), AsciiString::TheEmptyString, ScriptList::ParseScriptsDataChunk );
file.registerParser( AsciiString("ScriptsPlayers"), AsciiString::TheEmptyString, ParsePlayersDataChunk );
- file.registerParser( AsciiString("ScriptTeams"), AsciiString::TheEmptyString, ParseModTeamsDataChunk );
+ file.registerParser( AsciiString("ScriptTeams"), AsciiString::TheEmptyString, ParseTeamsDataChunk );
if (!file.parse(this)) {
DEBUG_LOG(("ERROR - Unable to read in skirmish scripts.\n"));
- static_readModTeams.clear();
+ static_readTeams.clear();
return;
}
ScriptList *scripts[MAX_PLAYER_COUNT];
@@ -845,11 +634,11 @@ void SidesList::prepareForMP_or_Skirmish(void)
takeover click handed it to whoever clicked it. The file's own player for that side
stands in, kept beside the map's, which nearly fill m_skirmishSides. */
const PlayerTemplate *pt = ThePlayerTemplateStore->findPlayerTemplate(NAMEKEY(static_readPlayerDicts[i].getAsciiString(TheKey_playerFaction)));
- if (scripts[i] && pt && pt->isPlayableSide() && findSkirmishSideNamed(pt->getSide(), pt->getModIndex(), NULL) == NULL) {
+ if (scripts[i] && pt && pt->isPlayableSide() && findSkirmishSideNamed(pt->getSide(), NULL) == NULL) {
DEBUG_LOG(("Skirmish map has no player for %s, using %s from the standard scripts\n", pt->getSide().str(), static_readPlayerNames[i].str()));
- m_modSkirmishSides.push_back(SidesInfo());
- m_modSkirmishSides.back().init(&static_readPlayerDicts[i]);
- m_modSkirmishSides.back().setScriptList(scripts[i]);
+ m_standInSkirmishSides.push_back(SidesInfo());
+ m_standInSkirmishSides.back().init(&static_readPlayerDicts[i]);
+ m_standInSkirmishSides.back().setScriptList(scripts[i]);
scripts[i] = NULL;
}
if (scripts[i])
@@ -864,21 +653,21 @@ void SidesList::prepareForMP_or_Skirmish(void)
pSL->deleteInstance();
scripts[i] = NULL;
}
- for (Int t = 0; t < static_readModTeams.getNumTeams(); ++t) {
- const Dict *teamDict = static_readModTeams.getTeamInfo(t)->getDict();
+ for (Int t = 0; t < static_readTeams.getNumTeams(); ++t) {
+ const Dict *teamDict = static_readTeams.getTeamInfo(t)->getDict();
const AsciiString owner = teamDict->getAsciiString(TheKey_teamOwner);
if (findSkirmishSideInfo(owner)) {
addSkirmishTeam(teamDict);
continue;
}
- for (size_t s = 0; s < m_modSkirmishSides.size(); ++s) {
- if (m_modSkirmishSides[s].getDict()->getAsciiString(TheKey_playerName) == owner) {
- m_modSkirmishTeamrec.addTeam(teamDict);
+ for (size_t s = 0; s < m_standInSkirmishSides.size(); ++s) {
+ if (m_standInSkirmishSides[s].getDict()->getAsciiString(TheKey_playerName) == owner) {
+ m_standInSkirmishTeamrec.addTeam(teamDict);
break;
}
}
}
- static_readModTeams.clear();
+ static_readTeams.clear();
for (i=0; i<MAX_PLAYER_COUNT; i++) {
static_readPlayerNames[i].clear();
static_readPlayerDicts[i].clear();
@@ -919,14 +708,14 @@ void SidesList::emptySides()
m_sides[i].clear();
m_skirmishSides[i].clear();
}
- m_modSkirmishSides.clear();
+ m_standInSkirmishSides.clear();
}
void SidesList::emptyTeams()
{
m_teamrec.clear();
m_skirmishTeamrec.clear();
- m_modSkirmishTeamrec.clear();
+ m_standInSkirmishTeamrec.clear();
}
void SidesList::addSide(const Dict* d)
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Armor.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Armor.cpp
index ed406f157..ae81e9387 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Armor.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Armor.cpp
@@ -86,7 +86,7 @@ Real ArmorTemplate::adjustDamage(DamageType t, Real damage) const
{
ArmorTemplate* self = (ArmorTemplate*) instance;
- const char* damageName = INI::withoutModPrefix(ini->getNextToken());
+ const char* damageName = ini->getNextToken();
Real pct = INI::scanPercentToReal(ini->getNextToken());
if (strcasecmp(damageName, "Default") == 0)
@@ -99,7 +99,7 @@ Real ArmorTemplate::adjustDamage(DamageType t, Real damage) const
}
// EA's parse let a misspelt type through (The Power of the West has INFANTRY_MISSIL) and wrote it at
- // index -1; the line is skipped instead, as a mod's data written against retail expects
+ // index -1; the line is skipped instead, as data written against retail expects
Int dt = DamageTypeFlags::getSingleBitFromName(damageName);
if (dt < 0)
{
@@ -131,8 +131,7 @@ const ArmorTemplate* ArmorStore::findArmorTemplate(AsciiString name) const
ArmorTemplateMap::const_iterator it = m_armorTemplates.find(namekey);
if (it == m_armorTemplates.end())
{
- AsciiString retailName;
- return TheModNamespace.findRetailName(name, MODNAME_ARMOR, &retailName) ? findArmorTemplate(retailName) : NULL;
+ return NULL;
}
else
{
@@ -170,7 +169,7 @@ void ArmorStore::reset()
if (ini->getLoadType() == INI_LOAD_MULTIFILE && existing == TheArmorStore->m_armorTemplates.end())
{
// BalanceReforged.ini rewrites armors objects already wear; a new name would reach nothing.
- // A mod's Armor.ini without it: the block is read and dropped, as for a missing object.
+ // An Armor.ini without it: the block is read and dropped, as for a missing object.
DEBUG_LOG(("[LINE: %d in '%s'] Armor '%s' is patched but was never defined; the block is skipped.\n", ini->getLineNum(), ini->getFilename().str(), c));
ArmorTemplate scratch;
ini->initFromINI(&scratch, myFieldParse);
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp
index 59b4fef16..09398863a 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp
@@ -544,7 +544,7 @@ Bool DumbProjectileBehavior::calcFlightPath(Bool recalcNumSegments)
//
// The curve is sampled where a retail (30 Hz) frame put the shell, and the frames in between fly the
// straight line to the next sample, so a path looks and lasts as it did. Sampled at every frame, a
- // fast shot met points of the curve retail never visited: mods give an instant tracer FirstHeight 300
+ // fast shot met points of the curve retail never visited: an instant tracer with FirstHeight 300
// and WeaponSpeed 9999, which retail sampled at its two ends only, and at 60 Hz the third of four
// samples flew it 200 into the air.
BezierSegment flightCurve( controlPoints );
@@ -562,7 +562,7 @@ Bool DumbProjectileBehavior::calcFlightPath(Bool recalcNumSegments)
{
retailSegments = m_flightPathSegments > 1 ? (m_flightPathSegments - 1) / LOGICFRAMES_PER_RETAIL_FRAME + 1 : m_flightPathSegments;
}
- // A speed of zero or next to it (every crash report of this ran End of Days) asks for a flight of hundreds of
+ // A speed of zero or next to it asks for a flight of hundreds of
// millions of frames, or an infinite one that comes back as INT_MIN. The path that size needs is
// gigabytes, and a request past 2 GB came back from the allocator short and was written past its
// end. Ten minutes of flight is more than any shell flies; past that the path is as wrong as one
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp
index 14f55cf26..377099633 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp
@@ -291,7 +291,7 @@ void OpenContain::addOrRemoveObjFromWorld(Object* obj, Bool add)
void OpenContain::addToContain( Object *rider )
{
//
- // Only the object's own contain module may hold riders. A mod that gives an object two contain
+ // Only the object's own contain module may hold riders. Data that gives an object two contain
// modules gets both onCollide calls, and the one Object::getContain() does not name took the
// rider into a list nothing else looks at: the rider's exit, death and destruction all go through
// getContain(), so it was deleted while still on that list, and the next redeployOccupants put a
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp
index 94f536929..6852ba9df 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Create/VeterancyGainCreate.cpp
@@ -59,7 +59,7 @@ void VeterancyGainCreateModuleData::buildFieldParse(MultiIniFieldParse& p)
{
{ "StartingLevel", INI::parseIndexList, TheVeterancyNames, offsetof( VeterancyGainCreateModuleData, m_startingLevel ) },
{ "ScienceRequired", INI::parseScience, NULL, offsetof( VeterancyGainCreateModuleData, m_scienceRequired ) },
- { "StartingGrades", parseRetiredField, NULL, 0 }, // a mod written for the rank ladder may name it; an unknown field throws
+ { "StartingGrades", parseRetiredField, NULL, 0 }, // data written for the rank ladder may name it; an unknown field throws
{ 0, 0, 0, 0 }
};
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp
index ab5b3c91a..bc5ce2933 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Locomotor.cpp
@@ -318,7 +318,7 @@ static Bool Locomotor_projectileChasesStraight(Object* obj, const Vector3& toGoa
//-------------------------------------------------------------------------------------------------
// A missile that holds its cruise height until it has locked keeps EA's whole flight: level at the
// preferred height, then the cheat straight down onto the goal. Its data can count on that.
-// ShockWave's cluster missile holds 500 until 0.01 from its goal and splits into warheads where it
+// A cluster missile that holds 500 until 0.01 from its goal and splits into warheads where it
// passes 420 over the ground coming down. The cruise curve split it 180 to 270 short of the aim;
// held level, the arc after the lock looped it 230 past, the goal lying almost straight under a
// level nose. A Scud or a Tomahawk dives before its lock and keeps the curve.
@@ -686,8 +686,7 @@ LocomotorTemplate* LocomotorStore::findLocomotorTemplate(NameKeyType namekey)
LocomotorTemplateMap::iterator it = m_locomotorTemplates.find(namekey);
if (it == m_locomotorTemplates.end())
{
- NameKeyType retailKey;
- return TheModNamespace.findRetailKey(namekey, MODNAME_LOCOMOTOR, &retailKey) ? findLocomotorTemplate(retailKey) : NULL;
+ return NULL;
}
else
return (*it).second;
@@ -702,8 +701,7 @@ const LocomotorTemplate* LocomotorStore::findLocomotorTemplate(NameKeyType namek
LocomotorTemplateMap::const_iterator it = m_locomotorTemplates.find(namekey);
if (it == m_locomotorTemplates.end())
{
- NameKeyType retailKey;
- return TheModNamespace.findRetailKey(namekey, MODNAME_LOCOMOTOR, &retailKey) ? findLocomotorTemplate(retailKey) : NULL;
+ return NULL;
}
else
{
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp
index 18eaab4b3..51041ce2c 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Object.cpp
@@ -4532,7 +4532,7 @@ void Object::crc( Xfer *xfer )
//-------------------------------------------------------------------------------------------------
/** One module's xfer, which names the module when it throws. A release build compiles the
* DEBUG_CRASH of GameState::xferSaveData out, so without this a save, a load or a replay
- * checkpoint that died in a mod's module said only the last "Xfer Object" line (report 1858). */
+ * checkpoint that died in a module said only the last "Xfer Object" line (report 1858). */
//-------------------------------------------------------------------------------------------------
static void xferModule( Xfer *xfer, BehaviorModule *module, const Object *obj )
{
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp
index 1b867ca3f..13dc0ddaf 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/ObjectCreationList.cpp
@@ -1623,8 +1623,7 @@ const ObjectCreationList *ObjectCreationListStore::findObjectCreationList(const
ObjectCreationListMap::const_iterator it = m_ocls.find(NAMEKEY(name));
if (it == m_ocls.end())
{
- AsciiString retailName;
- return TheModNamespace.findRetailName(AsciiString(name), MODNAME_OCL, &retailName) ? findObjectCreationList(retailName.str()) : NULL;
+ return NULL;
}
else
{
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp
index 478897e1d..fd16eb4ce 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate.cpp
@@ -268,7 +268,7 @@ static void AIUpdate_traceMove( const Object *obj, const Coord3D& framePos, Bool
const LocomotorTemplate* lt = TheLocomotorStore->findLocomotorTemplate(locoKey);
if (!lt && ini->getLoadType() == INI_LOAD_MULTIFILE)
{
- // a patch INI loaded over a mod can name a locomotor the mod renamed or removed
+ // a patch INI can name a locomotor the loaded data renamed or removed
DEBUG_LOG(("[LINE: %d in '%s'] locomotor '%s' does not exist; the reference is skipped.\n", ini->getLineNum(), ini->getFilename().str(), locoName));
continue;
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp
index 2f7493692..bb192f31f 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/MissileAIUpdate.cpp
@@ -688,7 +688,7 @@ void MissileAIUpdate::doKillState(void)
{
Coord3D aim;
Weapon::pointFromBodyOffset(getGoalObject(), m_aimOffset, aim);
- // a missile with no locomotor (an immobile hazard a mod fires as one) gets the 1.0 the idle check below uses
+ // a missile with no locomotor (an immobile hazard fired as one) gets the 1.0 the idle check below uses
Real closeEnough = curLoco ? curLoco->getMaxSpeedForCondition(BODY_PRISTINE) : 1.0f;
const Coord3D* pos = obj->getPosition();
// over the point and on the body: the height the locomotor holds over a goal is its own
@@ -757,7 +757,7 @@ void MissileAIUpdate::updateChaseOffset()
const Real SWAY_FADE_FAR = 150.0f;
const Real SWAY_FADE_NEAR = 60.0f;
- // a mod missile can come without a locomotor and fly on its launch force alone; nothing to steer
+ // a missile can come without a locomotor and fly on its launch force alone; nothing to steer
Locomotor* curLoco = getCurLocomotor();
if (curLoco == NULL)
return;
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DemoTrapUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DemoTrapUpdate.cpp
index 22c6f6424..23ff6d286 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DemoTrapUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DemoTrapUpdate.cpp
@@ -155,7 +155,7 @@ UpdateSleepTime DemoTrapUpdate::update()
return UPDATE_SLEEP_NONE;
}
- //Get the current weapon slot -- this determines what mode we're in. A mod's trap
+ //Get the current weapon slot -- this determines what mode we're in. A trap
//with no weapon in its current set has no mode, so it waits for one.
const Weapon *currentWeapon = getObject()->getCurrentWeapon();
if( !currentWeapon )
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyWarehouseDockUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyWarehouseDockUpdate.cpp
index df3b005e3..f3641df7c 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyWarehouseDockUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/DockUpdate/SupplyWarehouseDockUpdate.cpp
@@ -59,7 +59,7 @@ SupplyWarehouseDockUpdateModuleData::SupplyWarehouseDockUpdateModuleData( void )
//
// Forty seconds a box standing on its own, and every cash building inside 250 feet takes a
// share off that: one supply centre next to it halves the wait, two thirds it. The numbers are
- // module data rather than constants so a mod can turn the whole thing off with RegenDelay = 0,
+ // module data rather than constants so an INI can turn the whole thing off with RegenDelay = 0,
// and the defaults apply to every warehouse the game already ships without touching one INI
// file - which matters, because the INI files are in the multiplayer checksum.
//
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp
index 71c8c2263..6c34c3962 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/HelicopterSlowDeathUpdate.cpp
@@ -234,7 +234,7 @@ void HelicopterSlowDeathBehavior::beginSlowDeath( const DamageInfo *damageInfo )
{
return;
}
- // a mod helicopter can die with no locomotor chosen (its set names none for the current
+ // a helicopter can die with no locomotor chosen (its set names none for the current
// condition); nothing holds it up then, so it drops on plain gravity and the spiral still runs
Locomotor *locomotor = getObject()->getAIUpdateInterface()->getCurLocomotor();
if( locomotor )
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/IdleHackerUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/IdleHackerUpdate.cpp
index 95f6994e2..4c86a806c 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/IdleHackerUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/IdleHackerUpdate.cpp
@@ -85,7 +85,7 @@ Object *IdleHackerUpdate::findInternetCenter()
other->isEffectivelyDead() || other->testStatus( OBJECT_STATUS_UNDER_CONSTRUCTION ) || other->testStatus( OBJECT_STATUS_SOLD ) )
continue;
const ContainModuleInterface *contain = other->getContain();
- if( contain == NULL || !contain->isValidContainerFor( me, TRUE ) ) // a mod's center may carry no seats
+ if( contain == NULL || !contain->isValidContainerFor( me, TRUE ) ) // a center may carry no seats
continue;
const Real distSqr = ThePartitionManager->getDistanceSquared( me, other, FROM_CENTER_2D );
if( best == NULL || distSqr < bestDistSqr || ( distSqr == bestDistSqr && other->getID() < best->getID() ) )
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp
index 242dd28f9..b535586e2 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp
@@ -130,8 +130,8 @@ UpdateSleepTime OCLUpdate::update( void )
{
// push the timer back, but only once it is running: 0 means "start the first delay", and
// bumping it off 0 skipped that delay. Something carried from birth (a crate in a parachute)
- // keeps retail's bump and fires on its first free frame: ShockWave's supply crates are
- // deleted two frames after they land, and a first delay there lost every drop's money.
+ // keeps retail's bump and fires on its first free frame: a supply crate
+ // deleted two frames after it lands, and a first delay there lost every drop's money.
if( m_nextCreationFrame != 0 || getObject()->isDisabledByType( DISABLED_HELD ) )
m_nextCreationFrame++;
return UPDATE_SLEEP_NONE;
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp
index b5bd21b1a..1d6be4ade 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp
@@ -272,8 +272,8 @@ void ParticleUplinkCannonUpdate::onObjectCreated()
m_specialPowerModule = obj->getSpecialPowerModule( data->m_specialPowerTemplate );
if( !m_specialPowerModule )
{
- // FixesReforged.ini replaces the Superweapon General's cannon module naming EA's power, and a
- // mod that gives that cannon a power of its own name keeps it on the building's special power
+ // FixesReforged.ini replaces the Superweapon General's cannon module naming EA's power, and
+ // data that gives that cannon a power of its own name keeps it on the building's special power
// module. Drive the building's power of the same kind.
m_specialPowerModule = obj->findSpecialPowerModuleInterface( data->m_specialPowerTemplate->getSpecialPowerType() );
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp
index d3bb50785..093db9f4e 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp
@@ -160,7 +160,7 @@ static void parseAllVetLevelsAsciiString( INI* ini, void* /*instance*/, void * s
//-------------------------------------------------------------------------------------------------
/* The laser object is looked up when the weapon fires, so a name nothing defines draws no beam. A
patch file loads after every object: one naming a laser the loaded data lacks (FixesReforged.ini's
- Lazr_PatriotLaserBeam under Contra) leaves the weapon the beam it had. */
+ Lazr_PatriotLaserBeam on data without it) leaves the weapon the beam it had. */
static void parseLaserName( INI* ini, void* /*instance*/, void * store, const void* /*userData*/ )
{
AsciiString name = ini->getNextAsciiString();
@@ -1751,9 +1751,6 @@ WeaponTemplate *WeaponStore::findWeaponTemplatePrivate( NameKeyType key ) const
if( it != m_weaponTemplateHashMap.end() )
return it->second;
- NameKeyType retailKey;
- if( TheModNamespace.findRetailKey( key, MODNAME_WEAPON, &retailKey ) )
- return findWeaponTemplatePrivate( retailKey );
return NULL;
}
@@ -2012,8 +2009,8 @@ void WeaponStore::postProcessLoad()
else
{
/* The first definition stands and the block is read and dropped. WeaponReforged.ini keeps
- copies of EA weapons FixesReforged.ini hands out, for a mod whose Weapon.ini leaves them out
- (Contra has no Demo_DestroyedWeapon); where the loaded data has the weapon, its own wins.
+ copies of EA weapons FixesReforged.ini hands out; where the loaded data has the weapon, its
+ own wins.
This used to return mid-block, and the next field line stopped the load as an unknown block.
A map.ini block lands here too, as it did in retail: EA parsed it into a copy nothing pointed
at, and the campaign was tuned with those edits lost. Applying them gave Generals USA04's
@@ -2028,7 +2025,7 @@ void WeaponStore::postProcessLoad()
}
else if (ini->getLoadType() == INI_LOAD_MULTIFILE)
{
- // A mod's Weapon.ini without this weapon: the block is read into a scratch template and
+ // A Weapon.ini without this weapon: the block is read into a scratch template and
// dropped, as ThingFactory::parseObjectDefinition does for a missing object.
DEBUG_LOG(("[LINE: %d in '%s'] Weapon '%s' is patched but was never defined; the block is skipped.\n", ini->getLineNum(), ini->getFilename().str(), c));
WeaponTemplate *scratch = newInstance(WeaponTemplate);
@@ -3088,7 +3085,7 @@ Bool Weapon::privateFireWeapon(
// go through other weapons in weapon set
// set their m_whenWeCanFireAgain to this guy's delay
// set their m_status to this guy's status
- // Only a weapon of the set itself: a FireWeaponUpdate gun is not one, and ShockWave's EMP Patriot
+ // Only a weapon of the set itself: a FireWeaponUpdate gun is not one, and a Patriot's
// emitter firing every 750 ms held the battery's missiles in their wait for good.
if ( sourceObj->isReloadTimeShared() && sourceObj->getWeaponInWeaponSlot( m_wslot ) == this )
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp
index 1d6809b31..104f90803 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/WeaponSet.cpp
@@ -133,7 +133,7 @@ void WeaponTemplateSet::parseWeapon(INI* ini, void *instance, void * /*store*/,
WeaponSlotType wslot = (WeaponSlotType)INI::scanIndexList(ini->getNextToken(), TheWeaponSlotTypeNames);
const char *name = ini->getNextToken();
self->m_template[wslot] = TheWeaponStore->findWeaponTemplate(name);
- // ThingTemplate::parseWeaponTemplateSet passes over a patch file's set that names a weapon a mod dropped
+ // ThingTemplate::parseWeaponTemplateSet passes over a patch file's set that names a weapon the data lacks
if (self->m_template[wslot] == NULL && strcasecmp(name, "None") != 0)
self->m_namesMissingWeapon = TRUE;
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp
index 3ee028002..96127976c 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptActions.cpp
@@ -38,7 +38,6 @@
#include "Common/AudioHandleSpecialValues.h"
#include "Common/GameAudio.h"
#include "Common/GameEngine.h"
-#include "Common/INI.h"
#include "Common/LogicThread.h"
#include "Common/MapObject.h" // For MAP_XY_FACTOR
#include "Common/PartitionSolver.h"
@@ -3411,19 +3410,12 @@ void ScriptActions::doMusicTrackChange(const AsciiString& newTrackName, Bool fad
TheAudio->removeAudioEvent(AHSV_StopTheMusic);
}
- // The scripts a human runs are retail's and name retail's tracks; on a mod's faction he hears that
- // mod's track of the name. Only this machine's music player reads the answer.
- const PlayerTemplate *localFaction = ThePlayerList->getLocalPlayer()->getPlayerTemplate();
- const AsciiString track = localFaction != NULL && localFaction->getModIndex() >= 0
- ? TheModNamespace.modName(localFaction->getModIndex(), MODNAME_AUDIOEVENT, newTrackName) : newTrackName;
- DEBUG_LOG(("MUSIC track %s\n", track.str()));
-
- AudioEventRTS event(track);
+ AudioEventRTS event(newTrackName);
event.setShouldFade(fadein);
event.setPlayerIndex(ThePlayerList->getLocalPlayer()->getPlayerIndex());
TheAudio->addAudioEvent(&event);
- TheScriptEngine->setCurrentTrackName(track);
+ TheScriptEngine->setCurrentTrackName(newTrackName);
}
//-------------------------------------------------------------------------------------------------
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp
index df3114c16..c4fed588b 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp
@@ -158,8 +158,7 @@ const CrateTemplate *CrateSystem::findCrateTemplate(AsciiString name) const
return overridable;
}
- AsciiString retailName;
- return TheModNamespace.findRetailName(name, MODNAME_CRATE, &retailName) ? findCrateTemplate(retailName) : NULL;
+ return NULL;
}
CrateTemplate *CrateSystem::friend_findCrateTemplate(AsciiString name)
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
index ffebede8e..fe7b710e1 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
@@ -2651,7 +2651,7 @@ void GameLogic::loadMapINI( AsciiString mapName )
//
- // A map's rules file comes with the map, and a mod map with a block this game does not know
+ // A map's rules file comes with the map, and a map with a block this game does not know
// (a DeleteKey, say) threw out of here and took the whole game down at the loading screen.
// Keep what parsed up to the bad line and play on: every machine in a match has the same file,
// the map CRC sees to that, so each stops at the same line and the rules still agree.
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/RankInfo.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/RankInfo.cpp
index 5b3e21206..1697b098a 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/RankInfo.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/RankInfo.cpp
@@ -60,11 +60,6 @@ RankInfoStore::~RankInfoStore()
}
}
m_rankInfos.clear();
-
- for (size_t mod = 0; mod < m_modRankInfos.size(); ++mod)
- for (size_t i = 0; i < m_modRankInfos[mod].size(); ++i)
- m_modRankInfos[mod][i]->deleteInstance();
- m_modRankInfos.clear();
}
@@ -101,26 +96,18 @@ void RankInfoStore::reset()
}
//-----------------------------------------------------------------------------
-const RankInfoStore::RankInfoVec& RankInfoStore::ranksFor(Int mod) const
-{
- if (mod >= 0 && mod < (Int)m_modRankInfos.size() && !m_modRankInfos[mod].empty())
- return m_modRankInfos[mod];
- return m_rankInfos;
-}
-
-//-----------------------------------------------------------------------------
-Int RankInfoStore::getRankLevelCount(Int mod) const
+Int RankInfoStore::getRankLevelCount() const
{
- return ranksFor(mod).size();
+ return m_rankInfos.size();
}
//-----------------------------------------------------------------------------
// note that level is 1...n, NOT 0...n-1
-const RankInfo* RankInfoStore::getRankInfo(Int level, Int mod) const
+const RankInfo* RankInfoStore::getRankInfo(Int level) const
{
- if (level >= 1 && level <= getRankLevelCount(mod))
+ if (level >= 1 && level <= getRankLevelCount())
{
- const RankInfo* ri = ranksFor(mod)[level-1];
+ const RankInfo* ri = m_rankInfos[level-1];
if (ri)
{
return (const RankInfo*)ri->getFinalOverride();
@@ -176,19 +163,14 @@ void RankInfoStore::friend_parseRankDefinition( INI* ini )
}
else
{
- // a mod's pass fills that mod's own table, its sciences already under its names
- const Int mod = TheModNamespace.getActive();
- if (mod >= 0 && (Int)TheRankInfoStore->m_modRankInfos.size() <= mod)
- TheRankInfoStore->m_modRankInfos.resize(mod + 1);
- RankInfoVec& ranks = mod >= 0 ? TheRankInfoStore->m_modRankInfos[mod] : TheRankInfoStore->m_rankInfos;
- if (rank != ranks.size() + 1)
+ if (rank != TheRankInfoStore->m_rankInfos.size() + 1)
{
DEBUG_CRASH(("Ranks must increase monotonically"));
throw INI_INVALID_DATA;
}
RankInfo* info = newInstance(RankInfo);
ini->initFromINI(info, myFieldParse);
- ranks.push_back(info);
+ TheRankInfoStore->m_rankInfos.push_back(info);
}
}
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp
index 43d562fb3..a1fdb9236 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp
@@ -54,8 +54,6 @@
#include "GameNetwork/LANAPICallbacks.h" // for acceptTrueColor, etc
#include "GameClient/ChallengeGenerals.h"
#include "GameClient/FactionPicker.h"
-#include "Common/GlobalData.h"
-#include "Lib/WideCharFns.h"
#include "Lib/Clock.h"
#include "Common/RandomMapGenerator.h"
#include "Common/RandomMapTemplate.h"
@@ -324,18 +322,8 @@ void PopulatePlayerTemplateComboBox(Int comboBox, GameWindow *comboArray[], Game
std::set<AsciiString> seenSides;
- // retail's armies, then each mod's own block; the fork's own factions load after the mods' and still
- // belong with retail's
- std::vector<Int> order(numPlayerTemplates);
for (Int c=0; c<numPlayerTemplates; ++c)
- order[c] = c;
- std::stable_sort(order.begin(), order.end(), [](Int a, Int b) {
- return ThePlayerTemplateStore->getNthPlayerTemplate(a)->getModIndex() < ThePlayerTemplateStore->getNthPlayerTemplate(b)->getModIndex();
- });
-
- for (Int n=0; n<numPlayerTemplates; ++n)
{
- const Int c = order[n];
const PlayerTemplate *fac = ThePlayerTemplateStore->getNthPlayerTemplate(c);
if (!fac)
continue;
@@ -358,35 +346,12 @@ void PopulatePlayerTemplateComboBox(Int comboBox, GameWindow *comboArray[], Game
AsciiString side;
side.format("SIDE:%s", fac->getSide().str());
- // each mod's America is a side of its own, "<mod name> - USA"
- AsciiString seenKey;
- seenKey.format("%d:%s", fac->getModIndex(), side.str());
- if (seenSides.find(seenKey) != seenSides.end())
+ if (seenSides.find(side) != seenSides.end())
continue;
- seenSides.insert(seenKey);
+ seenSides.insert(side);
- UnicodeString label = TheGameText->fetch(side);
- if (fac->getModIndex() >= 0)
- {
- WideChar modName[128];
- WideCharFromUtf8(TheGlobalData->m_modNames[fac->getModIndex()].str(), modName, ARRAY_SIZE(modName));
- // the mod's own name for the faction: The End of Days' Russia sits on our China Nuke General's side
- static const WideChar MissingLabel[] = u"MISSING";
- const Int missingLength = ARRAY_SIZE(MissingLabel) - 1;
- UnicodeString sideLabel = fac->getDisplayName();
- if (sideLabel.isEmpty() || (sideLabel.getLength() >= missingLength
- && std::char_traits<WideChar>::compare(sideLabel.str(), MissingLabel, missingLength) == 0))
- {
- AsciiString modSide;
- modSide.format("M%d~%s", fac->getModIndex() + 1, side.str());
- sideLabel = TheGameText->fetch(modSide);
- }
- label = UnicodeString(modName);
- label.concat(UnicodeString(u" - "));
- label.concat(sideLabel);
- }
- newIndex = GadgetComboBoxAddEntry(comboArray[comboBox], label, def->getColor());
+ newIndex = GadgetComboBoxAddEntry(comboArray[comboBox], TheGameText->fetch(side), def->getColor());
GadgetComboBoxSetItemData(comboArray[comboBox], newIndex, (void *)(intptr_t)c);
}
seenSides.clear();
diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp
index 9a4bf904b..82424abe1 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPI.cpp
@@ -361,15 +361,13 @@ static void terminateLANMessageStrings( LANMessage *msg, Int length )
msg->PlayerInfo.playerName[g_lanPlayerNameLength] = 0;
break;
case LANMessage::MSG_REQUEST_JOIN:
- msg->GameToJoin.modNamePad = 0; // ends the serial, which has no room of its own for it
- msg->GameToJoin.modName[g_lanModNameLength] = 0;
+ msg->GameToJoin.serial[g_maxSerialLength-1] = 0;
break;
case LANMessage::MSG_JOIN_ACCEPT:
msg->GameJoined.gameName[g_lanGameNameLength] = 0;
break;
case LANMessage::MSG_JOIN_DENY:
msg->GameNotJoined.gameName[g_lanGameNameLength] = 0;
- msg->GameNotJoined.modName[g_lanModNameLength] = 0;
break;
case LANMessage::MSG_SET_ACCEPT:
msg->Accept.gameName[g_lanGameNameLength] = 0;
@@ -727,9 +725,6 @@ void LANAPI::RequestGameJoin( LANGameInfo *game, UnsignedInt ip /* = 0 */ )
// and the far end reads these as C strings out of the packet.
strlcpy(msg.GameToJoin.serial, s.str(), ARRAY_SIZE(msg.GameToJoin.serial));
msg.GameToJoin.serial[g_maxSerialLength-1] = '\0';
- // so a host whose INI set differs can tell the player it is the mod and which one (handleRequestJoin)
- WideCharFromUtf8(TheGlobalData->m_modName.str(), msg.GameToJoin.modName, ARRAY_SIZE(msg.GameToJoin.modName));
- msg.GameToJoin.baseExeCRC = TheGlobalData->m_baseExeCRC;
sendMessage(&msg, ip);
diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp
index 7b08e3cff..a10c84bad 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPICallbacks.cpp
@@ -85,7 +85,6 @@ UnicodeString LANAPIInterface::getErrorStringFromReturnType( ReturnType ret )
case RET_DUPLICATE_NAME:
return TheGameText->fetch("LAN:ErrorDuplicateName");
case RET_CRC_MISMATCH:
- case RET_MOD_MISMATCH:
return TheGameText->fetch("LAN:ErrorCRCMismatch");
case RET_GAME_STARTED:
return TheGameText->fetch("LAN:ErrorGameStarted");
@@ -717,11 +716,6 @@ void LANAPI::OnGameJoin( ReturnType ret, LANGameInfo *theGame )
UnicodeString title, body;
title = TheGameText->fetch("LAN:JoinFailed");
body = getErrorStringFromReturnType(ret);
- if (ret == RET_MOD_MISMATCH)
- {
- body.format(TheGameText->fetch("LAN:ErrorModMismatch").str(),
- m_joinDeniedHostMod.isEmpty() ? TheGameText->fetch("LAN:NoMod").str() : m_joinDeniedHostMod.str());
- }
MessageBoxOk(title, body, NULL);
}
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp
index 2900387c6..4394d1469 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/LANAPIhandlers.cpp
@@ -267,21 +267,8 @@ void LANAPI::handleRequestJoin( LANMessage *msg, UnsignedInt senderIP )
gameDataMatchName(dataMatch),
msg->GameToJoin.iniCRC, TheGlobalData->m_iniCRC,
msg->GameToJoin.exeCRC, TheGlobalData->m_exeCRC));
- // The same build under different -mod lists: a mod changes the INI set and, with its own
- // skirmish or multiplayer scripts, the exe CRC too (GlobalData::computeExeCRC), so the build is
- // compared as it was before the mods mounted. Then the player is told the host's mods rather
- // than the bare mismatch.
- WideChar joinerMod[g_lanModNameLength+1];
- WideCharNCpy(joinerMod, msg->GameToJoin.modName, g_lanModNameLength);
- joinerMod[g_lanModNameLength] = 0;
- WideCharFromUtf8(TheGlobalData->m_modName.str(), reply.GameNotJoined.modName, ARRAY_SIZE(reply.GameNotJoined.modName));
- const Bool modsDiffer = msg->GameToJoin.baseExeCRC == TheGlobalData->m_baseExeCRC &&
- WideCharCmp(joinerMod, reply.GameNotJoined.modName) != 0;
- DEBUG_LOG(("LANAPI::handleRequestJoin - mods them/us '%s'/'%s'\n",
- WideCharAsUtf8(joinerMod).str(), TheGlobalData->m_modName.str()));
-
reply.LANMessageType = LANMessage::MSG_JOIN_DENY;
- reply.GameNotJoined.reason = modsDiffer ? LANAPIInterface::RET_MOD_MISMATCH : LANAPIInterface::RET_CRC_MISMATCH;
+ reply.GameNotJoined.reason = LANAPIInterface::RET_CRC_MISMATCH;
reply.GameNotJoined.gameIP = m_localIP;
reply.GameNotJoined.playerIP = senderIP;
canJoin = false;
@@ -488,11 +475,6 @@ void LANAPI::handleJoinDeny( LANMessage *msg, UnsignedInt senderIP )
{
if (m_pendingAction == ACT_JOIN) // Are we trying to join?
{
- if (msg->GameNotJoined.reason == RET_MOD_MISMATCH)
- {
- msg->GameNotJoined.modName[g_lanModNameLength] = 0;
- m_joinDeniedHostMod = UnicodeString(msg->GameNotJoined.modName);
- }
OnGameJoin(msg->GameNotJoined.reason, LookupGame(UnicodeString(msg->GameNotJoined.gameName)));
m_pendingAction = ACT_NONE;
m_expiration = 0;
diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h
index 686a032bc..4d4bf5d37 100644
--- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h
+++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/Module/W3DModelDraw.h
@@ -366,8 +366,6 @@ public:
virtual void doDrawModule(const Matrix3D* transformMtx);
virtual void buildRenderObjects( Bool madeInTick );
- /// the name the render object was made from; under a mod it keeps the "M<n>~" its Get_Name drops
- const AsciiString& getCurrentModelName() const { return m_curState->m_modelName; }
/// Hands the frame's lit headlights to the Direct3D 11 frame, nearest the camera first. Once a
/// frame, after the smooth motion has placed every model and before anything is drawn.
static void lightHeadlights(const Vector3& cameraPosition);
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp
index dca1142ce..ca2648098 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp
@@ -541,8 +541,7 @@ void MilesAudioManager::reset()
AudioManager::reset();
stopAllAudioImmediately();
removeAllAudioRequests();
- // A file read past this point would read the file system's mod list through a GlobalData that
- // its own reset, which comes after this one, is about to free.
+ // every read still on the worker finishes before the resets that follow this one
m_audioCache->waitForLoads();
m_audioCache->logLoads();
m_recentShots.clear();
@@ -3434,7 +3433,7 @@ void MilesAudioManager::updateSonicPass( PlayingAudio *playing, const Coord3D *p
return;
}
const AudioEventInfo *info = findAudioEventInfo("Cin_SonicBoom");
- if (info == NULL) { // a mod's own audio data need not have it
+ if (info == NULL) { // an audio INI that lacks it
return;
}
AudioEventRTS boom("Cin_SonicBoom");
@@ -3899,11 +3898,6 @@ Bool MilesAudioManager::fileIsReady( AudioEventRTS *event )
if (info == NULL || TheGlobalData->m_wavEndFrame > 0) {
return TRUE;
}
- // Loading a map with mod factions turns the file system's focus to each mod in turn, which would
- // send a read on another thread into the wrong mod's files. Nobody is watching frames then.
- if (TheGlobalData->m_modFactions && TheGameLogic->isLoadingMap()) {
- return TRUE;
- }
if (info->m_soundType != AT_SoundEffect) {
return m_audioCache->streamIsWarm(event->getFilename());
}
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/VideoDevice/Bink/BinkVideoPlayer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/VideoDevice/Bink/BinkVideoPlayer.cpp
index 717e59dce..948c75eea 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/VideoDevice/Bink/BinkVideoPlayer.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/VideoDevice/Bink/BinkVideoPlayer.cpp
@@ -259,22 +259,6 @@ VideoStreamInterface* BinkVideoPlayer::open( AsciiString movieTitle )
const Video* pVideo = getVideo(movieTitle);
if (pVideo) {
DEBUG_LOG(("BinkVideoPlayer::createStream() - About to open bink file\n"));
-
- // the last -mod folder with the movie wins, like every other file (FileSystem::modLooseFile)
- for (size_t i = TheGlobalData->m_mods.size(); i-- > 0; )
- {
- const AsciiString &modDir = TheGlobalData->m_mods[i];
- if (!modDir.endsWith("\\") && !modDir.endsWith("/"))
- continue;
- char filePath[ _MAX_PATH ];
- snprintf( filePath, ARRAY_SIZE(filePath), "%s%s\\%s.%s", modDir.str(), VIDEO_PATH, pVideo->m_filename.str(), VIDEO_EXT );
- HBINK handle = BinkOpen(filePath , BINKPRELOADALL );
- DEBUG_ASSERTLOG(!handle, ("opened bink file %s\n", filePath));
- if (handle)
- {
- return createStream( handle );
- }
- }
char localizedFilePath[ _MAX_PATH ];
sprintf( localizedFilePath, VIDEO_LANG_PATH_FORMAT, GetRegistryLanguage().str(), pVideo->m_filename.str(), VIDEO_EXT );
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DLaserDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DLaserDraw.cpp
index 3173c3e67..017f0f623 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DLaserDraw.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DLaserDraw.cpp
@@ -172,7 +172,7 @@ static void markBeamSeen( DrawableID parent, DrawableID target, UnsignedInt now
static TextureClass *s_glowTexture = NULL;
// ponytail: chosen by template name so no INI field and no checksum change; a "Glow" field in
-// W3DLaserDraw is the upgrade if a mod ever wants it per beam. Every weapon laser in ZH ends in
+// W3DLaserDraw is the upgrade if a beam ever needs it on its own. Every weapon laser in ZH ends in
// LaserBeam; the data streams, the waypoint line and the Particle Cannon's beams do not. The
// Avenger's target designator is a marker, not a weapon, and keeps EA's thin blue line.
static Bool beamGlows( const Thing *thing )
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DRopeDraw.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DRopeDraw.cpp
index 82b42dfbe..4f60e3b22 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DRopeDraw.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Drawable/Draw/W3DRopeDraw.cpp
@@ -84,7 +84,7 @@ void W3DRopeDraw::buildSegments()
DEBUG_ASSERTCRASH(m_segments.empty(), ("Hmmn, not empty"));
m_segments.clear();
- // A mod's ChinookAIUpdate with RopeWobbleLen = 0 (shipped data has 10) makes this 1/0. Windows converts
+ // A ChinookAIUpdate with RopeWobbleLen = 0 (shipped data has 10) makes this 1/0. Windows converts
// the infinity to INT_MIN and draws no rope; ARM64 saturated to INT_MAX and allocated 2^31 segments.
// Platform/MsvcFloatCasts.h gives Windows' answer everywhere.
Int numSegs = floatToIntAsMsvc((float)ceil(m_maxLen / m_wobbleLen));
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp
index 77d8353c3..3bea1be0b 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/GUICallbacks/W3DControlBar.cpp
@@ -776,7 +776,7 @@ void W3DCommandBarBackgroundDraw( GameWindow *window, WinInstanceData *instData
offset.y = now.y - TheControlBar->getPanelOrigin()->y;
}
- // the bar is ControlBar Pro's painting, a mod faction's too, not our plates
+ // the bar is ControlBar Pro's painting, not our plates
if( man->isCurrentSchemePainted() )
{
man->drawPainting( offset, FALSE );
@@ -1103,7 +1103,7 @@ void W3DCommandBarHelpPopupDraw( GameWindow *window, WinInstanceData *instData )
return theStrings[ slot ];
};
// an icon (none for NULL) and its text after a gap, centred between top and bottom, the text cut at
- // right: a long armour name (a mod's own, shown raw) stops at its cell's edge
+ // right: a long armour name stops at its cell's edge
auto figure = [&]( const Image *icon, DisplayString *value, Int gap, Int x, Int top, Int bottom, Int right, Color color )
{
const Int y = ( top + bottom - iconSize ) / 2;
@@ -1145,7 +1145,7 @@ void W3DCommandBarHelpPopupDraw( GameWindow *window, WinInstanceData *instData )
if( figures.cellCount == 0 )
return;
// each cell as wide as its icon and text, the room left over spread as even gaps after them; a row
- // whose cells will not fit at all (a mod's long armour name on a narrow screen) takes even cells, cut
+ // whose cells will not fit at all (a long armour name on a narrow screen) takes even cells, cut
const Int rowLeft = card.lo.x + px( 10 ), rowRight = card.hi.x - px( 18 );
const Int rowTop = card.lo.y + px( 31 ), rowBottom = card.lo.y + px( 57 );
DisplayString *values[ BuildTooltipFigures::MAX_CELLS ];
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp
index 25960b70d..d6254fbcf 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Shadow/W3DProjectedShadow.cpp
@@ -811,8 +811,8 @@ void W3DProjectedShadowManager::flushDecals(W3DShadowTexture *texture, ShadowTyp
{
case SHADOW_DECAL:
//Multiplied onto the ground (dest * texture), as EA drew it: the blob's shape is in its
- //colour, white where the ground is left alone. A mod's blob need not fade its alpha at
- //all - Contra's shadowih.dds is opaque edge to edge - so alpha blending it laid a dark
+ //colour, white where the ground is left alone. A blob texture need not fade its alpha
+ //at all - one opaque edge to edge is valid data - so alpha blending it laid a dark
//square under every unit that named it.
DX8Wrapper::Set_Shader(ShaderClass::_PresetMultiplicativeShader);
break;
@@ -1537,7 +1537,7 @@ Int W3DProjectedShadowManager::renderShadows(RenderInfoClass & rinfo)
with the tick's (a desync) and whose modules the tick frees beside the render. The window
is open for every picture at every -logicthread setting, so the shadow falls on the
terrain alone and every setting draws the same picture.
- ponytail: receivers lost for mods with SHADOW_PROJECTION (the fork's INI has none); the
+ ponytail: receivers lost for any SHADOW_PROJECTION (the fork's INI has none); the
upgrade is the receivers gathered at W3DDisplay's takeReadsForRender. */
if (LogicThread::isInsideWindow())
continue;
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp
index 4214b4427..5507a32b9 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DAssetManager.cpp
@@ -91,9 +91,6 @@ const float H_epsilon(1.0f);
const float S_epsilon(0.01f);
const float V_epsilon(0.01f);
-// A texture name past a mod's "M<n>~" prefix, for the checks that read the retail naming ("ZHC...").
-static inline const char *Mod_Bare_Name(const char *name) { return name + WW3D_Mod_Prefix_Length(name); }
-
//---------------------------------------------------------------------
// Externs defined somewhere in W3D.
//---------------------------------------------------------------------
@@ -188,7 +185,7 @@ TextureClass * W3DAssetManager::Get_Texture
//Just call the base implementation after adjusting reduction to deal
//with our special types.
- if (filename && *filename && strncasecmp(Mod_Bare_Name(filename),"ZHC",3) == 0)
+ if (filename && *filename && strncasecmp(filename,"ZHC",3) == 0)
allow_reduction = false; //don't allow reduction on our infantry textures.
return WW3DAssetManager::Get_Texture( filename,
@@ -706,7 +703,7 @@ TextureClass * W3DAssetManager::Recolor_Texture_One_Time(TextureClass *texture,
Int psize;
psize=PixelSize(desc);
- // The palette remap reads 16- and 32-bit pixels and nothing else. A mod's house-colour texture
+ // The palette remap reads 16- and 32-bit pixels and nothing else. A house-colour texture
// shipped compressed (DXT) or in another format has nothing it can remap, and Direct3D 9 refuses
// the scratch surface for some of them (a DXT image whose sides are not multiples of 4), which
// left newsurf without a surface for Copy to crash on. The unit keeps the texture uncoloured.
@@ -727,11 +724,10 @@ TextureClass * W3DAssetManager::Recolor_Texture_One_Time(TextureClass *texture,
}
newsurf->Copy(0,0,0,0,desc.Width,desc.Height,oldsurf);
- const char *kind = Mod_Bare_Name(name) + 3; // the letter after "ZHC"
- if (*kind == 'D' || *kind == 'd')
+ if (*(name+3) == 'D' || *(name+3) == 'd')
Remap_Palette(newsurf,color, true, false ); //texture only contains a palette stored in top row.
else
- if (*kind == 'A' || *kind == 'a')
+ if (*(name+3) == 'A' || *(name+3) == 'a')
Remap_Palette(newsurf,color, false, true ); //texture only contains a palette stored in top row.
TextureClass * newtex=NEW_REF(TextureClass,(newsurf,(MipCountType)texture->Get_Mip_Level_Count()));
@@ -833,18 +829,10 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj(
WWPROFILE( "WW3DAssetManager::Create_Render_Obj" );
WWMEMLOG(MEM_GEOMETRY);
- // Try to find a prototype: a mod's own first, then the bare name as retail. The request stays
- // the mod's to the end, so the texture swap and recolour below find the mod's textures too.
- WW3DModRequest mod(name);
- Set_WW3D_Load_On_Demand(true); // Auto Load.
- PrototypeClass * proto = mod.Active() ? Find_Mod_Prototype(mod.Bare) : NULL;
- Bool modProto = proto != NULL;
- if (proto == NULL)
- {
- name = mod.Bare;
- proto = Find_Prototype(name);
- }
+ // Try to find a prototype
+ PrototypeClass * proto = Find_Prototype(name);
+ Set_WW3D_Load_On_Demand(true); // Auto Load.
if (WW3D_Load_On_Demand && proto == NULL)
{
// If we didn't find one, try to load on demand
@@ -916,13 +904,7 @@ RenderObjClass * W3DAssetManager::Create_Render_Obj(
if (reallytexture)
{
- // A retail model drawn for a mod carries retail textures, so the one it replaces is
- // looked up as retail, or it would not match the mesh's texture.
- TextureClass *oldTex;
- {
- WW3DModPrefixScope retail(modProto ? WW3D_Mod_Prefix : "");
- oldTex = Get_Texture(modProto ? oldTexture : Mod_Bare_Name(oldTexture));
- }
+ TextureClass *oldTex = Get_Texture(oldTexture);
TextureClass *newTex = Get_Texture(newTexture);
replaceAssetTexture(rendobj,oldTex,newTex);
REF_PTR_RELEASE(newTex);
@@ -1008,7 +990,7 @@ int W3DAssetManager::Recolor_Mesh(RenderObjClass *robj, const int color)
for (i=0; i<material->Texture_Count(); i++)
{
oldtex=material->Peek_Texture(i);
- if (strncasecmp(Mod_Bare_Name(oldtex->Get_Texture_Name()),"ZHC", 3) == 0)
+ if (strncasecmp(oldtex->Get_Texture_Name(),"ZHC", 3) == 0)
{ //This texture needs to be adjusted for housecolor
newtex=Recolor_Texture(oldtex,color);
if (newtex)
@@ -1275,7 +1257,7 @@ static Bool getMeshColorMethods(MeshClass *mesh, Bool &vertexColor, Bool &textur
MaterialInfoClass *material = mesh->Get_Material_Info();
if (material)
{ for (int j=0; j<material->Texture_Count(); j++)
- if (strncasecmp(Mod_Bare_Name(material->Peek_Texture(j)->Get_Texture_Name()),"ZHC",3) == 0)
+ if (strncasecmp(material->Peek_Texture(j)->Get_Texture_Name(),"ZHC",3) == 0)
{ textureColor = true;
break;
}
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp
index 54bf880e4..a0c056217 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DRoadBuffer.cpp
@@ -843,7 +843,7 @@ void W3DRoadBuffer::loadLit4PtSection(RoadSegment *pRoad, UnsignedShort *ib, Ver
Vector2 curVector;
Int uCount = roadColumnCount(roadLen);
// never below two rows, as the float section has it: vtx[vCount-1] is read below, and a width past
- // the int range (mod data) converted to INT_MIN on Windows
+ // the int range (broken road data) converted to INT_MIN on Windows
Int vCount = floatToIntAsMsvc((2*halfHeight/MAP_XY_FACTOR)+1);
if (vCount<2) vCount = 2;
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp
index c282557f3..d4f789e0b 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameLogic/W3DGhostObject.cpp
@@ -53,7 +53,6 @@
#include "WW3D2/hlod.h"
#include "WW3D2/scene.h"
#include "WW3D2/matinfo.h"
-#include "WW3D2/proto.h"
#ifdef _INTERNAL
@@ -82,18 +81,9 @@ protected:
const char *m_robjName; ///<debug pointer so we know what this is a snapshot of.
#endif
RenderObjClass *m_robj; ///<render object representing state at time of snapshot
- char m_modPrefix[8] = ""; ///<"M<n>~" the model was asked for under, "" for retail; the robj's own name drops it
W3DRenderObjectSnapshot *m_next; ///<snapshot of next render object belonging to same drawable
};
-// Copies the "M<n>~" a model name starts with, or "" when it has none.
-static void copyModPrefix(char *prefix, const char *name)
-{
- Int len = WW3D_Mod_Prefix_Length(name);
- memcpy(prefix, name, len);
- prefix[len] = 0;
-}
-
//Dummy material override which we assign to all ghost objects to disable their
//texture animation.
static RenderObjClass::Material_Override animationDisableOverride;
@@ -395,9 +385,6 @@ void W3DGhostObject::snapShot(int playerIndex)
else
snap->update(robj, &m_drawableInfo);
- // the model name keeps the mod prefix the robj's name drops, so a save reloads the mod's art
- copyModPrefix(snap->m_modPrefix, w3dDraw->getCurrentModelName().str());
-
//Adding and removing render objects to the scene is expensive
//so only do it for the real player watching the screen. There is
//also no point in displaying the other player's ghost objects to
@@ -725,7 +712,7 @@ void W3DGhostObject::xfer( Xfer *xfer )
{
// write name from render object
- name.format( "%s%s", objectSnapshot->m_modPrefix, objectSnapshot->m_robj->Get_Name() );
+ name.set( objectSnapshot->m_robj->Get_Name() );
xfer->xferAsciiString( &name );
// write scale from render object
@@ -768,7 +755,6 @@ void W3DGhostObject::xfer( Xfer *xfer )
// we're loading, allocate new snapshot
objectSnapshot = NEW W3DRenderObjectSnapshot( renderObject, &m_drawableInfo, FALSE );
- copyModPrefix( objectSnapshot->m_modPrefix, name.str() );
// attach to list
if( prevObjectSnapshot )
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp
index c4ba01041..839a5146e 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp
@@ -265,8 +265,8 @@ ArchiveFile * Win32BIGFileSystem::openArchiveFile(const Char *filename) {
}
// Allocated after the checks above, not before them: both of those returns used to walk away
- // from a Win32BIGFile that had just been made. A directory of files that are not archives -
- // which is what a mod folder handed to -mod can be - leaked one per file.
+ // from a Win32BIGFile that had just been made. A directory of files that are not archives
+ // leaked one per file.
ArchiveFile *archiveFile = NEW Win32BIGFile;
// read in the file size.
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/agg_def.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/agg_def.cpp
index feff06d80..68e933ed7 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/agg_def.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/agg_def.cpp
@@ -357,15 +357,6 @@ AggregateDefClass::Load_Assets (const char *passet_name)
// Param OK?
if (passet_name != NULL) {
- // Under a mod the mod's own file comes first, as for any other name a mod model uses.
- if (WW3D_Mod_Prefix[0]) {
- char mod_file[MAX_PATH];
- snprintf(mod_file, sizeof(mod_file), "%s%s.w3d", WW3D_Mod_Prefix, passet_name);
- if (WW3D_Mod_Ships(mod_file)) {
- return WW3DAssetManager::Get_Instance()->Load_3D_Assets(mod_file);
- }
- }
-
// Determine what the current working directory is
char path[MAX_PATH];
#if defined(_WIN32)
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp
index 453d7c3b6..db9dde3e1 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.cpp
@@ -141,86 +141,6 @@ WW3DAssetManager * WW3DAssetManager::TheInstance = NULL;
*/
static NullPrototypeClass _NullPrototype;
-thread_local char WW3D_Mod_Prefix[8] = "";
-
-int WW3D_Mod_Prefix_Length(const char * name)
-{
- if (name[0] != 'M' && name[0] != 'm') return 0;
- int i = 1;
- while (name[i] >= '0' && name[i] <= '9') i++;
- return (i > 1 && i < 7 && name[i] == '~') ? i + 1 : 0;
-}
-
-bool WW3D_Mod_Ships(const char * file)
-{
- // Mod files do not change while the game runs, so a miss is remembered: a retail model under a
- // mod would otherwise ask the file system again for every sub-object, tree and texture it uses.
- // One set per thread, so no lock is needed whichever thread asks.
- static thread_local HashTemplateClass<StringClass,bool> missing;
- StringClass key(file,true);
- _strlwr(key.Peek_Buffer());
- if (missing.Exists(key)) return false;
-
- FileClass * f = _TheFileFactory->Get_File(file);
- bool ships = f->Is_Available();
- _TheFileFactory->Return_File(f);
- if (!ships) missing.Insert(key,true);
- return ships;
-}
-
-WW3DModRequest::WW3DModRequest(const char * name) : Bare(name), Own(false)
-{
- int len = WW3D_Mod_Prefix_Length(name);
- if (len != 0) {
- Own = true;
- strcpy(Saved, WW3D_Mod_Prefix);
- memcpy(WW3D_Mod_Prefix, name, len);
- WW3D_Mod_Prefix[len] = 0;
- Bare = name + len;
- }
-}
-
-// The texture loader opens a .dds in place of whatever three letter extension a model names
-// (DDSFileClass swaps the last three characters), so a .dds of the same name counts as the mod's
-// texture: The End of Days' models name "Tunguska-main skin.psd" and the mod ships the .dds.
-static bool Mod_Texture_Ships(const char * name)
-{
- if (WW3D_Mod_Ships(name)) return true;
- size_t len = strlen(name);
- if (len < 4 || name[len - 4] != '.') return false;
- char dds[MAX_PATH];
- snprintf(dds, sizeof(dds), "%.*sdds", (int)(len - 3), name);
- return WW3D_Mod_Ships(dds);
-}
-
-/*
-** A prototype read from a mod's file. It is filed under the mod's prefix and the inner name, so a
-** retail or other mod's prototype of the same name stays apart, and it creates its object with the
-** mod current, so the sub-objects and tree that object names come from the same mod.
-*/
-class ModPrototypeClass : public PrototypeClass
-{
-public:
- ModPrototypeClass(PrototypeClass * inner) : Inner(inner)
- {
- strcpy(Prefix, WW3D_Mod_Prefix);
- snprintf(Name, sizeof(Name), "%s%s", Prefix, inner->Get_Name());
- }
-
- virtual const char * Get_Name(void) const { return Name; }
- virtual int Get_Class_ID(void) const { return Inner->Get_Class_ID(); }
- virtual RenderObjClass * Create(void) { WW3DModPrefixScope mod(Prefix); return Inner->Create(); }
- virtual void DeleteSelf() { Inner->DeleteSelf(); delete this; }
-
-protected:
- virtual ~ModPrototypeClass(void) {}
-
-private:
- PrototypeClass * Inner;
- char Prefix[8];
- char Name[256];
-};
-
/*
** Iterator for the Render Objects in the asset manager
*/
@@ -737,16 +657,6 @@ bool WW3DAssetManager::Load_3D_Assets( const char * filename )
} timer(filename);
#endif
- // A prefixed file the mod does not ship is the retail file; that goes back through the virtual
- // entry so a file already loaded is not read again. Whatever file is read, the current mod is
- // the file's own for the read, so a retail file never takes in a mod's names.
- WW3DModRequest mod(filename);
- if (mod.Own && !WW3D_Mod_Ships(filename)) {
- WW3DModPrefixScope retail("");
- return Load_3D_Assets(mod.Bare);
- }
- WW3DModPrefixScope read(mod.Own ? WW3D_Mod_Prefix : "");
-
FileClass * file = _TheFileFactory->Get_File( filename );
if ( file ) {
if ( file->Is_Available() ) {
@@ -863,10 +773,6 @@ bool WW3DAssetManager::Load_Prototype(ChunkLoadClass & cload)
*/
if (newproto != NULL) {
- if (WW3D_Mod_Prefix[0]) {
- newproto = W3DNEW ModPrototypeClass(newproto);
- }
-
if (!Render_Obj_Exists(newproto->Get_Name())) {
/*
@@ -920,16 +826,6 @@ RenderObjClass * WW3DAssetManager::Create_Render_Obj(const char * name)
WWPROFILE( "WW3DAssetManager::Create_Render_Obj" );
WWMEMLOG(MEM_GEOMETRY);
- // A mod's own model first; without one the bare name goes on as retail, the mod still current.
- WW3DModRequest mod(name);
- if (mod.Active()) {
- PrototypeClass * mod_proto = Find_Mod_Prototype(mod.Bare);
- if (mod_proto != NULL) {
- return mod_proto->Create();
- }
- name = mod.Bare;
- }
-
// Try to find a prototype
PrototypeClass * proto = Find_Prototype(name);
@@ -1108,31 +1004,6 @@ HAnimClass * WW3DAssetManager::Get_HAnim(const char * name)
{
WWPROFILE( "WW3DAssetManager::Get_HAnim" );
- // A mod's own animation first. A miss is put on the missing list under the prefixed name either
- // way, so the next request for it does not ask the file system again before going to retail.
- WW3DModRequest mod(name);
- if (mod.Active()) {
- char full[MAX_PATH];
- snprintf(full, sizeof(full), "%s%s", WW3D_Mod_Prefix, mod.Bare);
- HAnimClass * mod_anim = HAnimManager.Get_Anim(full);
- const char * animname = strchr(mod.Bare, '.');
- if (WW3D_Load_On_Demand && mod_anim == NULL && animname != NULL && !HAnimManager.Is_Missing(full)) {
- char filename[MAX_PATH];
- snprintf(filename, sizeof(filename), "%s%s.w3d", WW3D_Mod_Prefix, animname + 1);
- if (WW3D_Mod_Ships(filename)) {
- Load_3D_Assets(filename);
- mod_anim = HAnimManager.Get_Anim(full);
- }
- if (mod_anim == NULL) {
- HAnimManager.Register_Missing(full);
- }
- }
- if (mod_anim != NULL) {
- return mod_anim;
- }
- name = mod.Bare;
- }
-
// Try to find the hanim
HAnimClass * anim = HAnimManager.Get_Anim(name);
@@ -1187,26 +1058,6 @@ HTreeClass * WW3DAssetManager::Get_HTree(const char * name)
{
WWPROFILE( "WW3DAssetManager::Get_HTree" );
- // A mod's own tree first, then the retail one with the mod still current.
- WW3DModRequest mod(name);
- if (mod.Active()) {
- char full[MAX_PATH];
- snprintf(full, sizeof(full), "%s%s", WW3D_Mod_Prefix, mod.Bare);
- HTreeClass * mod_tree = HTreeManager.Get_Tree(full);
- if (WW3D_Load_On_Demand && mod_tree == NULL) {
- char filename[MAX_PATH];
- snprintf(filename, sizeof(filename), "%s.w3d", full);
- if (WW3D_Mod_Ships(filename)) {
- Load_3D_Assets(filename);
- mod_tree = HTreeManager.Get_Tree(full);
- }
- }
- if (mod_tree != NULL) {
- return mod_tree;
- }
- name = mod.Bare;
- }
-
// Try to find the htree
HTreeClass * htree = HTreeManager.Get_Tree(name);
@@ -1274,16 +1125,6 @@ TextureClass * WW3DAssetManager::Get_Texture
return NULL;
}
- // A mod's own texture is filed under its prefixed name, which is also the path the loader
- // opens; when the mod does not ship the file the request is the retail texture.
- WW3DModRequest mod(filename);
- char mod_name[MAX_PATH];
- if (mod.Active()) {
- snprintf(mod_name, sizeof(mod_name), "%s%s", WW3D_Mod_Prefix, mod.Bare);
- _strlwr(mod_name);
- filename = (TextureHash.Get(StringClass(mod_name)) != NULL || Mod_Texture_Ships(mod_name)) ? mod_name : mod.Bare;
- }
-
StringClass lower_case_name(filename,true);
_strlwr(lower_case_name.Peek_Buffer());
@@ -1873,27 +1714,6 @@ PrototypeClass * WW3DAssetManager::Find_Prototype(const char * name)
return NULL;
}
-PrototypeClass * WW3DAssetManager::Find_Mod_Prototype(const char * bare)
-{
- char full[MAX_PATH];
- snprintf(full, sizeof(full), "%s%s", WW3D_Mod_Prefix, bare);
- PrototypeClass * proto = Find_Prototype(full);
-
- if (proto == NULL && WW3D_Load_On_Demand) {
- // The file is named by the text before the first '.', as for a retail name.
- char filename[MAX_PATH];
- strcpy(filename, full);
- char * dot = strchr(filename, '.');
- if (dot != NULL) *dot = 0;
- strcat(filename, ".w3d");
- if (WW3D_Mod_Ships(filename)) {
- Load_3D_Assets(filename);
- proto = Find_Prototype(full);
- }
- }
- return proto;
-}
-
/*
** Iterator Implementations.
** =====================================================================
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h
index c89bb4411..0060e378a 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/assetmgr.h
@@ -312,10 +312,6 @@ public:
void Remove_Prototype(const char *name);
PrototypeClass * Find_Prototype(const char * name);
- // The current mod's own prototype for bare, read from the mod's file when it ships one; NULL
- // when the mod has none, and the caller goes on with bare as a retail name.
- PrototypeClass * Find_Mod_Prototype(const char * bare);
-
/*
** Load on Demand
*/
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hanim.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hanim.h
index 9fef1d693..51d980415 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hanim.h
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hanim.h
@@ -53,7 +53,6 @@
#include <refcount.h>
#include <slist.h>
#include <Vector.H>
-#include "wwstring.h"
struct NodeMotionStruct;
class MotionChannelClass;
@@ -91,11 +90,7 @@ public:
virtual const char * Get_Name(void) const = 0;
virtual const char * Get_HName(void) const = 0;
- virtual const char * Get_Key( void ) { return ModKey.Is_Empty() ? Get_Name() : (const char *)ModKey; }
-
- // An animation read from a mod's file is filed under the mod's prefix and its name, so it and a
- // retail animation of the same name stay apart. Get_Name stays as it is: the hierarchy matches it.
- void Set_Mod_Prefix(const char * prefix) { ModKey = prefix; ModKey += Get_Name(); }
+ virtual const char * Get_Key( void ) { return Get_Name(); }
virtual int Get_Num_Frames(void) = 0;
virtual float Get_Frame_Rate() = 0;
@@ -129,7 +124,6 @@ public:
protected:
int EmbeddedSoundBoneIndex;
- StringClass ModKey;
};
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hanimmgr.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hanimmgr.cpp
index 7577c8aba..b6f267d31 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hanimmgr.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/hanimmgr.cpp
@@ -57,17 +57,6 @@
#include "wwmemlog.h"
#include "w3dexclusionlist.h"
#include "animatedsoundmgr.h"
-#include "proto.h"
-
-// The key a freshly read animation is filed under: its name, or the mod's prefix and its name when
-// the file being read is a mod's.
-static const char * Load_Key(HAnimClass * anim)
-{
- if (WW3D_Mod_Prefix[0]) {
- anim->Set_Mod_Prefix(WW3D_Mod_Prefix);
- }
- return anim->Get_Key();
-}
/***********************************************************************************************
@@ -177,7 +166,7 @@ int HAnimManagerClass::Load_Morph_Anim(ChunkLoadClass & cload)
// load failed!
newanim->Release_Ref();
goto Error;
- } else if (Peek_Anim(Load_Key(newanim)) != NULL) {
+ } else if (Peek_Anim(newanim->Get_Name()) != NULL) {
// duplicate exists!
newanim->Release_Ref(); // Release the one we just loaded
goto Error;
@@ -220,7 +209,7 @@ int HAnimManagerClass::Load_Raw_Anim(ChunkLoadClass & cload)
// load failed!
newanim->Release_Ref();
goto Error;
- } else if (Peek_Anim(Load_Key(newanim)) != NULL) {
+ } else if (Peek_Anim(newanim->Get_Name()) != NULL) {
// duplicate exists!
newanim->Release_Ref(); // Release the one we just loaded
goto Error;
@@ -263,7 +252,7 @@ int HAnimManagerClass::Load_Compressed_Anim(ChunkLoadClass & cload)
// load failed!
newanim->Release_Ref();
goto Error;
- } else if (Peek_Anim(Load_Key(newanim)) != NULL) {
+ } else if (Peek_Anim(newanim->Get_Name()) != NULL) {
// duplicate exists!
newanim->Release_Ref(); // Release the one we just loaded
goto Error;
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp
index 25c504123..8eaef631d 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/htreemgr.cpp
@@ -52,7 +52,6 @@
#include "chunkio.h"
#include "wwmemlog.h"
#include "w3dexclusionlist.h"
-#include "proto.h"
/***********************************************************************************************
@@ -152,19 +151,6 @@ void HTreeManagerClass::Free_All_Trees_With_Exclusion_List(const W3DExclusionLis
// or copying it to the new tail index if it is excluded.
int new_tail = 0;
- // The kept trees go back into the hash under the keys they had, taken before anything is
- // deleted: a mod's tree is filed under the mod's prefix and its name, which the name alone
- // does not give back.
- DynamicVectorClass<StringClass> kept_keys;
- DynamicVectorClass<HTreeClass *> kept_trees;
- HashTemplateIterator<StringClass,HTreeClass*> ite(TreeHash);
- for (ite.First(); !ite.Is_Done(); ite.Next()) {
- if (exclusion_list.Is_Excluded(ite.Peek_Value())) {
- kept_keys.Add(ite.Peek_Key());
- kept_trees.Add(ite.Peek_Value());
- }
- }
-
int treeidx;
for (treeidx =0; treeidx < MAX_TREES; treeidx++) {
if (TreePtr[treeidx] != NULL) {
@@ -189,9 +175,12 @@ void HTreeManagerClass::Free_All_Trees_With_Exclusion_List(const W3DExclusionLis
TreeHash.Remove_All();
// Add back any trees that were not deleted
- for (int i = 0; i < kept_trees.Count(); i++)
+ for (treeidx=0; treeidx < new_tail; treeidx++)
{
- TreeHash.Insert(kept_keys[i],kept_trees[i]);
+ // Insert to hash table for fast name based search
+ StringClass lower_case_name(TreePtr[treeidx]->Get_Name(),true);
+ _strlwr(lower_case_name.Peek_Buffer());
+ TreeHash.Insert(lower_case_name,TreePtr[treeidx]);
}
}
@@ -222,12 +211,9 @@ int HTreeManagerClass::Load_Tree(ChunkLoadClass & cload)
delete newtree;
goto Error;
- } else if (Get_Tree(StringClass(WW3D_Mod_Prefix,true) + newtree->Get_Name()) != NULL) {
+ } else if (Get_Tree_ID(newtree->Get_Name()) != -1) {
- // tree with this name already exists, reject it! A tree read from a mod's file is filed
- // under the mod's prefix and its name, so only the same mod's copy counts here. The check
- // goes by key, not Get_Tree_ID: a mod's tree carries the bare name too, and a scan by name
- // would turn the retail tree away.
+ // tree with this name already exists, reject it!
delete newtree;
goto Error;
@@ -238,8 +224,7 @@ int HTreeManagerClass::Load_Tree(ChunkLoadClass & cload)
NumTrees++;
// Insert to hash table for fast name based search
- StringClass lower_case_name(WW3D_Mod_Prefix,true);
- lower_case_name += newtree->Get_Name();
+ StringClass lower_case_name(newtree->Get_Name(),true);
_strlwr(lower_case_name.Peek_Buffer());
TreeHash.Insert(lower_case_name,newtree);
}
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/proto.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/proto.h
index 41df4433f..85e12a84a 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/proto.h
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/proto.h
@@ -44,59 +44,11 @@
#include "always.h"
#include <stdlib.h>
-#include <string.h>
#include "w3d_file.h"
class RenderObjClass;
class ChunkLoadClass;
-/*
-** Mod art. With -modfactions a name from mod n's INI text reads "M<n>~name", and the file system
-** opens such a file only if mod n ships it. WW3D_Mod_Prefix is the mod the current request belongs
-** to ("" is retail): a prefixed request sets it for its own duration, so the names a mod model uses
-** inside itself (sub-objects, its tree, its textures) look in that mod first. While a file is read
-** it holds the prefix of that file, and whatever the file brings in is keyed under it.
-*/
-extern thread_local char WW3D_Mod_Prefix[8];
-
-// Length of a leading "M<n>~" on name, 0 when there is none.
-int WW3D_Mod_Prefix_Length(const char * name);
-
-// True when the mod named by the prefix on file ships that file.
-bool WW3D_Mod_Ships(const char * file);
-
-// Sets WW3D_Mod_Prefix for one scope and puts the old one back after.
-class WW3DModPrefixScope
-{
-public:
- WW3DModPrefixScope(const char * prefix) : Changed(strcmp(WW3D_Mod_Prefix, prefix) != 0)
- {
- if (Changed) { strcpy(Saved, WW3D_Mod_Prefix); strcpy(WW3D_Mod_Prefix, prefix); }
- }
- ~WW3DModPrefixScope(void) { if (Changed) strcpy(WW3D_Mod_Prefix, Saved); }
-
-private:
- bool Changed;
- char Saved[8];
-};
-
-// Splits a request name into its bare part and, if it carries a prefix of its own, makes that the
-// current mod for the request's duration. Active() then says whether a mod applies at all.
-class WW3DModRequest
-{
-public:
- WW3DModRequest(const char * name);
- ~WW3DModRequest(void) { if (Own) strcpy(WW3D_Mod_Prefix, Saved); }
-
- bool Active(void) const { return WW3D_Mod_Prefix[0] != 0; }
-
- const char * Bare;
- bool Own;
-
-private:
- char Saved[8];
-};
-
/*
** W3D Prototype system
**
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WWLib/posixpath.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WWLib/posixpath.h
index d28b312b3..d287a6b53 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WWLib/posixpath.h
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WWLib/posixpath.h
@@ -84,7 +84,7 @@ std::vector<std::string> PosixPath_Overlays();
// P1 step 2: the roots are read-only. With this set, every zh_* call that would write a RELATIVE
// path - create, truncate, append, update, remove, unlink, rename (either end), mkdir - is refused
// with EROFS and logged once per path, so nothing the engine addresses relative to the install can
-// change it. Absolute paths (the user data directory, a -mod folder, the logs) are the engine's
+// change it. Absolute paths (the user data directory, the logs) are the engine's
// deliberate destinations and pass. PosixMain sets it for every run; -writableRoot turns it off, for
// a harness's armed control only. Reads, and the overlays, are unaffected.
void PosixPath_Set_Root_Read_Only(bool read_only);
diff --git a/GeneralsMD/Code/Tests/test_bigfilesystem_stubs.cpp b/GeneralsMD/Code/Tests/test_bigfilesystem_stubs.cpp
index 16ffbc9e7..169e6d856 100644
--- a/GeneralsMD/Code/Tests/test_bigfilesystem_stubs.cpp
+++ b/GeneralsMD/Code/Tests/test_bigfilesystem_stubs.cpp
@@ -39,7 +39,6 @@
#include "Common/Debug.h"
#include "Common/FileSystem.h"
#include "Common/GameAudio.h"
-#include "Common/GlobalData.h"
#include "Common/INI.h"
#include "Common/LogicThread.h"
@@ -78,9 +77,6 @@ void INI::load(AsciiString, INILoadType, Xfer *) { unreachable("INI::load"); }
FileSystem *TheFileSystem = NULL;
File *FileSystem::openFile(const Char *, Int) { unreachable("FileSystem::openFile"); return NULL; }
-// ArchiveFileSystem asks these only of a mod's archives; nothing loads mods here.
-Bool FileSystem::isMapPath(const AsciiString &) { unreachable("FileSystem::isMapPath"); return FALSE; }
-Bool FileSystem::isForkUIPath(const AsciiString &) { unreachable("FileSystem::isForkUIPath"); return FALSE; }
// GameDataGone (Common/Debug.h): an archive read failed because its drive went away. Every archive this
// test opens is on the local install and stays there, so that never happens here.
@@ -89,11 +85,9 @@ extern "C" void GameDataGone(const char *what) { fprintf(stderr, "GameDataGone(%
// The archive code's other reaches, for this test:
// - TheAudio: Win32BIGFileSystem::closeArchiveFile stops the music when Music.big closes; nothing
// closes an archive here.
-// - TheWritableGlobalData: ArchiveFileSystem::loadMods reads -mod's settings; nothing loads mods here.
// - MessageBoxWrapper: the missing-base-game warning. Counted, so the test can say the base game
// was found without one.
AudioManager *TheAudio = NULL;
-GlobalData *TheWritableGlobalData = NULL;
int g_messageBoxes = 0;
int MessageBoxWrapper(const char *text, const char *caption, unsigned int)
{
diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cpp
index d12e97558..1de29925a 100644
--- a/GeneralsMD/Code/Tests/test_gameengine.cpp
+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp
@@ -609,7 +609,7 @@ TEST(zero_hour_language_is_the_one_its_language_archive_names)
unknown blocks, so an INI written for a newer build breaks an older one
outright. The throw is an INIException naming the file and the block: a
bare INI_UNKNOWN_TOKEN reached GameEngine::init as "Uncaught Exception
- during initialization." (v3.3.0 crash reports, a mod's Rank.ini). */
+ during initialization." (v3.3.0 crash reports, a third-party Rank.ini). */
TEST(ini_unknown_block_aborts_the_file)
{
CHECK( bootOnce() );
@@ -724,7 +724,7 @@ TEST(balance_patch_edits_a_weapon_in_place)
CHECK_NEAR( gun->getPrimaryDamage( noBonus ), 45.0f, 0.01f );
CHECK_NEAR( gun->getUnmodifiedAttackRange(), 150.0f, 0.01f );
- /* a patch that names a weapon the loaded data lacks (a mod's Weapon.ini without it) is read and
+ /* a patch that names a weapon the loaded data lacks (a Weapon.ini without it) is read and
dropped: no weapon is made for the name, and the block after it still applies */
writeFile( TEST_INI,
"Weapon BalancePatchProbeGunTypo\r\n"
@@ -753,11 +753,11 @@ TEST(balance_patch_edits_a_weapon_in_place)
#include "../Stubs/NullAudioManager.h"
/* The Paladin's infantry laser, the second point defense module BalanceReforged.ini gives it, once
- borrowed EA's WatchTowerMachineGun. Contra's Weapon.ini leaves that weapon out, the MULTIFILE
- block for it was dropped as the test above wants, the module got a null template and
+ borrowed EA's WatchTowerMachineGun. A Weapon.ini that leaves that weapon out had the MULTIFILE
+ block for it dropped as the test above wants, the module got a null template and
PointDefenseLaserUpdate::scanClosestTarget crashed on it. The weapon is the fork's own now, in
WeaponReforged.ini, loaded the way GameEngine::init loads it: it has to come out whole from a
- store that holds none of EA's weapons, which is what a mod's Weapon.ini can leave. */
+ store that holds none of EA's weapons. */
TEST(weapon_reforged_ini_makes_the_paladin_infantry_laser_without_eas_weapons)
{
CHECK( bootOnce() );
@@ -767,7 +767,7 @@ TEST(weapon_reforged_ini_makes_the_paladin_infantry_laser_without_eas_weapons)
if( TheFXListStore == NULL )
TheFXListStore = NEW FXListStore;
- /* the fire FX the weapon names; retail has it, Contra does not, and a missing one reads as none */
+ /* the fire FX the weapon names; a missing one reads as none */
writeFile( TEST_INI,
"FXList WeaponFX_PaladinPointDefenseLaser\r\n"
"End\r\n" );
@@ -824,7 +824,7 @@ TEST(weapon_reforged_ini_makes_the_paladin_infantry_laser_without_eas_weapons)
}
/* WeaponReforged.ini also keeps copies of EA weapons FixesReforged.ini hands out, under EA's names,
- for a mod whose Weapon.ini dropped them. Where the weapon is already defined the copy is read and
+ for data whose Weapon.ini dropped them. Where the weapon is already defined the copy is read and
dropped and the first definition stands; this used to return mid-block, and the next field line
threw as an unknown block. */
TEST(weapon_defined_twice_keeps_the_first_and_reads_on)
@@ -866,8 +866,8 @@ TEST(weapon_defined_twice_keeps_the_first_and_reads_on)
#include "GameLogic/ArmorSet.h"
/* FixesReforged.ini's Toxin Tunnel Defender and Stinger sets name EA's Chem_ rockets and its Ranger
- armor set names ChemSuitHumanArmor; Contra keeps those objects and drops the weapons and the armor.
- Applied anyway, the set left a null in each slot: Contra's two went unarmed and its Rangers took
+ armor set names ChemSuitHumanArmor. On data that keeps those objects and drops the weapons and
+ the armor, the set applied anyway left a null in each slot: the two went unarmed and the Rangers took
every hit at full damage after Chemical Suits. A patch set naming a missing weapon or armor is
skipped now and the object keeps its own; a set that names what exists still applies. */
TEST(patch_set_naming_a_missing_weapon_or_armor_is_skipped)
@@ -962,8 +962,8 @@ TEST(patch_set_naming_a_missing_weapon_or_armor_is_skipped)
}
}
-/* BalanceReforged.ini replaces Tank_ChinaBunker's ModuleTag_05 with a StructureBody. Under the
- Shockwave mod that tag holds another module, and the type check in ThingTemplate::parseModuleName
+/* BalanceReforged.ini replaces Tank_ChinaBunker's ModuleTag_05 with a StructureBody. Where data
+ gives that tag another module, the type check in ThingTemplate::parseModuleName
threw and stopped the game at start. The block is skipped now: the template keeps the module it
had, and the lines after the block still parse. */
TEST(replace_module_of_another_type_is_skipped)
@@ -1048,7 +1048,7 @@ TEST(replace_module_of_another_type_is_skipped)
}
}
-/* BalanceReforged.ini prices Nuke_ChinaGattlingCannon, and an install whose mod archives had no such
+/* BalanceReforged.ini prices Nuke_ChinaGattlingCannon, and an install whose archives had no such
object threw in ThingFactory::parseObjectDefinition and stopped the game at start. The block is
read and dropped now: no template is made for the name, and the object after it is still edited. */
TEST(patch_of_a_missing_object_is_skipped)
@@ -1110,8 +1110,8 @@ TEST(patch_of_a_missing_object_is_skipped)
}
}
-/* FixesReforged.ini gives every China Command Center the Nuke_ and Early_ carpet bombers. Contra has
- no such special powers, the module kept a NULL template, and placing the start building faulted in
+/* FixesReforged.ini gives every China Command Center the Nuke_ and Early_ carpet bombers. With data that
+ has no such special powers the module kept a NULL template, and placing the start building faulted in
SpecialPowerModule's constructor. A patch's module naming a missing power is read and dropped. */
TEST(patch_module_with_a_missing_special_power_is_skipped)
{
@@ -1174,12 +1174,12 @@ TEST(patch_module_with_a_missing_special_power_is_skipped)
}
}
-/* Under Contra FixesReforged.ini gave the Laser Turret's anti-air weapon Zero Hour's
- Lazr_PatriotLaserBeam, which Contra does not have, so the beam vanished, and gave the Emperor an
- upgrade naming Tank_OCL_OverlordGattlingCannon, which it does not have either. A patch naming
- something the loaded data lacks keeps what was there: the weapon its own beam, and a replaced
- module the module it replaced. */
-TEST(patch_naming_a_missing_laser_or_list_keeps_the_mods_own)
+/* FixesReforged.ini gives the Laser Turret's anti-air weapon Zero Hour's Lazr_PatriotLaserBeam;
+ on data without it the beam vanished. It gives the Emperor an upgrade naming
+ Tank_OCL_OverlordGattlingCannon, which such data lacks too. A patch naming something the loaded
+ data lacks keeps what was there: the weapon its own beam, and a replaced module the module it
+ replaced. */
+TEST(patch_naming_a_missing_laser_or_list_keeps_what_was_there)
{
CHECK( bootOnce() );
@@ -1262,8 +1262,8 @@ TEST(patch_naming_a_missing_laser_or_list_keeps_the_mods_own)
}
}
-/* The Power of the West's Armor.ini has "Armor = INFANTRY_MISSIL 100%". EA's parse let it through,
- 264e2180 made it throw and the mod stopped at start. An unknown damage type skips its line; a
+/* A third-party Armor.ini had "Armor = INFANTRY_MISSIL 100%". EA's parse let it through,
+ 264e2180 made it throw and the game stopped at start. An unknown damage type skips its line; a
line with no percentage is still a syntax error. */
TEST(armor_skips_an_unknown_damage_type)
{
@@ -2098,10 +2098,6 @@ static const char HOTKEYS_FROM_LAUNCHER[] =
" Key = Q\r\n"
"End\r\n"
"\r\n"
- "CommandButtonHotKey mymod:Command_Sell\r\n"
- " Key = K\r\n"
- "End\r\n"
- "\r\n"
"; the launcher's own keys from here on\r\n"
"\r\n"
"CommandMap SELECT_NEXT_IDLE_WORKER\r\n"
@@ -2193,7 +2189,7 @@ TEST(hotkeys_every_row_the_page_lists_is_a_command_the_game_knows)
idle++;
if( ( rows[ each ].id == "AUTO_GARRISON" || rows[ each ].id == "AUTO_REPAIR" ) && rows[ each ].category == "CONTROL" && rows[ each ].binding.key.empty() )
autoOrders++;
- // the bar's fixed orders, guard among them, are keys a player sets whatever the mod's bar says
+ // the bar's fixed orders, guard among them, are keys a player sets whatever the bar says
for( size_t name = 0; name < sizeof( ORDERS ) / sizeof( ORDERS[ 0 ] ); name++ )
if( rows[ each ].id == ORDERS[ name ] && rows[ each ].category == "CONTROL" && rows[ each ].binding.key.empty() && !rows[ each ].barOnly )
orders++;
@@ -2224,8 +2220,7 @@ TEST(hotkeys_file_the_launcher_wrote_comes_back_byte_for_byte)
CHECK( file.commands.find( "VIEW_LAST_RADAR_EVENT" )->second == HotkeyBinding( "", "NONE" ) );
CHECK( file.commands.find( "SELECT_TEAM1" )->second == HotkeyBinding( "KEY_KP1", "SHIFT_ALT_CTRL" ) );
CHECK( file.commands.find( "VIEW_COMMAND_CENTER" ) == file.commands.end() ); // the launcher's, not his
- CHECK_EQ( (Int)file.buttons.size(), 5 );
- CHECK_STR( file.buttons.find( "mymod:Command_Sell" )->second.c_str(), "K" );
+ CHECK_EQ( (Int)file.buttons.size(), 4 );
CHECK_STR( file.buttons.find( "command_lowercase" )->second.c_str(), "" );
CHECK( Hotkeys_format( file, rows ) == std::string( HOTKEYS_FROM_LAUNCHER ) );
@@ -2272,7 +2267,6 @@ TEST(hotkeys_names_sort_and_chords_read_as_the_launcher_has_them)
// String.localeCompare: case aside, '_' before the letters, then lower case first
CHECK( Hotkeys_nameLess( "command_lowercase", "Command_Sell" ) );
CHECK( Hotkeys_nameLess( "Command_Sell", "Command_UpgradeChinaMines" ) );
- CHECK( Hotkeys_nameLess( "Command_UpgradeChinaMines", "mymod:Command_Sell" ) );
CHECK( Hotkeys_nameLess( "SELECT_ALL", "SELECT_ALL_MILITARY" ) );
CHECK( Hotkeys_nameLess( "SELECT_ALL_MILITARY", "SELECT_TEAM1" ) );
CHECK( Hotkeys_nameLess( "command_sell", "Command_Sell" ) );
@@ -2938,7 +2932,7 @@ TEST(troop_crawler_scans_at_least_as_far_as_its_troops_shoot)
/* a rifle outranges the INI knob: look as far as the man can shoot. */
CHECK_NEAR( AssaultTransport_clearScanRange( 50.0f, 150.0f ), 150.0f, 0.001f );
- /* the knob is the wider of the two (a modded value): honour it. */
+ /* the knob is the wider of the two (a tuned value): honour it. */
CHECK_NEAR( AssaultTransport_clearScanRange( 200.0f, 150.0f ), 200.0f, 0.001f );
/* no weapon at all - getLargestWeaponRange returns -1; never scan a negative radius. */
@@ -5607,140 +5601,6 @@ TEST(controlbar_command_places_go_in_rows_by_what_they_are_for)
CHECK_EQ( places[ slot ], manyPlaces[ slot ] );
}
-TEST(controlbar_mod_slots_past_the_bar_fit_its_windows)
-{
- enum { SLOTS = MAX_COMMANDS_PER_SET, WINDOWS = 14 };
- const Int N = GUI_COMMAND_NONE, U = GUI_COMMAND_OBJECT_UPGRADE, W = GUI_COMMAND_SWITCH_WEAPON;
- Bool windowed[ SLOTS ];
- for( Int slot = 0; slot < SLOTS; slot++ )
- windowed[ slot ] = slot < WINDOWS;
- Int shown[ SLOTS ];
-
- /* Contra's Cybr_AmericaInfantryRangerCommandSet: five drones, capture, two weapon switches, and
- attack move, guard and stop in 15, 17 and 18, which our fourteen windows lack. The orders go to
- Zero Hour's 11, 13 and 14, the rest stay put */
- const Int ranger[ SLOTS ] = { U, U, U, U, U, N, GUI_COMMAND_SPECIAL_POWER, W, N, W, N, N, N, N,
- GUI_COMMAND_ATTACK_MOVE, N, GUI_COMMAND_GUARD, GUI_COMMAND_STOP };
- ControlBar_fitCommandSlots( ranger, windowed, SLOTS, shown );
- const Int rangerShown[ SLOTS ] = { 0, 1, 2, 3, 4, -1, 6, 7, -1, 9, 14, -1, 16, 17, -1, -1, -1, -1 };
- for( Int slot = 0; slot < SLOTS; slot++ )
- CHECK_EQ( shown[ slot ], rangerShown[ slot ] );
-
- /* 11 taken by the mod's own button: attack move takes the first empty window, and a stray button
- past the bar comes after the orders */
- const Int busy[ SLOTS ] = { U, N, N, N, N, N, N, N, N, N, U, N, N, N, U, GUI_COMMAND_ATTACK_MOVE, N, N };
- ControlBar_fitCommandSlots( busy, windowed, SLOTS, shown );
- CHECK_EQ( shown[ 0 ], 0 );
- CHECK_EQ( shown[ 10 ], 10 );
- CHECK_EQ( shown[ 1 ], 15 );
- CHECK_EQ( shown[ 2 ], 14 );
-
- /* a retail set never goes past fourteen and comes back slot for slot */
- const Int humvee[ SLOTS ] = { U, U, U, N, N, N, N, N, GUI_COMMAND_EVACUATE, N, GUI_COMMAND_ATTACK_MOVE, N,
- GUI_COMMAND_GUARD, GUI_COMMAND_STOP, N, N, N, N };
- ControlBar_fitCommandSlots( humvee, windowed, SLOTS, shown );
- for( Int slot = 0; slot < SLOTS; slot++ )
- CHECK_EQ( shown[ slot ], humvee[ slot ] != N && slot < WINDOWS ? slot : -1 );
-}
-
-TEST(controlbar_wide_grid_only_for_a_set_past_fourteen)
-{
- enum { SLOTS = MAX_COMMANDS_PER_SET };
- const Int N = GUI_COMMAND_NONE, B = GUI_COMMAND_DOZER_CONSTRUCT, P = GUI_COMMAND_PURCHASE_SCIENCE;
-
- /* Stealth's Arms Dealer: twelve buttons, one of them in 15, which the fourteen windows still hold */
- const Int armsDealer[ SLOTS ] = { N, B, B, B, B, B, N, B, N, B, B, B, B, B, B, N, N, N };
- CHECK( !ControlBar_needsWideCommandGrid( armsDealer, SLOTS ) );
-
- /* a promotion screen's set has its own screen, however many slots it fills */
- Int science[ SLOTS ];
- for( Int slot = 0; slot < SLOTS; slot++ )
- science[ slot ] = P;
- CHECK( !ControlBar_needsWideCommandGrid( science, SLOTS ) );
-
- /* fourteen fit, fifteen do not */
- Int full[ SLOTS ];
- for( Int slot = 0; slot < SLOTS; slot++ )
- full[ slot ] = slot < 14 ? B : N;
- CHECK( !ControlBar_needsWideCommandGrid( full, SLOTS ) );
- full[ 16 ] = B;
- CHECK( ControlBar_needsWideCommandGrid( full, SLOTS ) );
-}
-
-/* What the options menu's Hotkeys page lists for a set: each window's letter, in the steps findBars and
- buttonKeyText take, on the windows the game's decision leaves the bar. 0 for an empty window. */
-static void hotkeysPageLetters( const Int *types, Bool spareWindows, Bool wide,
- const std::map< std::string, WideChar >& keys, WideChar *letters )
-{
- enum { SLOTS = MAX_COMMANDS_PER_SET };
- Bool windowed[ SLOTS ];
- Int shown[ SLOTS ], windowTypes[ SLOTS ], ranks[ SLOTS ];
- for( Int slot = 0; slot < SLOTS; slot++ )
- windowed[ slot ] = ControlBar_usesCommandWindow( slot, spareWindows, wide );
- ControlBar_fitCommandSlots( types, windowed, SLOTS, shown );
- for( Int slot = 0; slot < SLOTS; slot++ )
- windowTypes[ slot ] = shown[ slot ] >= 0 ? types[ shown[ slot ] ] : GUI_COMMAND_NONE;
- HotKeyManager::commandBarUpgradeRanks( windowTypes, SLOTS, ranks );
- for( Int slot = 0; slot < SLOTS; slot++ )
- letters[ slot ] = shown[ slot ] >= 0
- ? HotKeyManager::buttonKeyIn( AsciiString( "Command_Synthetic" ), 'Z', windowTypes[ slot ], keys, slot, ranks[ slot ] ) : 0;
-}
-
-/* The expected letters, one a window, '.' for an empty one */
-static void checkHotkeysPageLetters( const WideChar *letters, const char *expected )
-{
- for( Int slot = 0; slot < MAX_COMMANDS_PER_SET; slot++ )
- CHECK_EQ( letters[ slot ], (WideChar)( expected[ slot ] == '.' ? 0 : expected[ slot ] ) );
-}
-
-/* A synthetic mod. Its sets are made up for this test, shaped like a mod drawn for eighteen windows;
- no mod's data is read here */
-TEST(hotkeys_page_shows_the_wide_bar_windows_and_letters)
-{
- enum { SLOTS = MAX_COMMANDS_PER_SET };
- const Int N = GUI_COMMAND_NONE, B = GUI_COMMAND_UNIT_BUILD, U = GUI_COMMAND_OBJECT_UPGRADE, W = GUI_COMMAND_SWITCH_WEAPON;
- const Int A = GUI_COMMAND_ATTACK_MOVE, G = GUI_COMMAND_GUARD, S = GUI_COMMAND_STOP, P = GUI_COMMAND_SPECIAL_POWER;
- std::map< std::string, WideChar > keys;
- WideChar letters[ SLOTS ];
-
- // the set that makes the bar wide: seventeen buttons, the columns' letters past fourteen
- const Int factory[ SLOTS ] = { B, B, B, B, B, B, B, B, B, B, B, B, B, B, A, N, G, S };
- CHECK( ControlBar_needsWideCommandGrid( factory, SLOTS ) );
- // a bar is wide for all its sets: this one needs no wide bar and still stands on one
- const Int soldier[ SLOTS ] = { U, U, U, U, U, N, P, W, N, W, N, N, N, N, A, N, G, S };
- CHECK( !ControlBar_needsWideCommandGrid( soldier, SLOTS ) );
-
- HotKeyManager::setCommandBarGrid( TRUE );
- hotkeysPageLetters( factory, TRUE, TRUE, keys, letters );
- checkHotkeysPageLetters( letters, "QAWSEDRFTGYHUJI.OL" );
- hotkeysPageLetters( soldier, TRUE, TRUE, keys, letters );
- checkHotkeysPageLetters( letters, "XCVBN.RF.G....I.OL" );
-
- // the same sets on fourteen windows: the orders move, and three of the factory's seventeen have no window
- hotkeysPageLetters( factory, TRUE, FALSE, keys, letters );
- checkHotkeysPageLetters( letters, "QAWSEDRFTGYHUJ...." );
- hotkeysPageLetters( soldier, TRUE, FALSE, keys, letters );
- checkHotkeysPageLetters( letters, "XCVBN.RF.GY.UJ...." );
-
- // a mod's own ControlBar.wnd keeps all it drew, whatever the sets need
- hotkeysPageLetters( soldier, FALSE, FALSE, keys, letters );
- checkHotkeysPageLetters( letters, "XCVBN.RF.G....I.OL" );
-
- // a key for a window past fourteen counts on the wide bar alone
- keys[ "command_synthetic@15" ] = 'M';
- hotkeysPageLetters( soldier, TRUE, TRUE, keys, letters );
- CHECK_EQ( letters[ 14 ], (WideChar)'M' );
- hotkeysPageLetters( soldier, TRUE, FALSE, keys, letters );
- checkHotkeysPageLetters( letters, "XCVBN.RF.GY.UJ...." );
- keys.clear();
- HotKeyManager::setCommandBarGrid( FALSE );
-
- // a set of Zero Hour's on its bar: every button stays in its window, the fixed letters on the orders
- const Int humvee[ SLOTS ] = { U, U, U, N, N, N, N, N, GUI_COMMAND_EVACUATE, N, A, N, G, S, N, N, N, N };
- hotkeysPageLetters( humvee, TRUE, FALSE, keys, letters );
- checkHotkeysPageLetters( letters, "ZZZ.....V.A.GS...." );
-}
-
TEST(hotkeys_force_attack_button_gone_from_the_bar_still_loads_from_a_file)
{
/* Force Attack is Ctrl: the English label's F stays off the button */
@@ -5850,11 +5710,11 @@ TEST(hotkeys_command_bar_grid_keys_by_window_slot)
static const char FILE_TEXT[] =
"CommandBarGrid\r\n Enabled = Yes\r\nEnd\r\n\r\n"
"CommandButtonHotKey Command_TransportExit@4\r\n Key = M\r\nEnd\r\n\r\n"
- "CommandButtonHotKey shockwave:Command_TransportExit@12\r\n Key = NONE\r\nEnd\r\n\r\n";
+ "CommandButtonHotKey Command_TransportExit@8\r\n Key = NONE\r\nEnd\r\n\r\n";
HotkeysFile file = Hotkeys_parse( FILE_TEXT, rows );
CHECK( file.commandBarGrid );
CHECK_STR( file.buttons[ "Command_TransportExit@4" ].c_str(), "M" );
- CHECK( file.buttons.count( "shockwave:Command_TransportExit@12" ) == 1 );
+ CHECK( file.buttons.count( "Command_TransportExit@8" ) == 1 );
const std::string text = Hotkeys_format( file, rows );
CHECK( text.find( FILE_TEXT ) != std::string::npos );
CHECK( Hotkeys_format( Hotkeys_parse( text, rows ), rows ) == text );
@@ -20224,7 +20084,7 @@ TEST(the_pixel_past_the_last_tab_is_no_tab_at_all)
}
/** A .wnd that never set the tab size divided by it. A .wnd that declares more tabs than the array
- holds indexed past it. Both are data, and data is what a mod hands the engine. */
+ holds indexed past it. Both are data, and the engine takes data as it comes. */
TEST(a_tab_control_with_no_size_or_too_many_tabs_answers_nothing)
{
CHECK_EQ( GadgetTabControl_tabAtOffset( 40, 0, 3 ), -1 );
@@ -21162,7 +21022,7 @@ TEST(the_bars_windows_can_be_torn_down_twice_without_taking_the_bar_with_them)
}
/* CommandSetReforged.ini names EA's Early_Command_ChinaCarpetBomb in slot 2 of a China command center
- set. Contra X Beta 2 has no such button, and CommandSet::parseCommandButton threw and stopped the
+ set. On data with no such button CommandSet::parseCommandButton threw and stopped the
game at start. The slot is skipped now: it stays empty and the slots after it still parse. */
TEST(command_set_slot_naming_an_unknown_button_is_skipped)
{
@@ -22727,447 +22587,6 @@ TEST(unsigned_text_parses_as_windows_32_bit_strtoul)
CHECK_EQ(strtoulAsWindows("-"), 0u);
}
-// No -mod replaces what the fork ships. The set is Code/Data as the build copies it into Run, less
-// the three trees that never ship, so a new master that FileSystem::isForkOwnedPath does not cover
-// fails here instead of letting a mod quietly win over it. Retail's own loose files stay the mod's.
-TEST(every_shipped_master_is_fork_owned_and_retail_files_are_not)
-{
- const std::filesystem::path data = std::filesystem::path(ZH_CODE_DIR) / "Data";
- Int masters = 0;
- for (std::filesystem::recursive_directory_iterator it(data), end; it != end; ++it)
- {
- if (!it->is_regular_file())
- continue;
- std::string relative = std::filesystem::relative(it->path(), data).generic_string();
- if (relative.rfind("Scenarios/", 0) == 0 || relative.rfind("Cinema/", 0) == 0 || relative == "dx11shaders.shipped")
- continue;
- // shipped, but the one master a mod may replace: its skirmish AI is written for its own generals
- if (relative == "Scripts/SkirmishScripts.scb")
- continue;
- // the post-build copy keeps Data\ in front of these and puts the rest at the top of Run
- const char *underData[] = { "INI/", "Scripts/", "Turkish/", "German/", "Ukrainian/", "Russian/", "French/" };
- Bool keepsData = relative == "Patch.str";
- for (const char *prefix : underData)
- keepsData = keepsData || relative.rfind(prefix, 0) == 0;
- const std::string runPath = keepsData ? "Data/" + relative : relative;
- if (!FileSystem::isForkOwnedPath(AsciiString(runPath.c_str())))
- printf(" not fork-owned: %s\n", runPath.c_str());
- CHECK(FileSystem::isForkOwnedPath(AsciiString(runPath.c_str())));
- ++masters;
- }
- CHECK(masters > 20);
-
- CHECK(FileSystem::isForkOwnedPath(AsciiString("Art\\Textures\\ReforgedBarGLALeft.tga")));
- CHECK(!FileSystem::isForkOwnedPath(AsciiString("Data\\Scripts\\MultiplayerScripts.scb")));
- CHECK(!FileSystem::isForkOwnedPath(AsciiString("Data\\Scripts\\SkirmishScripts.scb")));
- CHECK(!FileSystem::isForkOwnedPath(AsciiString("Data\\Scripts\\Scripts.ini")));
- CHECK(!FileSystem::isForkOwnedPath(AsciiString("Data\\INI\\GameData.ini")));
- CHECK(!FileSystem::isForkOwnedPath(AsciiString("Data\\INI\\Object\\AmericaTankReforged.ini")));
- CHECK(!FileSystem::isForkOwnedPath(AsciiString("Data\\English\\Movies\\EA_LOGO.bik")));
- CHECK(!FileSystem::isForkOwnedPath(AsciiString("Art\\Textures\\AVPaladin.tga")));
-}
-
-// -modfactions: a mod's own names get its prefix everywhere but the line's first word, a name it does
-// not define stays retail's, and a side name stays text even when the mod also calls a block that.
-TEST(modfactions_prefix_only_the_mods_own_names)
-{
- bootOnce();
- ModNamespace names;
- names.scanLine( 0, "Object AmericaRanger ; the mod's own" );
- names.scanLine( 0, "Weapon RangerGun" );
- names.scanLine( 0, " Weapon = PRIMARY RetailGun" ); // a field, not a definition
- names.scanLine( 0, "CommandSet GLA CommandSet" ); // The End of Days really has this line
- names.scanLine( 0, " Side = GLA" );
- names.scanLine( 0, "ObjectCreationList OCL_Mine" );
- names.finishScan( 0 );
- names.setActive( 0 );
-
- char line[ 64 ];
- strcpy( line, "Object AmericaRanger" );
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, "Object M1~AmericaRanger" );
- // a colon parser's keyword stays the parser's, the name after it is the mod's; a label is neither
- strcpy( line, " FactionOCL = Faction:GLA OCL:OCL_Mine" );
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, " FactionOCL = Faction:GLA OCL:M1~OCL_Mine" );
- strcpy( line, " DisplayName = OBJECT:OCL_Mine" );
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, " DisplayName = OBJECT:OCL_Mine" );
- strcpy( line, " Weapon = PRIMARY RangerGun" );
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, " Weapon = PRIMARY M1~RangerGun" );
- strcpy( line, " Weapon = SECONDARY RetailGun" );
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, " Weapon = SECONDARY RetailGun" );
- strcpy( line, " Side = GLA" );
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, " Side = GLA" );
- strcpy( line, "RangerGun = RangerGun" ); // the first word is the field
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, "RangerGun = M1~RangerGun" );
- strcpy( line, "Object AmericaRanger" );
- CHECK( !names.rewriteLine( line, 23 ) ); // "Object M1~AmericaRanger" needs 24
- CHECK_STR( line, "Object AmericaRanger" );
-
- // a finder's miss: the mod's own name stays a miss, anything else is retail's
- AsciiString retail;
- CHECK( !names.findRetailName( AsciiString( "M1~AmericaRanger" ), MODNAME_OBJECT, &retail ) );
- CHECK( names.findRetailName( AsciiString( "M1~RangerGun" ), MODNAME_OBJECT, &retail ) );
- CHECK_STR( retail.str(), "RangerGun" );
- CHECK( !names.findRetailName( AsciiString( "M1~RangerGun" ), MODNAME_WEAPON, &retail ) );
- CHECK( !names.findRetailName( AsciiString( "M2~AmericaRanger" ), MODNAME_OBJECT, &retail ) ); // no second mod
- CHECK( !names.findRetailName( AsciiString( "AmericaRanger" ), MODNAME_OBJECT, &retail ) );
- NameKeyType key;
- CHECK( names.findRetailKey( NAMEKEY( "M1~Upgrade_Retail" ), MODNAME_UPGRADE, &key ) );
- CHECK_EQ( key, NAMEKEY( "Upgrade_Retail" ) );
-}
-
-// Shockwave Chaos's BlackMarketTank.ini has a 1019-character BuildVariations line of 43 of its own
-// tanks. It fits the file reader, but three characters of "M2~" on each name took it past a buffer of
-// that size, and the game stopped at startup whenever Chaos ran beside another full mod.
-TEST(modfactions_prefixed_line_outgrows_the_raw_line)
-{
- bootOnce();
- ModNamespace names;
- std::string line = " BuildVariations =";
- for (Int i = 0; i < 43; ++i)
- {
- char name[ 32 ];
- snprintf( name, sizeof( name ), "ChaosVariationTank_X%02d", i );
- names.scanLine( 1, (std::string( "Object " ) + name).c_str() );
- line += " ";
- line += name;
- }
- names.finishScan( 1 );
- names.setActive( 1 );
- CHECK( (Int)line.size() < INI_MAX_CHARS_PER_LINE );
-
- char buffer[ INI_MAX_CHARS_PER_PREFIXED_LINE + 1 ];
- strcpy( buffer, line.c_str() );
- CHECK( !names.rewriteLine( buffer, INI_MAX_CHARS_PER_LINE + 1 ) ); // the old buffer
- CHECK( names.rewriteLine( buffer, sizeof( buffer ) ) );
- CHECK_EQ( (Int)strlen( buffer ), (Int)line.size() + 43 * 3 );
- CHECK( (Int)strlen( buffer ) > INI_MAX_CHARS_PER_LINE );
- CHECK( strstr( buffer, " M2~ChaosVariationTank_X00 " ) != NULL );
- CHECK( strstr( buffer, " M2~ChaosVariationTank_X42" ) != NULL );
-
- // the worst a full line can do: a one-letter name in every other character, mod 99's prefix on each
- ModNamespace worst;
- worst.scanLine( 98, "Object A" );
- worst.finishScan( 98 );
- worst.setActive( 98 );
- std::string full = "X";
- while ((Int)full.size() + 2 < INI_MAX_CHARS_PER_LINE)
- full += " A";
- strcpy( buffer, full.c_str() );
- CHECK( worst.rewriteLine( buffer, sizeof( buffer ) ) );
-}
-
-// The Power of the West defines "FXList No", and -modfactions made every "IsGrantable = No" an
-// "M2~No" that parseBool refused: a word the parser reads for itself is never the mod's name.
-TEST(modfactions_never_prefix_a_reserved_word)
-{
- bootOnce();
- ModNamespace names;
- names.scanLine( 0, "FXList No" );
- names.scanLine( 0, "Upgrade None" );
- names.scanLine( 0, "FXList FX_Nope" );
- names.finishScan( 0 );
- names.setActive( 0 );
-
- char line[ 64 ];
- strcpy( line, " IsGrantable = No" );
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, " IsGrantable = No" );
- strcpy( line, " PrerequisiteSciences = None" );
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, " PrerequisiteSciences = None" );
- strcpy( line, " FX = FX_Nope" );
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, " FX = M1~FX_Nope" );
-
- // and a name it gave a block that is also an engine word ("ParticleSystem Explosion") still reads as
- // that word where only engine words go
- CHECK( INI::scanBool( "M2~Yes" ) );
- CHECK_EQ( INI::scanIndexList( "M2~SMALL_ARMS", DamageTypeFlags::getBitNames() ), (Int)DAMAGE_SMALL_ARMS );
- CHECK_STR( INI::withoutModPrefix( "M~Explosion" ), "M~Explosion" );
- CHECK_STR( INI::withoutModPrefix( "MX2~Explosion" ), "MX2~Explosion" );
-}
-
-class ModTestArchiveFile : public ArchiveFile
-{
-public:
- ModTestArchiveFile() { m_file = NULL; } // the base leaves it to the device's archive to set
- void add( const char *directory, const char *file )
- {
- ArchivedFileInfo info;
- info.m_filename = file;
- addFile( AsciiString( directory ), &info );
- }
- virtual Bool getFileInfo( const AsciiString&, FileInfo* ) const { return FALSE; }
- virtual File* openFile( const Char*, Int ) { return NULL; }
- virtual void closeAllFiles( void ) {}
- virtual AsciiString getName( void ) { return AsciiString::TheEmptyString; }
- virtual AsciiString getPath( void ) { return AsciiString::TheEmptyString; }
- virtual void setSearchPriority( Int ) {}
- virtual void close( void ) {}
-};
-
-class ModTestArchiveFileSystem : public ArchiveFileSystem
-{
-public:
- virtual void init( void ) {}
- virtual void update( void ) {}
- virtual void reset( void ) {}
- virtual void postProcessLoad( void ) {}
- virtual ArchiveFile* openArchiveFile( const Char* ) { return NULL; }
- virtual void closeArchiveFile( const Char* ) {}
- virtual void closeAllArchiveFiles( void ) {}
- virtual void closeAllFiles( void ) {}
- virtual Bool loadBigFilesFromDirectory( AsciiString, AsciiString, Bool, Bool ) { return FALSE; }
-
- void addRetail( ArchiveFile *archive, const char *name )
- {
- loadIntoDirectoryTree( archive, AsciiString( name ) );
- m_archiveFileMap[ AsciiString( name ) ] = archive;
- }
- using ArchiveFileSystem::keepModsApart;
- using ArchiveFileSystem::addModArchive;
-};
-
-// -modfactions' focus: retail sees the tree from before any -mod, a mod its own archives, nothing else
-TEST(modfactions_focus_sees_one_set_of_archives)
-{
- bootOnce();
- ModTestArchiveFileSystem archives;
- ModTestArchiveFile *retail = new ModTestArchiveFile, *one = new ModTestArchiveFile, *two = new ModTestArchiveFile;
- retail->add( "data\\ini\\", "weapon.ini" );
- retail->add( "data\\ini\\object\\", "a.ini" );
- one->add( "data\\ini\\", "weapon.ini" );
- one->add( "data\\ini\\object\\", "b.ini" );
- two->add( "data\\ini\\object\\", "c.ini" );
- archives.addRetail( retail, "INIZH.big" );
- archives.keepModsApart( 2 );
- archives.addModArchive( 0, one, AsciiString( "Mods\\One\\!one.big" ) );
- archives.addModArchive( 1, two, AsciiString( "Mods\\Two\\!two.big" ) );
-
- const AsciiString weapon( "Data\\INI\\Weapon.ini" );
- CHECK_STR( archives.getArchiveFilenameForFile( weapon ).str(), "INIZH.big" ); // the default view is retail's
- archives.setFocus( FILE_FOCUS_RETAIL );
- CHECK_STR( archives.getArchiveFilenameForFile( weapon ).str(), "INIZH.big" );
- archives.setFocus( 0 );
- CHECK_STR( archives.getArchiveFilenameForFile( weapon ).str(), "Mods\\One\\!one.big" );
- archives.setFocus( 1 );
- CHECK( !archives.doesFileExist( weapon.str() ) );
-
- FilenameList listed;
- archives.getFileListInDirectory( AsciiString( "" ), AsciiString( "Data\\INI\\Object\\" ), AsciiString( "*.ini" ), listed, TRUE );
- CHECK_EQ( (Int)listed.size(), 1 );
- CHECK( listed.begin()->endsWithNoCase( "c.ini" ) );
- listed.clear();
- archives.setFocus( FILE_FOCUS_RETAIL );
- archives.getFileListInDirectory( AsciiString( "" ), AsciiString( "Data\\INI\\Object\\" ), AsciiString( "*.ini" ), listed, TRUE );
- CHECK_EQ( (Int)listed.size(), 1 );
- CHECK( listed.begin()->endsWithNoCase( "a.ini" ) );
- listed.clear();
- archives.setFocus( FILE_FOCUS_ALL );
- archives.getFileListInDirectory( AsciiString( "" ), AsciiString( "Data\\INI\\Object\\" ), AsciiString( "*.ini" ), listed, TRUE );
- CHECK_EQ( (Int)listed.size(), 1 );
- CHECK( listed.begin()->endsWithNoCase( "a.ini" ) );
-
- // a mod's own copy by index, whatever the focus: what an "M<n>~" file name asks for
- archives.setFocus( 1 );
- CHECK( archives.doesModFileExist( 0, weapon ) );
- CHECK( !archives.doesModFileExist( 1, weapon ) );
- CHECK( archives.doesModFileExist( 1, AsciiString( "Data\\INI\\Object\\c.ini" ) ) );
- CHECK( !archives.doesModFileExist( 0, AsciiString( "Data\\INI\\Object\\a.ini" ) ) );
- archives.setFocus( FILE_FOCUS_ALL );
-}
-
-// -modfactions: "M<n>~" on a file name's last part names mod n's copy, only with the switch and a mod n
-TEST(modfactions_split_a_mod_file_name)
-{
- GlobalData *saved = TheWritableGlobalData;
- TheWritableGlobalData = NEW GlobalData;
- TheWritableGlobalData->m_mods.assign( 2, AsciiString( "Mods\\X" ) );
- Int mod = -1;
- AsciiString bare;
- TheWritableGlobalData->m_modFactions = FALSE;
- CHECK( !FileSystem::splitModName( AsciiString( "Art\\W3D\\M1~AVRanger.w3d" ), &mod, &bare ) );
- TheWritableGlobalData->m_modFactions = TRUE;
- CHECK( FileSystem::splitModName( AsciiString( "Art\\W3D\\M1~AVRanger.w3d" ), &mod, &bare ) );
- CHECK_EQ( mod, 0 );
- CHECK_STR( bare.str(), "Art\\W3D\\AVRanger.w3d" );
- CHECK( FileSystem::splitModName( AsciiString( "m2~exsmoke.tga" ), &mod, &bare ) );
- CHECK_EQ( mod, 1 );
- CHECK_STR( bare.str(), "exsmoke.tga" );
- CHECK( !FileSystem::splitModName( AsciiString( "Art\\W3D\\M3~AVRanger.w3d" ), &mod, &bare ) ); // no third mod
- CHECK( !FileSystem::splitModName( AsciiString( "M1~Art\\W3D\\AVRanger.w3d" ), &mod, &bare ) ); // not the last part
- CHECK( !FileSystem::splitModName( AsciiString( "Art\\W3D\\Mx~AVRanger.w3d" ), &mod, &bare ) );
- delete TheWritableGlobalData;
- TheWritableGlobalData = saved;
-}
-
-// -modfactions: a mod's skirmish scripts name its things as the mod's only where the mod defines that
-// kind of thing under that name
-TEST(modfactions_mod_name_by_type)
-{
- bootOnce();
- ModNamespace names;
- names.scanLine( 0, "Object AmericaTankCrusader" );
- names.scanLine( 0, "Upgrade Upgrade_AmericaTOWMissile" );
- names.finishScan( 0 );
- CHECK_STR( names.modName( 0, MODNAME_OBJECT, AsciiString( "AmericaTankCrusader" ) ).str(), "M1~AmericaTankCrusader" );
- CHECK_STR( names.modName( 0, MODNAME_UPGRADE, AsciiString( "Upgrade_AmericaTOWMissile" ) ).str(), "M1~Upgrade_AmericaTOWMissile" );
- CHECK_STR( names.modName( 0, MODNAME_UPGRADE, AsciiString( "AmericaTankCrusader" ) ).str(), "AmericaTankCrusader" ); // not an upgrade
- CHECK_STR( names.modName( 0, MODNAME_OBJECT, AsciiString( "ChinaTankOverlord" ) ).str(), "ChinaTankOverlord" ); // retail's
- CHECK_STR( names.modName( 1, MODNAME_OBJECT, AsciiString( "AmericaTankCrusader" ) ).str(), "AmericaTankCrusader" ); // no second mod
-}
-
-// -modfactions: an AI on a mod faction reads its own mod's AIData side, under "M<n>~<side>", and
-// retail's of the side when the mod has none; a retail AI never reads a mod's
-TEST(modfactions_ai_side_lookups_take_the_mods_own_first)
-{
- bootOnce();
- CHECK_STR( AI::modSideKey( AsciiString( "America" ), -1 ).str(), "America" );
- CHECK_STR( AI::modSideKey( AsciiString( "America" ), 1 ).str(), "M2~America" );
-
- TAiData data;
- AISideInfo *retail = newInstance(AISideInfo);
- retail->m_side = "America";
- data.addSideInfo( retail );
- AISideInfo *shockwave = newInstance(AISideInfo);
- shockwave->m_side = AI::modSideKey( AsciiString( "America" ), 0 );
- data.addSideInfo( shockwave );
- CHECK( data.findSideInfo( AsciiString( "America" ), -1 ) == retail );
- CHECK( data.findSideInfo( AsciiString( "America" ), 0 ) == shockwave );
- CHECK( data.findSideInfo( AsciiString( "America" ), 1 ) == retail ); // a mod without its own entry
- CHECK( data.findSideInfo( AsciiString( "Russia" ), 1 ) == NULL );
-
- AISideBuildList *russia = newInstance(AISideBuildList)( AI::modSideKey( AsciiString( "Russia" ), 1 ) );
- data.addFactionBuildList( russia );
- CHECK( data.findBuildList( AsciiString( "Russia" ), 1 ) == russia );
- CHECK( data.findBuildList( AsciiString( "Russia" ), 0 ) == NULL ); // another mod's
- CHECK( data.findBuildList( AsciiString( "Russia" ), -1 ) == NULL );
-}
-
-// A plain Random stays with retail's armies under any mod: a mod's faction plays only when it is picked
-TEST(modfactions_stay_out_of_a_plain_random)
-{
- PlayerTemplate faction;
- CHECK( !faction.isRandomExcluded() );
- faction.setModIndex( 0 );
- CHECK( faction.isRandomExcluded() );
-}
-
-// -modfactions: which skirmish player's scripts a computer player runs. Its own mod's of its side
-// beats retail's, retail's stands in for a mod without any, and another mod's never fits
-TEST(modfactions_skirmish_side_fit)
-{
- const AsciiString america( "America" );
- CHECK_EQ( SidesList::skirmishSideFit( america, -1, america, -1 ), 2 );
- CHECK_EQ( SidesList::skirmishSideFit( america, 0, america, 0 ), 2 );
- CHECK_EQ( SidesList::skirmishSideFit( america, -1, america, 0 ), 1 );
- CHECK_EQ( SidesList::skirmishSideFit( america, 1, america, 0 ), 0 );
- CHECK_EQ( SidesList::skirmishSideFit( america, 0, america, -1 ), 0 );
- CHECK_EQ( SidesList::skirmishSideFit( AsciiString( "China" ), -1, america, -1 ), 0 );
-}
-
-// -modfactions: a word naming a model, texture or sound the mod ships gets its prefix, so WW3D and the
-// FileSystem serve the mod's copy; art it does not ship stays retail's
-TEST(modfactions_prefix_the_mods_own_art)
-{
- bootOnce();
- ModNamespace names;
- names.addAsset( 0, "Art\\W3D\\AVRanger.W3D" );
- names.addAsset( 0, "Art\\W3D\\AVRanger_STND.w3d" );
- names.addAsset( 0, "Art\\Textures\\exsmoke.dds" );
- names.addAsset( 0, "Data\\Audio\\Sounds\\vrange01a.wav" );
- names.finishScan( 0 );
- names.setActive( 0 );
-
- char line[ 96 ];
- strcpy( line, " Model = avranger" );
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, " Model = M1~avranger" );
- strcpy( line, " Animation = AVRanger_SKL.AVRanger_STND" );
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, " Animation = M1~AVRanger_SKL.AVRanger_STND" );
- strcpy( line, " ParticleName = EXSmoke.tga" ); // INI says .tga, the mod ships the .dds
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, " ParticleName = M1~EXSmoke.tga" );
- strcpy( line, " ShadowTexture = EXSmoke" ); // a decal names its texture bare, the engine adds .tga
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, " ShadowTexture = M1~EXSmoke" );
- strcpy( line, " Sounds = vrange01a vrange01b" );
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, " Sounds = M1~vrange01a vrange01b" );
- strcpy( line, " Model = AVHumvee" );
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, " Model = AVHumvee" );
- strcpy( line, " ShowSubObject = AVRanger" ); // a sub-object, not a file
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, " ShowSubObject = AVRanger" );
-
- // a texture named like a number leaves the animation's numbers alone
- names.addAsset( 0, "Art\\Textures\\6.dds" );
- strcpy( line, " IdleAnimation = AVRanger_SKL.AVRanger_STND 0 6" );
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, " IdleAnimation = M1~AVRanger_SKL.AVRanger_STND 0 6" );
-}
-
-// -modfactions: the file in a path-shaped word is its last part, past either slash
-TEST(modfactions_last_path_part)
-{
- CHECK_EQ( (Int)ModNamespace::lastPathPart( "x.mp3" ), 0 );
- CHECK_EQ( (Int)ModNamespace::lastPathPart( "Sub\\x.mp3" ), 4 );
- CHECK_EQ( (Int)ModNamespace::lastPathPart( "A\\B/x.mp3" ), 4 );
- CHECK_EQ( (Int)ModNamespace::lastPathPart( "Sub\\" ), 4 );
- CHECK_EQ( (Int)ModNamespace::lastPathPart( "" ), 0 );
-}
-
-// -modfactions: a MusicTrack Filename names the whole file, maybe in a subfolder; the prefix goes on the
-// last part, where FileSystem::splitModName looks for it
-TEST(modfactions_prefix_the_last_part_of_a_file_path)
-{
- bootOnce();
- ModNamespace names;
- names.addAsset( 0, "Data\\Audio\\Tracks\\Sub\\Score01.mp3" );
- names.addAsset( 0, "Data\\Audio\\Tracks\\Score02.mp3" );
- names.finishScan( 0 );
- names.setActive( 0 );
-
- char line[ 96 ];
- strcpy( line, " Filename = Sub\\Score01.mp3" );
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, " Filename = Sub\\M1~Score01.mp3" );
- strcpy( line, " Filename = Score02.mp3" );
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, " Filename = M1~Score02.mp3" );
- strcpy( line, " Filename = Sub/Score02.mp3" );
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, " Filename = Sub/M1~Score02.mp3" );
- strcpy( line, " Filename = Sub\\Retail.mp3" ); // not the mod's: untouched
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, " Filename = Sub\\Retail.mp3" );
- strcpy( line, " Sounds = Score01" ); // a sound event still names the base
- CHECK( names.rewriteLine( line, sizeof( line ) ) );
- CHECK_STR( line, " Sounds = M1~Score01" );
-
- // and the file system takes the prefix back off that part
- GlobalData *saved = TheWritableGlobalData;
- TheWritableGlobalData = NEW GlobalData;
- TheWritableGlobalData->m_mods.assign( 1, AsciiString( "Mods\\X" ) );
- TheWritableGlobalData->m_modFactions = TRUE;
- Int mod = -1;
- AsciiString bare;
- CHECK( FileSystem::splitModName( AsciiString( "Data\\Audio\\Tracks\\Sub\\M1~Score01.mp3" ), &mod, &bare ) );
- CHECK_EQ( mod, 0 );
- CHECK_STR( bare.str(), "Data\\Audio\\Tracks\\Sub\\Score01.mp3" );
- delete TheWritableGlobalData;
- TheWritableGlobalData = saved;
-}
-
#include "Common/GameState.h"
// A save from before 60 Hz logic is refused, except a mission save (the GameState and campaign