Skip to content

Commit 2645e4f

Browse files
committed
[GEN] Backports various things from ZH
1 parent 1597a1d commit 2645e4f

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

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@
3636
#include "Common/GameMemory.h"
3737
#include "GameClient/TerrainRoads.h"
3838

39+
40+
41+
class WorldHeightMapInterfaceClass
42+
{
43+
public:
44+
45+
virtual Int getBorderSize() = 0;
46+
virtual Real getSeismicZVelocity(Int xIndex, Int yIndex) const = 0;
47+
virtual void setSeismicZVelocity(Int xIndex, Int yIndex, Real value) = 0;
48+
virtual Real getBilinearSampleSeismicZVelocity( Int x, Int y) = 0;
49+
50+
};
51+
3952
/** MapObject class
4053
Not ref counted. Do not store pointers to this class. */
4154
class WorldHeightMap;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,8 @@ class GameMessage : public MemoryPoolObject
567567
MSG_DEBUG_KILL_OBJECT,
568568
#endif
569569

570+
571+
570572
//*********************************************************************************************************
571573
MSG_END_NETWORK_MESSAGES = 1999, ///< MARKER TO DELINEATE MESSAGES THAT GO OVER THE NETWORK
572574
//*********************************************************************************************************

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,5 @@ struct MiscAudio
7373
};
7474

7575

76-
#endif /* _MISCAUDIO_H_ */
76+
#endif /* _MISCAUDIO_H_ */
77+

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "Lib/BaseType.h"
3535
#include "Common/INI.h"
3636
#include "Common/BitFlags.h"
37+
#include "Common/BitFlagsIO.h"
3738

3839
//-------------------------------------------------------------------------------------------------
3940

@@ -83,6 +84,8 @@
8384
8485
*/
8586

87+
#define NUM_MODELCONDITION_DOOR_STATES 4
88+
8689
//-------------------------------------------------------------------------------------------------
8790
// IMPORTANT NOTE: you should endeavor to set up states such that the most "normal"
8891
// state is defined by the bit being off. That is, the typical "normal" condition

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class Object;
4848
class Player;
4949
class Thing;
5050
class W3DModelDrawModuleData; // ugh, hack (srj)
51+
class W3DTreeDrawModuleData; // ugh, hack (srj)
5152
struct FieldParse;
5253

5354
// TYPES //////////////////////////////////////////////////////////////////////////////////////////
@@ -112,6 +113,8 @@ class ModuleData : public Snapshot
112113

113114
// ugh, hack
114115
virtual const W3DModelDrawModuleData* getAsW3DModelDrawModuleData() const { return NULL; }
116+
// ugh, hack
117+
virtual const W3DTreeDrawModuleData* getAsW3DTreeDrawModuleData() const { return NULL; }
115118
virtual StaticGameLODLevel getMinimumRequiredGameLOD() const { return (StaticGameLODLevel)0;}
116119

117120
static void buildFieldParse(MultiIniFieldParse& p)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ class MultiplayerSettings : public SubsystemInterface
7979

8080
MultiplayerSettings( void );
8181

82-
void init() { }
83-
void update() { }
84-
void reset() { }
82+
virtual void init() { }
83+
virtual void update() { }
84+
virtual void reset() { }
8585

8686
//-----------------------------------------------------------------------------------------------
8787
static const FieldParse m_multiplayerSettingsFieldParseTable[]; ///< the parse table for INI definition

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,11 @@ class NameKeyGenerator : public SubsystemInterface
9696

9797
/// Given a string, convert into a unique integer key.
9898
NameKeyType nameToKey(const AsciiString& name) { return nameToKey(name.str()); }
99+
NameKeyType nameToLowercaseKey(const AsciiString& name) { return nameToLowercaseKey(name.str()); }
99100

100101
/// Given a string, convert into a unique integer key.
101102
NameKeyType nameToKey(const char* name);
103+
NameKeyType nameToLowercaseKey(const char *name);
102104

103105
/**
104106
given a key, return the name. this is almost never needed,
@@ -108,6 +110,9 @@ class NameKeyGenerator : public SubsystemInterface
108110
*/
109111
AsciiString keyToName(NameKeyType key);
110112

113+
// Get a string out of the INI. Store it into a NameKeyType
114+
static void parseStringAsNameKeyType( INI *ini, void *instance, void *store, const void* userData );
115+
111116
private:
112117

113118
enum

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,9 @@ class Player : public Snapshot
316316
void toggleFreeBuild(){ m_DEMO_freeBuild = !m_DEMO_freeBuild; }
317317
Bool buildsForFree() const { return m_DEMO_freeBuild; }
318318

319+
#endif
320+
321+
#if defined(_DEBUG) || defined(_INTERNAL) || defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)
319322
/// No time building cheat key
320323
void toggleInstantBuild(){ m_DEMO_instantBuild = !m_DEMO_instantBuild; }
321324
Bool buildsInstantly() const { return m_DEMO_instantBuild; }
@@ -770,6 +773,9 @@ class Player : public Snapshot
770773
#if defined(_DEBUG) || defined(_INTERNAL)
771774
Bool m_DEMO_ignorePrereqs; ///< Can I ignore prereq checks?
772775
Bool m_DEMO_freeBuild; ///< Can I build everything for no money?
776+
#endif
777+
778+
#if defined(_DEBUG) || defined(_INTERNAL) || defined(_ALLOW_DEBUG_CHEATS_IN_RELEASE)
773779
Bool m_DEMO_instantBuild; ///< Can I build anything in one frame?
774780
#endif
775781

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ class Radar : public Snapshot,
169169
Bool isRadarWindow( GameWindow *window ) { return (m_radarWindow == window) && (m_radarWindow != NULL); }
170170

171171
Bool radarToWorld( const ICoord2D *radar, Coord3D *world ); ///< radar point to world point on terrain
172+
Bool radarToWorld2D( const ICoord2D *radar, Coord3D *world ); ///< radar point to world point (x,y only!)
172173
Bool worldToRadar( const Coord3D *world, ICoord2D *radar ); ///< translate world point to radar (x,y)
173174
Bool localPixelToRadar( const ICoord2D *pixel, ICoord2D *radar ); ///< translate pixel (with UL of radar being (0,0)) to logical radar coords
174175
Bool screenPixelToWorld( const ICoord2D *pixel, Coord3D *world ); ///< translate pixel (with UL of the screen being (0,0)) to world position in the world

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,26 @@ class SparseMatchFinder
7272
}
7373
};
7474

75+
struct MapHelper
76+
{
77+
bool operator()(const BITSET& a, const BITSET& b) const
78+
{
79+
int i;
80+
if (a.size() < b.size()) {
81+
return true;
82+
}
83+
for (i = 0; i < a.size(); ++i) {
84+
bool aVal = a.test(i);
85+
bool bVal = b.test(i);
86+
if (aVal && bVal) continue;
87+
if (!aVal && !bVal) continue;
88+
if (!aVal) return true;
89+
return false;
90+
}
91+
return false; // all bits match.
92+
}
93+
};
94+
7595
//-------------------------------------------------------------------------------------------------
7696
typedef std::hash_map< BITSET, const MATCHABLE*, HashMapHelper, HashMapHelper > MatchMap;
7797

@@ -80,6 +100,7 @@ class SparseMatchFinder
80100
//-------------------------------------------------------------------------------------------------
81101

82102
mutable MatchMap m_bestMatches;
103+
//mutable HashMatchMap m_bestHashMatches;
83104

84105
//-------------------------------------------------------------------------------------------------
85106
// METHODS

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#define __SPECIALPOWERMASKTYPE_H__
3232

3333
#include "Common/BitFlags.h"
34+
#include "Common/BitFlagsIO.h"
3435
#include "Common/SpecialPowerType.h"
3536

3637
typedef BitFlags<SPECIALPOWER_COUNT> SpecialPowerMaskType;

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929

3030
#ifndef IG_DEGBUG_STACKTRACE
3131
#define IG_DEBUG_STACKTRACE 1
32-
#endif
33-
32+
#endif // Unsure about this one -ML 3/25/03
3433
#if defined(_DEBUG) || defined(_INTERNAL) || defined(IG_DEBUG_STACKTRACE)
3534

3635
// Writes a stackdump (provide a callback : gets called per line)
@@ -70,6 +69,4 @@ __inline void DumpExceptionInfo( unsigned int u, EXCEPTION_POINTERS* e_info ) {}
7069
#endif
7170

7271
extern AsciiString g_LastErrorDump;
73-
74-
7572
#endif // __STACKDUMP_H_

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ class Team : public MemoryPoolObject,
474474
a convenience routine used to estimate the team's position by just returning the position
475475
of the first member of the team
476476
*/
477-
const Coord3D* getEstimateTeamPosition(void);
477+
const Coord3D* getEstimateTeamPosition(void) const;
478478

479479
/**
480480
a convenience routine to move a team's units to another team.

0 commit comments

Comments
 (0)