Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Generals/Code/GameEngine/Include/Common/CustomMatchPreferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,15 @@ class CustomMatchPreferences : public UserPreferences
Bool getDisallowNonAsianText( void );
void setDisallowNonAsianText( Bool val );

Bool getSuperweaponRestricted(void) const;
void setSuperweaponRestricted( Bool superweaponRestricted);

Money getStartingCash(void) const;
void setStartingCash( const Money &startingCash );

Bool getFactionsLimited(void) const; // Prefers to only use the original 3 sides, not USA Air Force General, GLA Toxin General, et al
void setFactionsLimited( Bool factionsLimited );

Bool getUseStats( void ) const;
void setUseStats( Bool useStats );
};
5 changes: 3 additions & 2 deletions Generals/Code/GameEngine/Include/Common/GlobalData.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "Common/SubsystemInterface.h"
#include "GameClient/Color.h"
#include "Common/STLTypedefs.h"
#include "Common/Money.h"

// FORWARD DECLARATIONS ///////////////////////////////////////////////////////////////////////////
struct FieldParse;
Expand Down Expand Up @@ -438,8 +439,8 @@ class GlobalData : public SubsystemInterface
Real m_standardMinefieldDistance;


Bool m_showMetrics; ///< whether or not to show the metrics.
Int m_defaultStartingCash; ///< The amount of cash a player starts with by default.
Bool m_showMetrics; ///< whether or not to show the metrics.
Money m_defaultStartingCash; ///< The amount of cash a player starts with by default.

Bool m_debugShowGraphicalFramerate; ///< Whether or not to show the graphical framerate bar.

Expand Down
20 changes: 18 additions & 2 deletions Generals/Code/GameEngine/Include/Common/MultiplayerSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#pragma once

#include "GameClient/Color.h"
#include "Common/Money.h"

// FORWARD DECLARATIONS ///////////////////////////////////////////////////////////////////////////
struct FieldParse;
Expand Down Expand Up @@ -66,6 +67,9 @@ class MultiplayerColorDefinition
typedef std::map<Int, MultiplayerColorDefinition> MultiplayerColorList;
typedef std::map<Int, MultiplayerColorDefinition>::iterator MultiplayerColorIter;

// A list of values to display in the starting money dropdown
typedef std::vector< Money > MultiplayerStartingMoneyList;

//-------------------------------------------------------------------------------------------------
/** Multiplayer Settings container class
* Defines multiplayer settings */
Expand All @@ -88,8 +92,6 @@ class MultiplayerSettings : public SubsystemInterface
MultiplayerColorDefinition * findMultiplayerColorDefinitionByName(AsciiString name);
MultiplayerColorDefinition * newMultiplayerColorDefinition(AsciiString name);

inline Int getInitialCreditsMin( void ) { return m_initialCreditsMin; }
inline Int getInitialCreditsMax( void ) { return m_initialCreditsMax; }
inline Int getStartCountdownTimerSeconds( void ) { return m_startCountdownTimerSeconds; }
inline Int getMaxBeaconsPerPlayer( void ) { return m_maxBeaconsPerPlayer; }
inline Bool isShroudInMultiplayer( void ) { return m_isShroudInMultiplayer; }
Expand All @@ -106,6 +108,17 @@ class MultiplayerSettings : public SubsystemInterface
}
MultiplayerColorDefinition * getColor(Int which);


const Money & getDefaultStartingMoney() const
{
DEBUG_ASSERTCRASH( m_gotDefaultStartingMoney, ("You must specify a default starting money amount in multiplayer.ini") );
return m_defaultStartingMoney;
}

const MultiplayerStartingMoneyList & getStartingMoneyList() const { return m_startingMoneyList; }

void addStartingMoneyChoice( const Money & money, Bool isDefault );

private:
Int m_initialCreditsMin;
Int m_initialCreditsMax;
Expand All @@ -120,6 +133,9 @@ class MultiplayerSettings : public SubsystemInterface
Int m_numColors;
MultiplayerColorDefinition m_observerColor;
MultiplayerColorDefinition m_randomColor;
MultiplayerStartingMoneyList m_startingMoneyList;
Money m_defaultStartingMoney;
Bool m_gotDefaultStartingMoney;
};

// singleton
Expand Down
2 changes: 2 additions & 0 deletions Generals/Code/GameEngine/Include/Common/PlayerTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class PlayerTemplate
//const Image *getHiliteImage( void ) const;
//const Image *getPushedImage( void ) const;
const Image *getSideIconImage( void ) const;
inline const AsciiString getTooltip() const { return m_tooltip; }

const ScienceVec& getIntrinsicSciences() const { return m_intrinsicSciences; }
Int getIntrinsicSciencePurchasePoints() const { return m_intrinsicSPP; }
Expand Down Expand Up @@ -158,6 +159,7 @@ class PlayerTemplate
AsciiString m_specialPowerShortcutWinName; ///< The name of the window we'll be using for the shortcut bar
Int m_specialPowerShortcutButtonCount; ///< The number of buttons located on the shortcut bar
AsciiString m_loadScreenMusic; ///< the load screen music we want to play
AsciiString m_tooltip; ///< The tooltip describing this player template
Bool m_observer;
Bool m_playableSide;

Expand Down
6 changes: 6 additions & 0 deletions Generals/Code/GameEngine/Include/Common/SkirmishPreferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,10 @@ class SkirmishPreferences : public UserPreferences
Int getPreferredColor(void); // convenience function
AsciiString getPreferredMap(void); // convenience function
Bool usesSystemMapDir(void); // convenience function

Bool getSuperweaponRestricted(void) const;
void setSuperweaponRestricted( Bool superweaponRestricted);

Money getStartingCash(void) const;
void setStartingCash( const Money &startingCash );
};
6 changes: 6 additions & 0 deletions Generals/Code/GameEngine/Include/Common/UserPreferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
//-----------------------------------------------------------------------------
#include "Common/STLTypedefs.h"

class Money;
typedef UnsignedInt CursorCaptureMode;
typedef UnsignedInt ScreenEdgeScrollMode;

Expand Down Expand Up @@ -164,4 +165,9 @@ class LANPreferences : public UserPreferences
Bool usesSystemMapDir(void); // convenience function
Int getNumRemoteIPs(void); // convenience function
UnicodeString getRemoteIPEntry(Int i); // convenience function

Bool getSuperweaponRestricted(void) const;
Money getStartingCash(void) const;
void setSuperweaponRestricted( Bool superweaponRestricted);
void setStartingCash( const Money & startingCash );
};
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ class DisconnectManager
Bool m_haveNotifiedOtherPlayersOfCurrentFrame;

time_t m_timeOfDisconnectScreenOn;

Int m_pingsSent;
Int m_pingsRecieved;
UnsignedInt m_pingFrame;
Expand Down
3 changes: 2 additions & 1 deletion Generals/Code/GameEngine/Include/GameNetwork/GUIUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ void ShowUnderlyingGUIElements( Bool show, const char *layoutFilename, const cha
const char **gadgetsToHide, const char **perPlayerGadgetsToHide );

void PopulateColorComboBox(Int comboBox, GameWindow *comboArray[], GameInfo *myGame, Bool isObserver = FALSE);
void PopulatePlayerTemplateComboBox(Int comboBox, GameWindow *comboArray[], GameInfo *myGame, Bool allowObservers);
void PopulatePlayerTemplateComboBox(Int comboBox, GameWindow *comboArray[], GameInfo *myGame, Bool allowObservers );
void PopulateTeamComboBox(Int comboBox, GameWindow *comboArray[], GameInfo *myGame, Bool isObserver = FALSE);
void PopulateStartingCashComboBox(GameWindow *comboBox, GameInfo *myGame);

void EnableSlotListUpdates( Bool val );
Bool AreSlotListUpdatesEnabled( void );
Expand Down
22 changes: 22 additions & 0 deletions Generals/Code/GameEngine/Include/GameNetwork/GameInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#pragma once

#include "Common/Snapshot.h"
#include "Common/Money.h"
#include "GameNetwork/NetworkDefs.h"
#include "GameNetwork/FirewallHelper.h"

Expand Down Expand Up @@ -190,6 +191,13 @@ class GameInfo
inline Int getMapContentsMask( void ) const; ///< Get the map contents mask
void setSeed( Int seed ); ///< Set the random seed for the game
inline Int getSeed( void ) const; ///< Get the game seed
inline Int getUseStats( void ) const; ///< Does this game count towards gamespy stats?
inline void setUseStats( Int useStats );

inline UnsignedShort getSuperweaponRestriction( void ) const; ///< Get any optional limits on superweapons
void setSuperweaponRestriction( UnsignedShort restriction ); ///< Set the optional limits on superweapons
inline const Money & getStartingCash(void) const;
void setStartingCash( const Money & startingCash );

void setSlotPointer( Int index, GameSlot *slot ); ///< Set the slot info pointer

Expand Down Expand Up @@ -219,6 +227,9 @@ class GameInfo
Bool isPlayerPreorder(Int index);
void markPlayerAsPreorder(Int index);

inline Bool oldFactionsOnly(void) const;
inline void setOldFactionsOnly( Bool oldFactionsOnly );

protected:
Int m_preorderMask;
Int m_crcInterval;
Expand All @@ -236,6 +247,10 @@ class GameInfo
UnsignedInt m_mapSize;
Int m_mapMask;
Int m_seed;
Int m_useStats;
Money m_startingCash;
UnsignedShort m_superweaponRestriction;
Bool m_oldFactionsOnly; // Only USA, China, GLA -- not USA Air Force General, GLA Toxic General, et al
};

extern GameInfo *TheGameInfo;
Expand All @@ -251,6 +266,12 @@ Bool GameInfo::isInGame( void ) const { return m_inGame; }
void GameInfo::setInGame( void ) { m_inGame = true; }
Bool GameInfo::isGameInProgress( void ) const { return m_inProgress; }
void GameInfo::setGameInProgress( Bool inProgress ) { m_inProgress = inProgress; }
Int GameInfo::getUseStats( void ) const { return m_useStats; }
void GameInfo::setUseStats( Int useStats ) { m_useStats = useStats; }
const Money&GameInfo::getStartingCash( void ) const { return m_startingCash; }
UnsignedShort GameInfo::getSuperweaponRestriction( void ) const { return m_superweaponRestriction; }
Bool GameInfo::oldFactionsOnly(void) const { return m_oldFactionsOnly; }
void GameInfo::setOldFactionsOnly( Bool oldFactionsOnly ) { m_oldFactionsOnly = oldFactionsOnly; }

AsciiString GameInfoToAsciiString( const GameInfo *game );
Bool ParseAsciiStringToGameInfo( GameInfo *game, AsciiString options );
Expand Down Expand Up @@ -281,3 +302,4 @@ class SkirmishGameInfo : public GameInfo, public Snapshot
};

extern SkirmishGameInfo *TheSkirmishGameInfo;
extern SkirmishGameInfo *TheChallengeGameInfo;
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ void RefreshGameInfoListBox( GameWindow *mainWin, GameWindow *win );
void RefreshGameListBoxes( void );
void ToggleGameListType( void );

void playerTemplateComboBoxTooltip(GameWindow *wndComboBox, WinInstanceData *instData, UnsignedInt mouse);
void playerTemplateListBoxTooltip(GameWindow *wndListBox, WinInstanceData *instData, UnsignedInt mouse);

enum GameSortType CPP_11(: Int)
{
GAMESORT_ALPHA_ASCENDING = 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ void CancelPatchCheckCallback( void );
void StartDownloadingPatches( void );
void HandleCanceledDownload( Bool resetDropDown = TRUE );

#if RTS_GENERALS
enum OverallStatsPeriod CPP_11(: Int)
{
STATS_TODAY = 0,
Expand All @@ -51,9 +52,14 @@ struct OverallStats
Int wins[STATS_MAX];
Int losses[STATS_MAX];
};
#endif

void CheckOverallStats( void );
#if RTS_GENERALS
void HandleOverallStats( const OverallStats& USA, const OverallStats& China, const OverallStats& GLA );
#else
void HandleOverallStats( const char* szHTTPStats, unsigned len );
#endif

void CheckNumPlayersOnline( void );
void HandleNumPlayersOnline( Int numPlayersOnline );
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ class GameSpyInfo : public GameSpyInfoInterface
virtual void setLocalPassword( AsciiString passwd ) { m_localPasswd = passwd; }
virtual void setLocalBaseName( AsciiString name ) { m_localBaseName = name; }
virtual AsciiString getLocalBaseName( void ){ return m_localBaseName; }

virtual void setCachedLocalPlayerStats( PSPlayerStats stats ) {m_cachedLocalPlayerStats = stats; }
virtual PSPlayerStats getCachedLocalPlayerStats( void ){ return m_cachedLocalPlayerStats; }

Expand Down Expand Up @@ -174,6 +173,5 @@ class GameSpyInfo : public GameSpyInfoInterface
std::set<GameWindow *> m_textWindows;

std::set<Int> m_preorderPlayers;

Int m_additionalDisconnects;
};
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class PeerRequest
UnsignedInt iniCRC;
UnsignedInt gameVersion;
Bool allowObservers;
Bool useStats;
UnsignedShort ladPort;
UnsignedInt ladPassCRC;
Bool restrictGameList;
Expand Down Expand Up @@ -328,6 +329,7 @@ class PeerResponse
Bool isStaging;
Bool requiresPassword;
Bool allowObservers;
Bool useStats;
UnsignedInt version;
UnsignedInt exeCRC;
UnsignedInt iniCRC;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class PSPlayerStats
Int id;
PerGeneralMap wins;
PerGeneralMap losses;
PerGeneralMap games;
PerGeneralMap games; //first: playerTemplate #, second: #games played (see also gamesAsRandom)
PerGeneralMap duration;
PerGeneralMap unitsKilled;
PerGeneralMap unitsLost;
Expand Down
4 changes: 2 additions & 2 deletions Generals/Code/GameEngine/Source/Common/GlobalData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,8 @@ GlobalData* GlobalData::m_theOriginal = NULL;
{ "ObjectPlacementShadows", INI::parseBool, NULL, offsetof( GlobalData, m_objectPlacementShadows ) },

{ "StandardPublicBone", INI::parseAsciiStringVectorAppend, NULL, offsetof(GlobalData, m_standardPublicBones) },
{ "ShowMetrics", INI::parseBool, NULL, offsetof( GlobalData, m_showMetrics ) },
{ "DefaultStartingCash", INI::parseUnsignedInt, NULL, offsetof( GlobalData, m_defaultStartingCash ) },
{ "ShowMetrics", INI::parseBool, NULL, offsetof( GlobalData, m_showMetrics ) },
{ "DefaultStartingCash", Money::parseMoneyAmount, NULL, offsetof( GlobalData, m_defaultStartingCash ) },

// NOTE: m_doubleClickTimeMS is still in use, but we disallow setting it from the GameData.ini file. It is now set in the constructor according to the windows parameter.
// { "DoubleClickTimeMS", INI::parseUnsignedInt, NULL, offsetof( GlobalData, m_doubleClickTimeMS ) },
Expand Down
12 changes: 11 additions & 1 deletion Generals/Code/GameEngine/Source/Common/RTS/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
#include "GameLogic/Module/BattlePlanUpdate.h"
#include "GameLogic/VictoryConditions.h"

#include "GameNetwork/GameInfo.h"


//Grey for neutral.
Expand Down Expand Up @@ -429,7 +430,16 @@ void Player::init(const PlayerTemplate* pt)

if( m_money.countMoney() == 0 )
{
m_money.deposit( TheGlobalData->m_defaultStartingCash, FALSE );
// TheSuperHackers @bugfix Now correctly deposits the money and fixes its audio and academy issues.
// Note that copying the entire Money class instead would also copy the player index inside of it.
if ( TheGameInfo )
{
m_money.deposit( TheGameInfo->getStartingCash().countMoney(), FALSE );
}
else
{
m_money.deposit( TheGlobalData->m_defaultStartingCash.countMoney(), FALSE );
}
}

m_playerDisplayName.clear();
Expand Down
Loading
Loading