Skip to content

Commit 09f492f

Browse files
committed
[GEN] Backports various things from ZH
1 parent 3feb3fc commit 09f492f

File tree

191 files changed

+1926
-552
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

191 files changed

+1926
-552
lines changed

Generals/Code/GameEngine/Include/Common/ArchiveFileSystem.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,10 @@ class ArchiveFileSystem : public SubsystemInterface
172172

173173
// Unprotected this for copy-protection routines
174174
AsciiString getArchiveFilenameForFile(const AsciiString& filename) const;
175-
176175
void loadMods( void );
177176

178177
protected:
179-
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.
178+
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.
180179

181180
ArchiveFileMap m_archiveFileMap;
182181
ArchivedDirectoryInfo m_rootDirectory;

Generals/Code/GameEngine/Include/Common/BitFlagsIO.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,18 @@ template <size_t NUMBITS>
138138
((BitFlags*)store)->parse(ini, NULL);
139139
}
140140

141+
//-------------------------------------------------------------------------------------------------
142+
//-------------------------------------------------------------------------------------------------
143+
template <size_t NUMBITS>
144+
/*static*/ void BitFlags<NUMBITS>::parseSingleBitFromINI(INI* ini, void* /*instance*/, void *store, const void* /*userData*/)
145+
{
146+
const char *token = ini->getNextToken();
147+
Int bitIndex = INI::scanIndexList(token, s_bitNameList); // this throws if the token is not found
148+
149+
Int *storeAsInt = (Int*)store;
150+
*storeAsInt = bitIndex;
151+
}
152+
141153
//-------------------------------------------------------------------------------------------------
142154
/** Xfer method
143155
* Version Info:

Generals/Code/GameEngine/Include/Common/DataChunk.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ class DataChunkOutput
136136
void writeUnicodeString(UnicodeString string);
137137
void writeArrayOfBytes(char *ptr, Int len);
138138
void writeDict(const Dict& d);
139+
void writeNameKey(const NameKeyType key);
139140
};
140141

141142
//----------------------------------------------------------------------
@@ -228,6 +229,8 @@ class DataChunkInput
228229
UnicodeString readUnicodeString(void);
229230
Dict readDict(void);
230231
void readArrayOfBytes(char *ptr, Int len);
232+
233+
NameKeyType readNameKey(void);
231234
};
232235

233236

Generals/Code/GameEngine/Include/Common/DisabledTypes.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
3636
#include "Lib/BaseType.h"
3737
#include "Common/BitFlags.h"
38+
#include "Common/BitFlagsIO.h"
3839

3940
//-------------------------------------------------------------------------------------------------
4041
/** Kind of flags for determining groups of things that belong together
@@ -56,6 +57,8 @@ enum DisabledType CPP_11(: Int)
5657
DISABLED_SCRIPT_UNDERPOWERED,
5758

5859
DISABLED_COUNT,
60+
61+
DISABLED_ANY = 65535 ///< Do not use this value for setting disabled types (read-only)
5962
};
6063

6164
typedef BitFlags<DISABLED_COUNT> DisabledMaskType;

Generals/Code/GameEngine/Include/Common/Energy.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class Energy : public Snapshot
6666

6767
public:
6868

69-
inline Energy() : m_energyProduction(0), m_energyConsumption(0), m_owner(NULL) { }
69+
Energy();
7070

7171
// reset energy information to base values.
7272
void init( Player *owner)
@@ -77,7 +77,7 @@ class Energy : public Snapshot
7777
}
7878

7979
/// return current energy production in kilowatts
80-
Int getProduction() const { return m_energyProduction; }
80+
Int getProduction() const;
8181

8282
/// return current energy consumption in kilowatts
8383
Int getConsumption() const { return m_energyConsumption; }

Generals/Code/GameEngine/Include/Common/FileSystem.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,13 @@ struct FileInfo {
116116
* created when FileSystem::Open() gets called.
117117
*/
118118
//===============================
119+
#include <map>
119120

120121
class FileSystem : public SubsystemInterface
121122
{
123+
FileSystem(const FileSystem&);
124+
FileSystem& operator=(const FileSystem&);
125+
122126
public:
123127
FileSystem();
124128
virtual ~FileSystem();
@@ -138,8 +142,7 @@ class FileSystem : public SubsystemInterface
138142
void loadMusicFilesFromCD();
139143
void unloadMusicFilesFromCD();
140144
protected:
141-
142-
145+
mutable std::map<unsigned,bool> m_fileExist;
143146
};
144147

145148
extern FileSystem* TheFileSystem;

Generals/Code/GameEngine/Include/Common/GameMemory.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,6 @@ private: \
730730
public: /* include this line at the end to reset visibility to 'public' */
731731

732732

733-
734733
// ----------------------------------------------------------------------------
735734
/**
736735
This class is provided as a simple and safe way to integrate C++ object allocation
@@ -768,7 +767,6 @@ class MemoryPoolObject
768767
};
769768

770769

771-
772770
// INLINING ///////////////////////////////////////////////////////////////////
773771

774772
// ----------------------------------------------------------------------------
@@ -893,7 +891,6 @@ class STLSpecialAlloc
893891
#endif //DISABLE_GAMEMEMORY
894892

895893

896-
// ----------------------------------------------------------------------------
897894
/**
898895
A simple utility class to ensure exception safety; this holds a MemoryPoolObject
899896
and deletes it in its destructor. Especially useful for iterators!
@@ -910,7 +907,6 @@ class MemoryPoolObjectHolder
910907
};
911908

912909

913-
// ----------------------------------------------------------------------------
914910
/**
915911
Sometimes you want to make a class's destructor protected so that it can only
916912
be destroyed under special circumstances. MemoryPoolObject short-circuits this
@@ -924,4 +920,5 @@ ARGVIS: void deleteInstance() { MemoryPoolObject::deleteInstance(); } public:
924920

925921
#define EMPTY_DTOR(CLASS) inline CLASS::~CLASS() { }
926922

923+
927924
#endif // _GAME_MEMORY_H_

Generals/Code/GameEngine/Include/Common/GameType.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ enum FormationID CPP_11(: Int)
5858
FORCE_FORMATIONID_TO_LONG_SIZE = 0x7ffffff
5959
};
6060

61+
#define INVALID_ANGLE -100.0f
62+
6163
class INI;
6264

6365
//-------------------------------------------------------------------------------------------------

Generals/Code/GameEngine/Include/Common/GlobalData.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@ class GlobalData : public SubsystemInterface
391391

392392
Color m_hotKeyTextColor; ///< standard color for all hotkeys.
393393

394+
//THis is put on ice until later - M Lorenzen
395+
// Int m_cheaterHasBeenSpiedIfMyLowestBitIsTrue; ///< says it all.. this lives near other "colors" cause it is masquerading as one
396+
394397
AsciiString m_specialPowerViewObjectName; ///< Created when certain special powers are fired so players can watch.
395398

396399
std::vector<AsciiString> m_standardPublicBones;
@@ -492,10 +495,13 @@ class GlobalData : public SubsystemInterface
492495

493496
Bool m_isBreakableMovie; ///< if we enter a breakable movie, set this flag
494497
Bool m_breakTheMovie; ///< The user has hit escape!
495-
496498
AsciiString m_modDir;
497499
AsciiString m_modBIG;
498500

501+
//-allAdvice feature
502+
//Bool m_allAdvice;
503+
504+
499505
// the trailing '\' is included!
500506
AsciiString getPath_UserData() const;
501507

Generals/Code/GameEngine/Include/Common/KindOf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
// INCLUDES ///////////////////////////////////////////////////////////////////////////////////////
3636
#include "Lib/BaseType.h"
3737
#include "Common/BitFlags.h"
38+
#include "Common/BitFlagsIO.h"
3839

3940
//-------------------------------------------------------------------------------------------------
4041
/** Kind of flags for determining groups of things that belong together

0 commit comments

Comments
 (0)