diff --git a/Core/GameEngine/CMakeLists.txt b/Core/GameEngine/CMakeLists.txt index 24f2d356c15..714fb61c1f6 100644 --- a/Core/GameEngine/CMakeLists.txt +++ b/Core/GameEngine/CMakeLists.txt @@ -58,7 +58,7 @@ set(GAMEENGINE_SRC Include/Common/GameUtility.h # Include/Common/Geometry.h # Include/Common/GlobalData.h -# Include/Common/Handicap.h + Include/Common/Handicap.h # Include/Common/IgnorePreferences.h Include/Common/INI.h # Include/Common/INIException.h @@ -75,7 +75,7 @@ set(GAMEENGINE_SRC Include/Common/MiniDumper.h Include/Common/MiniLog.h Include/Common/MiscAudio.h -# Include/Common/MissionStats.h + Include/Common/MissionStats.h # Include/Common/ModelState.h # Include/Common/Module.h # Include/Common/ModuleFactory.h @@ -91,7 +91,7 @@ set(GAMEENGINE_SRC # Include/Common/PerfMetrics.h Include/Common/PerfTimer.h # Include/Common/Player.h -# Include/Common/PlayerList.h + Include/Common/PlayerList.h # Include/Common/PlayerTemplate.h # Include/Common/ProductionPrerequisite.h # Include/Common/QuickmatchPreferences.h @@ -102,10 +102,10 @@ set(GAMEENGINE_SRC # Include/Common/Recorder.h # Include/Common/Registry.h Include/Common/ReplaySimulation.h -# Include/Common/ResourceGatheringManager.h -# Include/Common/Science.h + Include/Common/ResourceGatheringManager.h + Include/Common/Science.h # Include/Common/ScopedMutex.h -# Include/Common/ScoreKeeper.h + Include/Common/ScoreKeeper.h #Include/Common/simpleplayer.h # unused # Include/Common/SkirmishBattleHonors.h # Include/Common/SkirmishPreferences.h @@ -625,16 +625,16 @@ set(GAMEENGINE_SRC Source/Common/RTS/AcademyStats.cpp # Source/Common/RTS/ActionManager.cpp # Source/Common/RTS/Energy.cpp -# Source/Common/RTS/Handicap.cpp -# Source/Common/RTS/MissionStats.cpp + Source/Common/RTS/Handicap.cpp + Source/Common/RTS/MissionStats.cpp # Source/Common/RTS/Money.cpp # Source/Common/RTS/Player.cpp -# Source/Common/RTS/PlayerList.cpp + Source/Common/RTS/PlayerList.cpp # Source/Common/RTS/PlayerTemplate.cpp # Source/Common/RTS/ProductionPrerequisite.cpp -# Source/Common/RTS/ResourceGatheringManager.cpp -# Source/Common/RTS/Science.cpp -# Source/Common/RTS/ScoreKeeper.cpp + Source/Common/RTS/ResourceGatheringManager.cpp + Source/Common/RTS/Science.cpp + Source/Common/RTS/ScoreKeeper.cpp # Source/Common/RTS/SpecialPower.cpp # Source/Common/RTS/Team.cpp # Source/Common/RTS/TunnelTracker.cpp diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Handicap.h b/Core/GameEngine/Include/Common/Handicap.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/Common/Handicap.h rename to Core/GameEngine/Include/Common/Handicap.h diff --git a/GeneralsMD/Code/GameEngine/Include/Common/MissionStats.h b/Core/GameEngine/Include/Common/MissionStats.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/Common/MissionStats.h rename to Core/GameEngine/Include/Common/MissionStats.h diff --git a/GeneralsMD/Code/GameEngine/Include/Common/PlayerList.h b/Core/GameEngine/Include/Common/PlayerList.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/Common/PlayerList.h rename to Core/GameEngine/Include/Common/PlayerList.h diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ResourceGatheringManager.h b/Core/GameEngine/Include/Common/ResourceGatheringManager.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/Common/ResourceGatheringManager.h rename to Core/GameEngine/Include/Common/ResourceGatheringManager.h diff --git a/GeneralsMD/Code/GameEngine/Include/Common/Science.h b/Core/GameEngine/Include/Common/Science.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/Common/Science.h rename to Core/GameEngine/Include/Common/Science.h diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ScoreKeeper.h b/Core/GameEngine/Include/Common/ScoreKeeper.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/Common/ScoreKeeper.h rename to Core/GameEngine/Include/Common/ScoreKeeper.h diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Handicap.cpp b/Core/GameEngine/Source/Common/RTS/Handicap.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/Common/RTS/Handicap.cpp rename to Core/GameEngine/Source/Common/RTS/Handicap.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/MissionStats.cpp b/Core/GameEngine/Source/Common/RTS/MissionStats.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/Common/RTS/MissionStats.cpp rename to Core/GameEngine/Source/Common/RTS/MissionStats.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerList.cpp b/Core/GameEngine/Source/Common/RTS/PlayerList.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/Common/RTS/PlayerList.cpp rename to Core/GameEngine/Source/Common/RTS/PlayerList.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp b/Core/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp rename to Core/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp b/Core/GameEngine/Source/Common/RTS/Science.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/Common/RTS/Science.cpp rename to Core/GameEngine/Source/Common/RTS/Science.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp b/Core/GameEngine/Source/Common/RTS/ScoreKeeper.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp rename to Core/GameEngine/Source/Common/RTS/ScoreKeeper.cpp diff --git a/Generals/Code/GameEngine/CMakeLists.txt b/Generals/Code/GameEngine/CMakeLists.txt index e9373cec104..c0b657cd24c 100644 --- a/Generals/Code/GameEngine/CMakeLists.txt +++ b/Generals/Code/GameEngine/CMakeLists.txt @@ -50,7 +50,7 @@ set(GAMEENGINE_SRC # Include/Common/GameType.h Include/Common/Geometry.h Include/Common/GlobalData.h - Include/Common/Handicap.h +# Include/Common/Handicap.h Include/Common/IgnorePreferences.h # Include/Common/INI.h Include/Common/INIException.h @@ -66,7 +66,7 @@ set(GAMEENGINE_SRC # Include/Common/MessageStream.h # Include/Common/MiniLog.h # Include/Common/MiscAudio.h - Include/Common/MissionStats.h +# Include/Common/MissionStats.h Include/Common/ModelState.h Include/Common/Module.h Include/Common/ModuleFactory.h @@ -81,7 +81,7 @@ set(GAMEENGINE_SRC Include/Common/PerfMetrics.h # Include/Common/PerfTimer.h Include/Common/Player.h - Include/Common/PlayerList.h +# Include/Common/PlayerList.h Include/Common/PlayerTemplate.h Include/Common/ProductionPrerequisite.h Include/Common/QuickmatchPreferences.h @@ -92,9 +92,9 @@ set(GAMEENGINE_SRC Include/Common/Recorder.h # Include/Common/ReplaySimulation.h Include/Common/Registry.h - Include/Common/ResourceGatheringManager.h - Include/Common/Science.h - Include/Common/ScoreKeeper.h +# Include/Common/ResourceGatheringManager.h +# Include/Common/Science.h +# Include/Common/ScoreKeeper.h Include/Common/SkirmishBattleHonors.h Include/Common/SkirmishPreferences.h # Include/Common/Snapshot.h @@ -569,16 +569,16 @@ set(GAMEENGINE_SRC Source/Common/Recorder.cpp Source/Common/RTS/ActionManager.cpp Source/Common/RTS/Energy.cpp - Source/Common/RTS/Handicap.cpp - Source/Common/RTS/MissionStats.cpp +# Source/Common/RTS/Handicap.cpp +# Source/Common/RTS/MissionStats.cpp Source/Common/RTS/Money.cpp Source/Common/RTS/Player.cpp - Source/Common/RTS/PlayerList.cpp +# Source/Common/RTS/PlayerList.cpp Source/Common/RTS/PlayerTemplate.cpp Source/Common/RTS/ProductionPrerequisite.cpp - Source/Common/RTS/ResourceGatheringManager.cpp - Source/Common/RTS/Science.cpp - Source/Common/RTS/ScoreKeeper.cpp +# Source/Common/RTS/ResourceGatheringManager.cpp +# Source/Common/RTS/Science.cpp +# Source/Common/RTS/ScoreKeeper.cpp Source/Common/RTS/SpecialPower.cpp Source/Common/RTS/Team.cpp Source/Common/RTS/TunnelTracker.cpp diff --git a/Generals/Code/GameEngine/Include/Common/Handicap.h b/Generals/Code/GameEngine/Include/Common/Handicap.h deleted file mode 100644 index 2ffabc9458e..00000000000 --- a/Generals/Code/GameEngine/Include/Common/Handicap.h +++ /dev/null @@ -1,116 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: Handicap.h //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: Handicap.h -// -// Created: Steven Johnson, October 2001 -// -// Desc: @todo -// -//----------------------------------------------------------------------------- - -#pragma once - -#include "Lib/BaseType.h" - -// ---------------------------------------------------------------------------------------------- -class Object; -class Dict; -class ThingTemplate; - -// ---------------------------------------------------------------------------------------------- -/** - Handicap encapsulates the sets of modifiers to abilities used to balance - the game and give different abilities to different Players. - Conceptually, it's a large set of coefficients (typically, but not necessarily, - in the range of 0.0...1.0). - - Usage example (conceptual): - - Real armorCoef = this->m_handicap->getHandicap(ARMOR, this); - Real actualArmor = this->getArmorValue() * armorCoef; -*/ -class Handicap -{ -public: - - // NOTE: if you ever add/remove/change the enums in HandicapType, - // you must also modify initFromDict()! - enum HandicapType - { - BUILDCOST, - BUILDTIME, - - HANDICAP_TYPE_COUNT - }; - - Handicap(); - - /// reset all handicaps to a default value. - void init(); - - /** - initialize from the fields in the Dict. Note that this does NOT call init() - internally, so only those fields that are present in the dict will be set. - if you want to ensure all fields are something reasonable, you should call init() - prior to calling this. - */ - void readFromDict(const Dict* d); - - /** - return the multiplier for the given Handicap type on the given Object. - The Object's type (unit, building, etc.) will generally be examined - to determine what value to return. - */ - Real getHandicap(HandicapType t, const ThingTemplate *tmpl) const; - -protected: -private: - - // NOTE: if you ever add/remove/change the enums in ThingType, - // you must also modify initFromDict()! - enum ThingType - { - GENERIC, // if a thing is nothing else, it's generic. - BUILDINGS, - - THING_TYPE_COUNT - }; - - Real m_handicaps[HANDICAP_TYPE_COUNT][THING_TYPE_COUNT]; - - static ThingType getBestThingType(const ThingTemplate *tmpl); -}; diff --git a/Generals/Code/GameEngine/Include/Common/MissionStats.h b/Generals/Code/GameEngine/Include/Common/MissionStats.h deleted file mode 100644 index 711e2de5104..00000000000 --- a/Generals/Code/GameEngine/Include/Common/MissionStats.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: MissionStats.h //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: MissionStats.h -// -// Created: Steven Johnson, October 2001 -// -// Desc: @todo -// -//----------------------------------------------------------------------------- - -#pragma once - -#include "Lib/BaseType.h" -#include "Common/GameCommon.h" -#include "Common/Snapshot.h" - -// ---------------------------------------------------------------------------------------------- -/** - Class that accumulates stats during a mission. Some of this will be for scoring purposes, - and some will probably be used by AI to determine future moves. - - @todo: not sure what need to be here. Alas. For now, I have just put in the fields from RA2 - that are indicated as being used for scoring in multiplayer games, so this will certainly - increase. -*/ -class MissionStats : public Snapshot -{ - -public: - - MissionStats(); - - /// reset all stats to "nothing". - void init(); - -protected: - - // snapshot methods - virtual void crc( Xfer *xfer ) override; - virtual void xfer( Xfer *xfer ) override; - virtual void loadPostProcess() override; - -private: - - Int m_unitsKilled[MAX_PLAYER_COUNT]; ///< how many units for each Player were killed by us? - Int m_unitsLost; ///< how many of our units were destroyed? - Int m_buildingsKilled[MAX_PLAYER_COUNT]; ///< how many buildings for each Player were killed by us? - Int m_buildingsLost; ///< how many of our buildings were destroyed? - //Int m_whoLastHurtMe; ///< last Player to destroy one of my units -}; diff --git a/Generals/Code/GameEngine/Include/Common/PlayerList.h b/Generals/Code/GameEngine/Include/Common/PlayerList.h deleted file mode 100644 index 0aed0b24f2b..00000000000 --- a/Generals/Code/GameEngine/Include/Common/PlayerList.h +++ /dev/null @@ -1,176 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: PlayerList.h //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: PlayerList.h -// -// Created: Steven Johnson, October 2001 -// -// Desc: @todo -// -//----------------------------------------------------------------------------- - -#pragma once - -#include "Common/SubsystemInterface.h" -#include "Common/GameCommon.h" -#include "Common/NameKeyGenerator.h" -#include "Common/Snapshot.h" - -class DataChunkInput; -struct DataChunkInfo; -class DataChunkOutput; -class GameInfo; -class Player; -class Team; -class TeamFactory; - -//------------------------------------------------------------------------------------------------- -enum AllowPlayerRelationship CPP_11(: Int) -{ - ALLOW_SAME_PLAYER = 0x01, ///< allow only objects of the same player as m_obj - ALLOW_ALLIES = 0x02, ///< allow objects that m_obj considers allies - ALLOW_ENEMIES = 0x04, ///< allow objects that m_obj considers enemy - ALLOW_NEUTRAL = 0x08 ///< allow objects that m_obj considers neutral -}; - - -//------------------------------------------------------------------------------------------------- -/** - This is a singleton class that maintains the list of Players. -*/ -class PlayerList : public SubsystemInterface, - public Snapshot -{ - -public: - - PlayerList(); - virtual ~PlayerList() override; - - // subsystem methods - virtual void init() override; - virtual void reset() override; - virtual void update() override; - - virtual void newGame(); // called during GameLogic::startNewGame() - virtual void newMap(); // Called after a new map is loaded. - - void teamAboutToBeDeleted(Team* team); - - /** - return the total number of players (including the neutral player). - */ - inline Int getPlayerCount() { return m_playerCount; } - - /** - return the nth player. Note that players are in an arbitrary order. - you should generally only use this if you want to iterate thru - all players, NOT to get a specific player! - */ - Player *getNthPlayer(Int i); - - /** - return the "neutral" Player. there is always a player that is "neutral" wrt - all other players (this is so that everything can be associated with a nonnull - Player, to simplify the universe). This will never return null. - */ - Player *getNeutralPlayer() { DEBUG_ASSERTCRASH(m_players[0] != nullptr, ("null neutral")); return m_players[0]; } - - /** - return the Player with the given internal name, or null if none found. - */ - Player *findPlayerWithNameKey(NameKeyType key); - - /** - Return the "local" player (ie, the human playing the game). - This will never return null. - */ - inline Player *getLocalPlayer() { DEBUG_ASSERTCRASH(m_local != nullptr, ("null m_local")); return m_local; } - - /** - Set the local player. You cannot set it to null; if you pass null, you'll - end up setting the local player to be the neutral player. - */ - void setLocalPlayer(Player *player); - - /** - Return the player matching the player mask - */ - Player *getPlayerFromMask( PlayerMaskType mask ); - - /** - Get each player in numerical order that this mask represents. - Note that maskToAdjust will be adjusted by removing the associated player's mask from it. - */ - Player *getEachPlayerFromMask( PlayerMaskType& maskToAdjust ); - - Team *validateTeam( AsciiString owner ); - - /** - a convenience routine to quickly clear the entered/exited flags on all teams. - */ - void updateTeamStates(); - - /** - a convenience routine to return the players who srcPlayer considers to have one of the - relationships specified in allowedRelationships. Note that allowedRelationships should be - a bitwise OR of AllowPlayerRelationship flags. - */ - PlayerMaskType getPlayersWithRelationship( Int srcPlayerIndex, UnsignedInt allowedRelationships ); - - Int getSlotIndex(Int playerIndex) const; - -protected: - - // snapshot methods - virtual void crc( Xfer *xfer ) override; - virtual void xfer( Xfer *xfer ) override; - virtual void loadPostProcess() override; - -private: - void assignSlotIndices(const GameInfo& gameInfo); - void setSlotIndex(Int playerIndex, Int slotIndex); - - Player *m_local; - Int m_playerCount; - Player *m_players[MAX_PLAYER_COUNT]; - Int m_slotIndices[MAX_PLAYER_COUNT]; - -}; - - -// ---------------------------------------------------------------------------------------------- -extern PlayerList *ThePlayerList; ///< singleton instance of PlayerList diff --git a/Generals/Code/GameEngine/Include/Common/ResourceGatheringManager.h b/Generals/Code/GameEngine/Include/Common/ResourceGatheringManager.h deleted file mode 100644 index 5fb0aeba684..00000000000 --- a/Generals/Code/GameEngine/Include/Common/ResourceGatheringManager.h +++ /dev/null @@ -1,71 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ResourceGatheringManager.h /////////////////////////////////////////////////////////// -// The part of a Player's brain that keeps track of all Resource type Objects and makes -// gathering type decisions based on them. -// Author: Graham Smallwood, January, 2002 -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "Common/GameType.h" -#include "Common/Snapshot.h" - -class Object; - -// ------------------------------------------------------------------------------------------------ -class ResourceGatheringManager : public MemoryPoolObject, - public Snapshot -{ - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( ResourceGatheringManager, "ResourceGatheringManager" ); - -public: - ResourceGatheringManager(); - - Object *findBestSupplyWarehouse( Object *queryObject ); ///< What Warehouse should this truck go to? - Object *findBestSupplyCenter( Object *queryObject ); ///< What Center should this truck return to? - - void addSupplyCenter( Object *newCenter ); ///< I captured or built a Supply Center, so record it - void removeSupplyCenter( Object *oldCenter ); ///< Lost a supply center - - void addSupplyWarehouse( Object *newWarehouse ); ///< Warehouse created, or this is start of game recording - void removeSupplyWarehouse( Object *oldWarehouse ); ///< Warehouse that doesn't replenish has run out of Supply - -protected: - - // snapshot methods - virtual void crc( Xfer *xfer ) override; - virtual void xfer( Xfer *xfer ) override; - virtual void loadPostProcess() override; - -private: - /// @todo Make sure the allocator for std::list<> is a good one. Otherwise override it. - typedef std::list objectIDList; - typedef std::list::iterator objectIDListIterator; - - objectIDList m_supplyWarehouses; - objectIDList m_supplyCenters; - -}; diff --git a/Generals/Code/GameEngine/Include/Common/Science.h b/Generals/Code/GameEngine/Include/Common/Science.h deleted file mode 100644 index ac1f6014f97..00000000000 --- a/Generals/Code/GameEngine/Include/Common/Science.h +++ /dev/null @@ -1,133 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: Science.h //////////////////////////////////////////////////////////////////////////////// -// Author: Steven Johnson, Colin Day November 2001 -// Desc: Science descriptions -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "Common/Overridable.h" -#include "Common/NameKeyGenerator.h" -#include "Common/UnicodeString.h" - -class Player; - -//------------------------------------------------------------------------------------------------- -enum ScienceType CPP_11(: Int) -{ - SCIENCE_INVALID = -1 -}; - -//------------------------------------------------------------------------------------------------- -typedef std::vector ScienceVec; - -//------------------------------------------------------------------------------------------------- -class ScienceInfo : public Overridable -{ - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( ScienceInfo, "ScienceInfo" ) - - friend class ScienceStore; - -private: - ScienceType m_science; - UnicodeString m_name; - UnicodeString m_description; - ScienceVec m_rootSciences; // this is calced at runtime, NOT read from INI - ScienceVec m_prereqSciences; - Int m_sciencePurchasePointCost; - Bool m_grantable; - - ScienceInfo() : - m_science(SCIENCE_INVALID), - m_sciencePurchasePointCost(0), // 0 means "cannot be purchased" - m_grantable(true) - { - } - - void addRootSciences(ScienceVec& v) const; -}; -EMPTY_DTOR(ScienceInfo); - -//------------------------------------------------------------------------------------------------- -class ScienceStore : public SubsystemInterface -{ - friend class ScienceInfo; - -public: - virtual ~ScienceStore() override; - - virtual void init() override; - virtual void reset() override; - virtual void update() override { } - - Bool isValidScience(ScienceType st) const; - - Bool isScienceGrantable(ScienceType st) const; - - Bool getNameAndDescription(ScienceType st, UnicodeString& name, UnicodeString& description) const; - - Bool playerHasPrereqsForScience(const Player* player, ScienceType st) const; - - /** - this is a subtle call, and should ALMOST NEVER be called by external code... - this is used to determine if you have the "root" requirements for a given science, - and thus could *potentially* obtain it if you got extra prereqs. - - Generally, you should call getPurchasableSciences() instead of this! - */ - Bool playerHasRootPrereqsForScience(const Player* player, ScienceType st) const; - - Int getSciencePurchaseCost(ScienceType science) const; - - ScienceType getScienceFromInternalName(const AsciiString& name) const; - AsciiString getInternalNameForScience(ScienceType science) const; - - /** return a list of the sciences the given player can purchase now, and a list he might be able to purchase in the future, - but currently lacks prereqs or points for. (either might be an empty list) */ - void getPurchasableSciences(const Player* player, ScienceVec& purchasable, ScienceVec& potentiallyPurchasable) const; - - // this is intended ONLY for use by INI::scanScience. - // Don't use it anywhere else. In particular, never, ever, ever - // call this with a hardcoded science name. (srj) - ScienceType friend_lookupScience(const char* scienceName) const; - static void friend_parseScienceDefinition(INI* ini); - - // return a vector of all the currently-known science names - // NOTE: this is really only for use by WorldBuilder! Please - // do not use it in RTS! - std::vector friend_getScienceNames() const; - - -private: - - const ScienceInfo* findScienceInfo(ScienceType st) const; - - typedef std::vector ScienceInfoVec; - ScienceInfoVec m_sciences; -}; - -extern ScienceStore* TheScienceStore; diff --git a/Generals/Code/GameEngine/Include/Common/ScoreKeeper.h b/Generals/Code/GameEngine/Include/Common/ScoreKeeper.h deleted file mode 100644 index 3f01a0f511c..00000000000 --- a/Generals/Code/GameEngine/Include/Common/ScoreKeeper.h +++ /dev/null @@ -1,140 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ScoreKeeper.h ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Jun 2002 -// -// Filename: ScoreKeeper.h -// -// author: Chris Huybregts -// -// purpose: Header file for the scorekeeper class -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "Common/Snapshot.h" - -//----------------------------------------------------------------------------- -// FORWARD REFERENCES ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -class Object; -class ThingTemplate; -//----------------------------------------------------------------------------- -// TYPE DEFINES /////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -class ScoreKeeper : public Snapshot -{ -public: - ScoreKeeper(); - ~ScoreKeeper(); - - void reset( Int playerIdx ); ///< Zero out the variables - Int calculateScore(); ///< Performs the equation to calculate the score - - void addMoneySpent( Int money ); ///< Adds money to the amount spent - void addMoneyEarned( Int money ); ///< Adds money to the earned amount - - void addObjectBuilt( const Object *o ); - void addObjectDestroyed( const Object *o ); - void addObjectLost( const Object *o ); - void addObjectCaptured( const Object *o ); - - void removeObjectBuilt( const Object *o ); - - Int getTotalMoneyEarned() { return m_totalMoneyEarned; } - Int getTotalMoneySpent() { return m_totalMoneySpent; } - Int getTotalUnitsDestroyed(); - Int getTotalUnitsBuilt() { return m_totalUnitsBuilt; } - Int getTotalUnitsLost() { return m_totalUnitsLost; } - Int getTotalBuildingsDestroyed(); - Int getTotalBuildingsBuilt() { return m_totalBuildingsBuilt; } - Int getTotalBuildingsLost() { return m_totalBuildingsLost; } - Int getTotalTechBuildingsCaptured() { return m_totalTechBuildingsCaptured; } - Int getTotalFactionBuildingsCaptured() { return m_totalFactionBuildingsCaptured; } - Int getTotalObjectsBuilt( const ThingTemplate *pTemplate ); // get a count of objects built matching a specific thing template - - // for battle honor calculation. done once at the end of each online game - Int getTotalUnitsBuilt( KindOfMaskType validMask, KindOfMaskType invalidMask ); - -protected: - - // snapshot methods - virtual void crc( Xfer *xfer ) override; - virtual void xfer( Xfer *xfer ) override; - virtual void loadPostProcess() override; - -private: - - Int m_totalMoneyEarned; ///< The total money that was harvested, refined, received in crates - Int m_totalMoneySpent; ///< The total money spent on units, buildings, repairs - Int m_totalUnitsDestroyed[MAX_PLAYER_COUNT]; ///< The total number of enemies that we've killed - Int m_totalUnitsBuilt; ///< The total number of units we've created (created meaning that we built from a building) - Int m_totalUnitsLost; ///< The total number of our units lost - Int m_totalBuildingsDestroyed[MAX_PLAYER_COUNT]; ///< The total number of Buildings we've destroyed - Int m_totalBuildingsBuilt; ///< The total number of buildings we've constructed - Int m_totalBuildingsLost; ///< The total number of our buildings lost - Int m_totalTechBuildingsCaptured; ///< The total number of tech buildings captured - Int m_totalFactionBuildingsCaptured; ///< The total number of faction buildings captured - Int m_currentScore; ///< Based off the stats, this is the current score - - Int m_myPlayerIdx; ///< We need to not score kills on ourselves... so we need to know who we are - - typedef std::map ObjectCountMap; - typedef ObjectCountMap::iterator ObjectCountMapIt; - ObjectCountMap m_objectsBuilt; ///< How many and what kinds of objects did we build - ObjectCountMap m_objectsDestroyed[MAX_PLAYER_COUNT]; ///< How many and what kinds and who's did we kill - ObjectCountMap m_objectsLost; ///< how many and what kinds of objects did we loose - ObjectCountMap m_objectsCaptured; - void xferObjectCountMap( Xfer *xfer, ObjectCountMap *map ); - -}; - -//----------------------------------------------------------------------------- -// INLINING /////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -inline void ScoreKeeper::addMoneySpent( Int money ) { m_totalMoneySpent += money; } -inline void ScoreKeeper::addMoneyEarned( Int money ) { m_totalMoneyEarned += money; } - -//----------------------------------------------------------------------------- -// EXTERNALS ////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Handicap.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Handicap.cpp deleted file mode 100644 index 85420402741..00000000000 --- a/Generals/Code/GameEngine/Source/Common/RTS/Handicap.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: Handicap.cpp ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: Handicap.cpp -// -// Created: Steven Johnson, October 2001 -// -// Desc: @todo -// -//----------------------------------------------------------------------------- - -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/Handicap.h" -#include "Common/Player.h" -#include "Common/Dict.h" -#include "Common/ThingTemplate.h" - -//----------------------------------------------------------------------------- -Handicap::Handicap() -{ - init(); -} - -//----------------------------------------------------------------------------- -void Handicap::init() -{ - for (Int i = 0; i < HANDICAP_TYPE_COUNT; ++i) - for (Int j = 0; j < THING_TYPE_COUNT; ++j) - m_handicaps[i][j] = 1.0f; -} - -//----------------------------------------------------------------------------- -void Handicap::readFromDict(const Dict* d) -{ - // this isn't very efficient, but is only called at load times, - // so it probably doesn't really matter. - - const char* htNames[HANDICAP_TYPE_COUNT] = - { - "BUILDCOST", - "BUILDTIME", -// "FIREPOWER", -// "ARMOR", -// "GROUNDSPEED", -// "AIRSPEED", -// "INCOME" - }; - - const char* ttNames[THING_TYPE_COUNT] = - { - "GENERIC", - "BUILDINGS", - }; - -// no, you should NOT call init() here. -//init(); - - AsciiString c; - for (Int i = 0; i < HANDICAP_TYPE_COUNT; ++i) - { - for (Int j = 0; j < THING_TYPE_COUNT; ++j) - { - c.clear(); - c.set("HANDICAP_"); - c.concat(htNames[i]); - c.concat("_"); - c.concat(ttNames[j]); - NameKeyType k = TheNameKeyGenerator->nameToKey(c); - Bool exists; - Real r = d->getReal(k, &exists); - if (exists) - m_handicaps[i][j] = r; - } - } -} - -//----------------------------------------------------------------------------- -/*static*/ Handicap::ThingType Handicap::getBestThingType(const ThingTemplate *tmpl) -{ - /// if this ends up being too slow, cache the information in the object - if (tmpl->isKindOf(KINDOF_STRUCTURE)) - return BUILDINGS; - - return GENERIC; -} - -//----------------------------------------------------------------------------- -Real Handicap::getHandicap(HandicapType ht, const ThingTemplate *tmpl) const -{ - ThingType tt = getBestThingType(tmpl); - return m_handicaps[ht][tt]; -} diff --git a/Generals/Code/GameEngine/Source/Common/RTS/MissionStats.cpp b/Generals/Code/GameEngine/Source/Common/RTS/MissionStats.cpp deleted file mode 100644 index 16047cfefd2..00000000000 --- a/Generals/Code/GameEngine/Source/Common/RTS/MissionStats.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: MissionStats.cpp ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: MissionStats.cpp -// -// Created: Steven Johnson, October 2001 -// -// Desc: @todo -// -//----------------------------------------------------------------------------- - -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/MissionStats.h" -#include "Common/Player.h" -#include "Common/Xfer.h" - -//----------------------------------------------------------------------------- -MissionStats::MissionStats() -{ - init(); -} - -//----------------------------------------------------------------------------- -void MissionStats::init() -{ - Int i; - - for (i = 0; i < MAX_PLAYER_COUNT; ++i) - { - m_unitsKilled[i] = 0; - m_buildingsKilled[i] = 0; - } - m_unitsLost = 0; - m_buildingsLost = 0; - //m_whoLastHurtMe = PLAYER_NONE; -} - -// ------------------------------------------------------------------------------------------------ -/** CRC */ -// ------------------------------------------------------------------------------------------------ -void MissionStats::crc( Xfer *xfer ) -{ - -} - -// ------------------------------------------------------------------------------------------------ -/** Xfer method - * Version Info; - * 1: Initial version */ -// ------------------------------------------------------------------------------------------------ -void MissionStats::xfer( Xfer *xfer ) -{ - - // version - XferVersion currentVersion = 1; - XferVersion version = currentVersion; - xfer->xferVersion( &version, currentVersion ); - - // units killed - xfer->xferUser( m_unitsKilled, sizeof( Int ) * MAX_PLAYER_COUNT ); - - // units lost - xfer->xferInt( &m_unitsLost ); - - // buildings killed - xfer->xferUser( m_buildingsKilled, sizeof( Int ) * MAX_PLAYER_COUNT ); - - // buildings lost - xfer->xferInt( &m_buildingsLost ); - -} - -// ------------------------------------------------------------------------------------------------ -/** Load post process */ -// ------------------------------------------------------------------------------------------------ -void MissionStats::loadPostProcess() -{ - -} diff --git a/Generals/Code/GameEngine/Source/Common/RTS/PlayerList.cpp b/Generals/Code/GameEngine/Source/Common/RTS/PlayerList.cpp deleted file mode 100644 index 17dc7187f67..00000000000 --- a/Generals/Code/GameEngine/Source/Common/RTS/PlayerList.cpp +++ /dev/null @@ -1,528 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: PlayerList.cpp ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: PlayerList.cpp -// -// Created: Steven Johnson, October 2001 -// -// Desc: @todo -// -//----------------------------------------------------------------------------- - -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/Errors.h" -#include "Common/DataChunk.h" -#include "Common/GameState.h" -#include "Common/GlobalData.h" -#include "Common/Player.h" -#include "Common/PlayerList.h" -#include "Common/PlayerTemplate.h" -#include "Common/Team.h" -#include "Common/WellKnownKeys.h" -#include "Common/Xfer.h" -#ifdef RTS_DEBUG -#include "GameLogic/Object.h" -#endif -#include "GameLogic/SidesList.h" -#include "GameNetwork/GameInfo.h" -#include "GameNetwork/NetworkDefs.h" - -//----------------------------------------------------------------------------- -/*extern*/ PlayerList *ThePlayerList = nullptr; - -//----------------------------------------------------------------------------- -PlayerList::PlayerList() : - m_local(nullptr), - m_playerCount(0) -{ - // we only allocate a few of these, so don't bother pooling 'em - for (Int i = 0; i < MAX_PLAYER_COUNT; i++) - m_players[ i ] = NEW Player( i ); - init(); -} - -//----------------------------------------------------------------------------- -PlayerList::~PlayerList() -{ - // the world is happier if we reinit things before destroying them, - // to avoid debug warnings - init(); - - for( Int i = 0; i < MAX_PLAYER_COUNT; ++i ) - delete m_players[ i ]; -} - -//----------------------------------------------------------------------------- -Player *PlayerList::getNthPlayer(Int i) -{ - if( i < 0 || i >= MAX_PLAYER_COUNT ) - { -// DEBUG_CRASH( ("Illegal player index") ); - return nullptr; - } - return m_players[i]; -} - -//----------------------------------------------------------------------------- -Player *PlayerList::findPlayerWithNameKey(NameKeyType key) -{ - for (Int i = 0; i < m_playerCount; i++) - { - if (m_players[i]->getPlayerNameKey() == key) - { - return m_players[i]; - } - } - return nullptr; -} - -//----------------------------------------------------------------------------- -void PlayerList::reset() -{ - // TheSuperHackers @bugfix xezon 20/03/2025 Delete the Player AI before purging the dependent teams in the factory. - for (int i = 0; i < MAX_PLAYER_COUNT; i++) - m_players[i]->deletePlayerAI(); - - TheTeamFactory->clear(); // cleans up energy, among other things - init(); -} - -//----------------------------------------------------------------------------- -void PlayerList::newGame() -{ - Int i; - - DEBUG_ASSERTCRASH(this != nullptr, ("null this")); - - reset(); - - // ok, now create the rest of players we need. - Bool setLocal = false; - for( i = 0; i < TheSidesList->getNumSides(); i++) - { - Dict *d = TheSidesList->getSideInfo(i)->getDict(); - AsciiString pname = d->getAsciiString(TheKey_playerName); - if (pname.isEmpty()) - continue; // it's neutral, which we've already done, so skip it. - - /// @todo The Player class should have a reset() method, instead of directly calling initFromDict() (MSB) - Player* p = m_players[m_playerCount++]; - p->initFromDict(d); - - // Multiplayer override - Bool exists; // throwaway, since we don't care if it exists - if (d->getBool(TheKey_multiplayerIsLocal, &exists)) - { - DEBUG_LOG(("Player %s is multiplayer local", pname.str())); - setLocalPlayer(p); - setLocal = true; - } - - if (!setLocal && !TheNetwork && d->getBool(TheKey_playerIsHuman)) - { - setLocalPlayer(p); - setLocal = true; - } - - // Set the build list. - p->setBuildList(TheSidesList->getSideInfo(i)->getBuildList()); - // Build list is attached to player now, so release it from the side info. - TheSidesList->getSideInfo(i)->releaseBuildList(); - } - - if (!setLocal) - { - DEBUG_ASSERTCRASH(TheNetwork, ("*** Map has no human player... picking first nonneutral player for control")); - for( i = 0; i < TheSidesList->getNumSides(); i++) - { - Player* p = getNthPlayer(i); - if (p != getNeutralPlayer()) - { - p->setPlayerType(PLAYER_HUMAN, false); - setLocalPlayer(p); - setLocal = true; - break; - } - } - } - - // must reset teams *after* creating players. - TheTeamFactory->initFromSides(TheSidesList); - - for( i = 0; i < TheSidesList->getNumSides(); i++) - { - Dict *d = TheSidesList->getSideInfo(i)->getDict(); - Player* p = findPlayerWithNameKey(NAMEKEY(d->getAsciiString(TheKey_playerName))); - - AsciiString tok; - - AsciiString enemies = d->getAsciiString(TheKey_playerEnemies); - while (enemies.nextToken(&tok)) - { - Player *p2 = findPlayerWithNameKey(NAMEKEY(tok)); - if (p2) - { - p->setPlayerRelationship(p2, ENEMIES); - } - else - { - DEBUG_LOG(("unknown enemy %s",tok.str())); - } - } - - AsciiString allies = d->getAsciiString(TheKey_playerAllies); - while (allies.nextToken(&tok)) - { - Player *p2 = findPlayerWithNameKey(NAMEKEY(tok)); - if (p2) - { - p->setPlayerRelationship(p2, ALLIES); - } - else - { - DEBUG_LOG(("unknown ally %s",tok.str())); - } - } - - // finally, make sure self & neutral are correct. - p->setPlayerRelationship(p, ALLIES); - if (p != getNeutralPlayer()) - p->setPlayerRelationship(getNeutralPlayer(), NEUTRAL); - - p->setDefaultTeam(); - } - - if (TheGameInfo) - { - assignSlotIndices(*TheGameInfo); - } -} - -//----------------------------------------------------------------------------- -void PlayerList::init() -{ - m_playerCount = 1; - m_players[0]->init(nullptr); - - for (int i = 1; i < MAX_PLAYER_COUNT; i++) - m_players[i]->init(nullptr); - - std::fill(m_slotIndices, m_slotIndices + ARRAY_SIZE(m_slotIndices), -1); - - // call setLocalPlayer so that becomingLocalPlayer() gets called appropriately - setLocalPlayer(m_players[0]); - -} - -//----------------------------------------------------------------------------- -void PlayerList::update() -{ - // update all players - for( Int i = 0; i < MAX_PLAYER_COUNT; i++ ) - { - m_players[i]->update(); - } - -} - -//----------------------------------------------------------------------------- -void PlayerList::newMap() -{ - // update all players - for( Int i = 0; i < MAX_PLAYER_COUNT; i++ ) - { - m_players[i]->newMap(); - } - -} - -// ------------------------------------------------------------------------ -void PlayerList::teamAboutToBeDeleted(Team* team) -{ - for( Int i = 0; i < MAX_PLAYER_COUNT; i++ ) - { - m_players[i]->removeTeamRelationship(team); - } -} - -//============================================================================= -void PlayerList::updateTeamStates() -{ - // Clear team flags for all players. - for( Int i = 0; i < MAX_PLAYER_COUNT; i++ ) - { - m_players[i]->updateTeamStates(); - } -} - -//----------------------------------------------------------------------------- -Team *PlayerList::validateTeam( AsciiString owner ) -{ - // owner could be a player or team. first, check team names. - Team *t = TheTeamFactory->findTeam(owner); - if (t) - { - //DEBUG_LOG(("assigned obj %08lx to team %s",obj,owner.str())); - } - else - { - DEBUG_CRASH(("no team or player named %s could be found!", owner.str())); - t = getNeutralPlayer()->getDefaultTeam(); - } - return t; -} - -//----------------------------------------------------------------------------- -void PlayerList::setLocalPlayer(Player *player) -{ - // can't set local player to null -- if you try, you get neutral. - if (player == nullptr) - { - DEBUG_CRASH(("local player may not be null")); - player = getNeutralPlayer(); - } - - if (player != m_local) - { - // m_local can be null the very first time we call this. - if (m_local) - m_local->becomingLocalPlayer(false); - m_local = player; - player->becomingLocalPlayer(true); - } - -#ifdef INTENSE_DEBUG - if (player) - { - // did you know? you can use "%ls" to print a doublebyte string, even in a single-byte printf... - DEBUG_LOG(("Switching local players. The new player is named '%ls' (%s) and owns the following objects:", - player->getPlayerDisplayName().str(), - TheNameKeyGenerator->keyToName(player->getPlayerNameKey()).str() - )); - for (Object *obj = player->getFirstOwnedObject(); obj; obj = obj->getNextOwnedObject()) - { - DEBUG_LOG_RAW(("Obj %08lx is of type %s",obj,obj->getTemplate()->getName().str())); - if (!player->canBuild(obj->getTemplate())) - { - DEBUG_LOG_RAW((" (NOT BUILDABLE)")); - } - DEBUG_LOG_RAW(("\n")); - } - } -#endif - -} - -//----------------------------------------------------------------------------- -Player *PlayerList::getPlayerFromMask( PlayerMaskType mask ) -{ - Player *player = nullptr; - Int i; - - for( i = 0; i < MAX_PLAYER_COUNT; i++ ) - { - - player = getNthPlayer( i ); - if( player && player->getPlayerMask() == mask ) - return player; - - } - - DEBUG_CRASH( ("Player does not exist for mask") ); - return nullptr; // mask not found - -} - -//----------------------------------------------------------------------------- -Player *PlayerList::getEachPlayerFromMask( PlayerMaskType& maskToAdjust ) -{ - Player *player = nullptr; - Int i; - - for( i = 0; i < MAX_PLAYER_COUNT; i++ ) - { - - player = getNthPlayer( i ); - if ( player && BitIsSet(player->getPlayerMask(), maskToAdjust )) - { - maskToAdjust &= (~player->getPlayerMask()); - return player; - } - } - - DEBUG_CRASH( ("No players found that contain any matching masks.") ); - maskToAdjust = 0; - return nullptr; // mask not found -} - -//------------------------------------------------------------------------------------------------- -PlayerMaskType PlayerList::getPlayersWithRelationship( Int srcPlayerIndex, UnsignedInt allowedRelationships ) -{ - PlayerMaskType retVal = 0; - - if (allowedRelationships == 0) - return retVal; - - Player *srcPlayer = getNthPlayer(srcPlayerIndex); - if (!srcPlayer) - return retVal; - - if (BitIsSet(allowedRelationships, ALLOW_SAME_PLAYER)) - BitSet(retVal, srcPlayer->getPlayerMask()); - - for ( Int i = 0; i < getPlayerCount(); ++i ) - { - Player *player = getNthPlayer(i); - if (!player) - continue; - - if (player == srcPlayer) - continue; - - switch (srcPlayer->getRelationship(player->getDefaultTeam())) - { - case ENEMIES: - if (BitIsSet(allowedRelationships, ALLOW_ENEMIES)) - BitSet(retVal, player->getPlayerMask()); - break; - case ALLIES: - if (BitIsSet(allowedRelationships, ALLOW_ALLIES)) - BitSet(retVal, player->getPlayerMask()); - break; - case NEUTRAL: - if (BitIsSet(allowedRelationships, ALLOW_NEUTRAL)) - BitSet(retVal, player->getPlayerMask()); - break; - } - } - - return retVal; -} - -// ------------------------------------------------------------------------------------------------ -/** CRC */ -// ------------------------------------------------------------------------------------------------ -void PlayerList::crc( Xfer *xfer ) -{ - xfer->xferInt( &m_playerCount ); - - for( Int i = 0; i < m_playerCount; ++i ) - xfer->xferSnapshot( m_players[ i ] ); -} - -// ------------------------------------------------------------------------------------------------ -/** Xfer Method - * Version Info: - * 1: Initial version */ -// ------------------------------------------------------------------------------------------------ -void PlayerList::xfer( Xfer *xfer ) -{ - - // version - XferVersion currentVersion = 1; - XferVersion version = currentVersion; - xfer->xferVersion( &version, currentVersion ); - - // xfer the player count - Int playerCount = m_playerCount; - xfer->xferInt( &playerCount ); - - // - // sanity, the player count read from the file should match our player count that - // was setup from the bare bones map load since that data can't change during run time - // - if( playerCount != m_playerCount ) - { - - DEBUG_CRASH(( "Invalid player count '%d', should be '%d'", playerCount, m_playerCount )); - throw SC_INVALID_DATA; - - } - - // xfer each of the player data - for( Int i = 0; i < playerCount; ++i ) - xfer->xferSnapshot( m_players[ i ] ); - -} - -// ------------------------------------------------------------------------------------------------ -/** Load post process */ -// ------------------------------------------------------------------------------------------------ -void PlayerList::loadPostProcess() -{ - -} - -//----------------------------------------------------------------------------- -void PlayerList::setSlotIndex(Int playerIndex, Int slotIndex) -{ - if (playerIndex >= 0 && playerIndex < ARRAY_SIZE(m_slotIndices)) - { - m_slotIndices[playerIndex] = slotIndex; - } -} - -//----------------------------------------------------------------------------- -Int PlayerList::getSlotIndex(Int playerIndex) const -{ - if (playerIndex >= 0 && playerIndex < ARRAY_SIZE(m_slotIndices)) - { - return m_slotIndices[playerIndex]; - } - - return -1; -} - -//----------------------------------------------------------------------------- -void PlayerList::assignSlotIndices(const GameInfo& gameInfo) -{ - AsciiString playerName; - - for (Int i = 0; i < MAX_SLOTS; ++i) - { - const GameSlot* slot = gameInfo.getConstSlot(i); - if (!slot || !slot->isOccupied()) - continue; - - playerName.format("player%d", i); - - if (Player* player = findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(playerName))) - { - setSlotIndex(player->getPlayerIndex(), i); - } - } -} diff --git a/Generals/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp b/Generals/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp deleted file mode 100644 index 26b2b16608a..00000000000 --- a/Generals/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp +++ /dev/null @@ -1,291 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ResourceGatheringManager.cpp /////////////////////////////////////////////////////////// -// The part of a Player's brain that keeps track of all Resource type Objects and makes -// gathering type decisions based on them. -// Author: Graham Smallwood, January, 2002 - -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/ResourceGatheringManager.h" - -#include "Common/ActionManager.h" -#include "Common/Xfer.h" -#include "GameLogic/GameLogic.h" -#include "GameLogic/Object.h" -#include "GameLogic/PartitionManager.h" -#include "GameLogic/Module/SupplyTruckAIUpdate.h" -#include "GameLogic/Module/SupplyCenterDockUpdate.h" -#include "GameLogic/Module/SupplyWarehouseDockUpdate.h" -#include "GameLogic/Module/UpdateModule.h" - -ResourceGatheringManager::ResourceGatheringManager() -{ -} - -ResourceGatheringManager::~ResourceGatheringManager() -{ - m_supplyWarehouses.erase( m_supplyWarehouses.begin(), m_supplyWarehouses.end() ); - m_supplyCenters.erase( m_supplyCenters.begin(), m_supplyCenters.end() ); -} - -void ResourceGatheringManager::addSupplyCenter( Object *newCenter ) -{ - if( newCenter == nullptr ) - return; - - m_supplyCenters.push_back( newCenter->getID() ); -} - -void ResourceGatheringManager::removeSupplyCenter( Object *oldCenter ) -{ - if( oldCenter == nullptr ) - return; - - ObjectID targetID = oldCenter->getID(); - - objectIDListIterator iterator = m_supplyCenters.begin(); - while( iterator != m_supplyCenters.end() ) - { - if( targetID == *iterator ) - { - iterator = m_supplyCenters.erase( iterator ); - } - else - iterator++; - } -} - -void ResourceGatheringManager::addSupplyWarehouse( Object *newWarehouse ) -{ - if( newWarehouse == nullptr ) - return; - - m_supplyWarehouses.push_back( newWarehouse->getID() ); -} - -void ResourceGatheringManager::removeSupplyWarehouse( Object *oldWarehouse ) -{ - if( oldWarehouse == nullptr ) - return; - - ObjectID targetID = oldWarehouse->getID(); - - objectIDListIterator iterator = m_supplyWarehouses.begin(); - while( iterator != m_supplyWarehouses.end() ) - { - if( targetID == *iterator ) - { - iterator = m_supplyWarehouses.erase( iterator ); - } - else - iterator++; - } -} - -static Real computeRelativeCost( Object *queryObject, Object *destObject, Real *pureDistanceSquared ) -{ - /** @todo This gets filled with Pathfinding computations, analysis of Boxes remaining, - Threat calculations, paths of other trucks, and other fancy stuff. - */ - - //A good score is a very small number. - - if( queryObject == nullptr || destObject == nullptr ) - return FLT_MAX; - - if( !TheActionManager->canTransferSuppliesAt(queryObject, destObject) ) - return FLT_MAX;// Handles emptyness and alliances - - DockUpdateInterface *dockInterface = destObject->getDockUpdateInterface(); - if( !dockInterface->isClearToApproach( queryObject ) ) - return FLT_MAX; - - // since we don't care about the distance as a distance per se, but rather as - // a goodness-factor, save some time by getting the dist-sqr (srj) - Real distSquared = ThePartitionManager->getDistanceSquared(queryObject, destObject, FROM_CENTER_3D); - - // I need the distance, but I don't want to count on the coincidence that - // the abstract 'cost' this function returns happens to be just the distance, since it could - // become more complicated - if( pureDistanceSquared ) - *pureDistanceSquared = distSquared; - - return distSquared; -} - -Object *ResourceGatheringManager::findBestSupplyWarehouse( Object *queryObject ) -{ - Object *bestWarehouse = nullptr; - Real maxDistanceSquared = 100000; - - if( ( queryObject == nullptr ) || ( queryObject->getAI() == nullptr ) ) - return nullptr; - - SupplyTruckAIInterface *supplyTruckAI = queryObject->getAI()->getSupplyTruckAIInterface(); - if( supplyTruckAI ) - { - // Check for a dock override being set. - ObjectID dockID = supplyTruckAI->getPreferredDockID(); - Object *dock = TheGameLogic->findObjectByID(dockID); - if( dock ) - { - static const NameKeyType key_warehouseUpdate = NAMEKEY("SupplyWarehouseDockUpdate"); - SupplyWarehouseDockUpdate *warehouseModule = (SupplyWarehouseDockUpdate*)dock->findUpdateModule( key_warehouseUpdate ); - //If remotely okay, let User win. - if( warehouseModule && computeRelativeCost( queryObject, dock, nullptr ) != FLT_MAX ) - return dock; - } - // Please note, there is not a separate Warehouse and Center memory by Design. Because - // we lack a UI way to click Warehouse and drag to center to set up a specific path, the - // practical realization has been made that you do not want separate memory. - - // Design wants a harvester to give up and return to base if it is "too far" to the warehouse. - // Note, the "PreferedDock" will override this, and there is no distance max on Centers. - maxDistanceSquared = supplyTruckAI->getWarehouseScanDistance() * supplyTruckAI->getWarehouseScanDistance(); - } - - //Otherwise, search for a good one. - Real bestCost = FLT_MAX; - - objectIDListIterator iterator = m_supplyWarehouses.begin(); - while( iterator != m_supplyWarehouses.end() ) - { - ObjectID currentID = *iterator; - Object *currentWarehouse =TheGameLogic->findObjectByID(currentID); - - if( currentWarehouse == nullptr ) - { - iterator = m_supplyWarehouses.erase( iterator ); - } - else - { - Real distanceSquared; - Real currentCost = computeRelativeCost( queryObject, currentWarehouse, &distanceSquared ); - if( (currentCost < bestCost) && (distanceSquared < maxDistanceSquared) ) - { - bestWarehouse = currentWarehouse; - bestCost = currentCost; - } - - iterator++; - } - } - - return bestWarehouse; -} - -Object *ResourceGatheringManager::findBestSupplyCenter( Object *queryObject ) -{ - Object *bestCenter = nullptr; - - if( ( queryObject == nullptr ) || ( queryObject->getAI() == nullptr ) ) - return nullptr; - - SupplyTruckAIInterface *supplyTruckAI = queryObject->getAI()->getSupplyTruckAIInterface(); - if( supplyTruckAI ) - { - // Check for a dock override being set. - ObjectID dockID = supplyTruckAI->getPreferredDockID(); - Object *dock = TheGameLogic->findObjectByID(dockID); - if( dock ) - { - static const NameKeyType key_centerUpdate = NAMEKEY("SupplyCenterDockUpdate"); - SupplyCenterDockUpdate *centerModule = (SupplyCenterDockUpdate*)dock->findUpdateModule( key_centerUpdate ); - //If remotely okay, let User win. - if( centerModule && computeRelativeCost( queryObject, dock, nullptr ) != FLT_MAX ) - return dock; - } - // Please note, there is not a separate Warehouse and Center memory by Design. Because - // we lack a UI way to click Warehouse and drag to center to set up a specific path, the - // practical realization has been made that you do not want separate memory. - } - - //Otherwise, search for a good one. - Real bestCost = FLT_MAX; - - objectIDListIterator iterator = m_supplyCenters.begin(); - while( iterator != m_supplyCenters.end() ) - { - ObjectID currentID = *iterator; - Object *currentCenter =TheGameLogic->findObjectByID(currentID); - - if( currentCenter == nullptr ) - { - iterator = m_supplyCenters.erase( iterator ); - } - else - { - Real currentCost = computeRelativeCost( queryObject, currentCenter, nullptr ); - if( currentCost < bestCost ) - { - bestCenter = currentCenter; - bestCost = currentCost; - } - - iterator++; - } - } - - return bestCenter; -} - -// ------------------------------------------------------------------------------------------------ -/** CRC */ -// ------------------------------------------------------------------------------------------------ -void ResourceGatheringManager::crc( Xfer *xfer ) -{ - -} - -// ------------------------------------------------------------------------------------------------ -/** Xfer method - * Version Info: - * 1: Initial version */ -// ------------------------------------------------------------------------------------------------ -void ResourceGatheringManager::xfer( Xfer *xfer ) -{ - - // version - XferVersion currentVersion = 1; - XferVersion version = currentVersion; - xfer->xferVersion( &version, currentVersion ); - - // supply warehouses - xfer->xferSTLObjectIDList( &m_supplyWarehouses ); - - // supply centers - xfer->xferSTLObjectIDList( &m_supplyCenters ); - -} - -// ------------------------------------------------------------------------------------------------ -/** Load post process */ -// ------------------------------------------------------------------------------------------------ -void ResourceGatheringManager::loadPostProcess() -{ - -} - diff --git a/Generals/Code/GameEngine/Source/Common/RTS/Science.cpp b/Generals/Code/GameEngine/Source/Common/RTS/Science.cpp deleted file mode 100644 index 6cb201b2467..00000000000 --- a/Generals/Code/GameEngine/Source/Common/RTS/Science.cpp +++ /dev/null @@ -1,376 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: Science.cpp ///////////////////////////////////////////////////////// -// Created: Steven Johnson, October 2001 -// Desc: @todo -//----------------------------------------------------------------------------- - -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/INI.h" -#include "Common/Player.h" -#include "Common/Science.h" - -ScienceStore* TheScienceStore = nullptr; - - -//----------------------------------------------------------------------------- -void ScienceStore::init() -{ - DEBUG_ASSERTCRASH(m_sciences.empty(), ("Hmm")); - m_sciences.clear(); -} - -//----------------------------------------------------------------------------- -ScienceStore::~ScienceStore() -{ - // nope. - //m_sciences.clear(); - - // go through all sciences and delete any overrides - for (ScienceInfoVec::iterator it = m_sciences.begin(); it != m_sciences.end(); /*++it*/) - { - ScienceInfo* si = *it; - ++it; - deleteInstance(si); - } -} - -//----------------------------------------------------------------------------- -void ScienceStore::reset() -{ - // nope. - //m_sciences.clear(); - - // go through all sciences and delete any overrides - for (ScienceInfoVec::iterator it = m_sciences.begin(); it != m_sciences.end(); /*++it*/) - { - ScienceInfo* si = *it; - Overridable* temp = si->deleteOverrides(); - if (!temp) - { - it = m_sciences.erase(it); - } - else - { - ++it; - } - } -} - -//----------------------------------------------------------------------------- -ScienceType ScienceStore::getScienceFromInternalName(const AsciiString& name) const -{ - if (name.isEmpty()) - return SCIENCE_INVALID; - NameKeyType nkt = TheNameKeyGenerator->nameToKey(name); - ScienceType st = (ScienceType)nkt; - return st; -} - -//----------------------------------------------------------------------------- -AsciiString ScienceStore::getInternalNameForScience(ScienceType science) const -{ - if (science == SCIENCE_INVALID) - return AsciiString::TheEmptyString; - NameKeyType nk = (NameKeyType)(science); - return TheNameKeyGenerator->keyToName(nk); -} - -//----------------------------------------------------------------------------- -// return a vector of all the currently-known science names -// NOTE: this is really only for use by WorldBuilder! Please -// do not use it in RTS! -std::vector ScienceStore::friend_getScienceNames() const -{ - std::vector v; - for (ScienceInfoVec::const_iterator it = m_sciences.begin(); it != m_sciences.end(); ++it) - { - const ScienceInfo* si = (const ScienceInfo*)(*it)->getFinalOverride(); - NameKeyType nk = (NameKeyType)(si->m_science); - v.push_back(TheNameKeyGenerator->keyToName(nk)); - } - return v; -} - -//----------------------------------------------------------------------------- -void ScienceInfo::addRootSciences(ScienceVec& v) const -{ - if (m_prereqSciences.empty()) - { - // we're a root. add ourselves. - if (std::find(v.begin(), v.end(), m_science) == v.end()) - v.push_back(m_science); - } - else - { - // we're not a root. add the roots of all our prereqs. - for (ScienceVec::const_iterator it = m_prereqSciences.begin(); it != m_prereqSciences.end(); ++it) - { - const ScienceInfo* si = TheScienceStore->findScienceInfo(*it); - if (si) - si->addRootSciences(v); - } - } -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -const ScienceInfo* ScienceStore::findScienceInfo(ScienceType st) const -{ - for (ScienceInfoVec::const_iterator it = m_sciences.begin(); it != m_sciences.end(); ++it) - { - const ScienceInfo* si = (const ScienceInfo*)(*it)->getFinalOverride(); - if (si->m_science == st) - { - return si; - } - } - return nullptr; -} - -//----------------------------------------------------------------------------- -/*static*/ void ScienceStore::friend_parseScienceDefinition( INI* ini ) -{ - const char* c = ini->getNextToken(); - NameKeyType nkt = NAMEKEY(c); - ScienceType st = (ScienceType)nkt; - - if (TheScienceStore) - { - - static const FieldParse myFieldParse[] = - { - { "PrerequisiteSciences", INI::parseScienceVector, nullptr, offsetof( ScienceInfo, m_prereqSciences ) }, - { "SciencePurchasePointCost", INI::parseInt, nullptr, offsetof( ScienceInfo, m_sciencePurchasePointCost ) }, - { "IsGrantable", INI::parseBool, nullptr, offsetof( ScienceInfo, m_grantable ) }, - { "DisplayName", INI::parseAndTranslateLabel, nullptr, offsetof( ScienceInfo, m_name) }, - { "Description", INI::parseAndTranslateLabel, nullptr, offsetof( ScienceInfo, m_description) }, - { nullptr, nullptr, nullptr, 0 } - }; - - ScienceInfo* info = nullptr; - - // see if the science already exists. (can't use findScienceInfo() since it is const and should remain so.) - for (ScienceInfoVec::iterator it = TheScienceStore->m_sciences.begin(); it != TheScienceStore->m_sciences.end(); ++it) - { - // note that we don't use getFinalOverride here. this is correct and as-desired. - if ((*it)->m_science == st) - { - info = *it; - break; - } - } - - if (ini->getLoadType() == INI_LOAD_CREATE_OVERRIDES) - { - ScienceInfo* newInfo = newInstance(ScienceInfo); - - if (info == nullptr) - { - // only add if it's not overriding an existing one. - info = newInfo; - info->markAsOverride(); // yep, so we will get cleared on reset() - TheScienceStore->m_sciences.push_back(info); - } - else - { - // copy data from final override to 'newInfo' as a set of initial default values - info = (ScienceInfo*)(info->friend_getFinalOverride()); - - *newInfo = *info; - info->setNextOverride(newInfo); - newInfo->markAsOverride(); // must do AFTER the copy - - // use the newly created override for us to set values with etc - info = newInfo; - //TheScienceStore->m_sciences.push_back(info); // NO, BAD, WRONG -- don't add in this case. - } - } - else - { - if (info != nullptr) - { - DEBUG_CRASH(("duplicate science %s!",c)); - throw INI_INVALID_DATA; - } - info = newInstance(ScienceInfo); - TheScienceStore->m_sciences.push_back(info); - } - - ini->initFromINI(info, myFieldParse); - info->m_science = st; - info->addRootSciences(info->m_rootSciences); - } -} - -//----------------------------------------------------------------------------- -Int ScienceStore::getSciencePurchaseCost(ScienceType st) const -{ - const ScienceInfo* si = findScienceInfo(st); - if (si) - { - return si->m_sciencePurchasePointCost; - } - else - { - return 0; - } -} - -//----------------------------------------------------------------------------- -Bool ScienceStore::isScienceGrantable(ScienceType st) const -{ - const ScienceInfo* si = findScienceInfo(st); - if (si) - { - return si->m_grantable; - } - else - { - return false; - } -} - -//----------------------------------------------------------------------------- -Bool ScienceStore::getNameAndDescription(ScienceType st, UnicodeString& name, UnicodeString& description) const -{ - const ScienceInfo* si = findScienceInfo(st); - if (si) - { - name = si->m_name; - description = si->m_description; - return true; - } - else - { - return false; - } -} - -//----------------------------------------------------------------------------- -Bool ScienceStore::playerHasPrereqsForScience(const Player* player, ScienceType st) const -{ - const ScienceInfo* si = findScienceInfo(st); - if (si) - { - for (ScienceVec::const_iterator it2 = si->m_prereqSciences.begin(); it2 != si->m_prereqSciences.end(); ++it2) - { - if (!player->hasScience(*it2)) - { - return false; - } - } - return true; - } - else - { - return false; - } -} - -//----------------------------------------------------------------------------- -Bool ScienceStore::playerHasRootPrereqsForScience(const Player* player, ScienceType st) const -{ - const ScienceInfo* si = findScienceInfo(st); - if (si) - { - for (ScienceVec::const_iterator it2 = si->m_rootSciences.begin(); it2 != si->m_rootSciences.end(); ++it2) - { - if (!player->hasScience(*it2)) - { - return false; - } - } - return true; - } - else - { - return false; - } -} - -//----------------------------------------------------------------------------- -/** return a list of the sciences the given player can purchase now, and a list he might be able to purchase in the future, - but currently lacks prereqs or points for. (either might be an empty list) */ -void ScienceStore::getPurchasableSciences(const Player* player, ScienceVec& purchasable, ScienceVec& potentiallyPurchasable) const -{ - purchasable.clear(); - potentiallyPurchasable.clear(); - for (ScienceInfoVec::const_iterator it = m_sciences.begin(); it != m_sciences.end(); ++it) - { - const ScienceInfo* si = (const ScienceInfo*)(*it)->getFinalOverride(); - - if (si->m_sciencePurchasePointCost == 0) - { - // 0 means "cannot be purchased" - continue; - } - - if (player->hasScience(si->m_science)) - { - continue; - } - - if (playerHasPrereqsForScience(player, si->m_science)) - { - purchasable.push_back(si->m_science); - } - else if (playerHasRootPrereqsForScience(player, si->m_science)) - { - potentiallyPurchasable.push_back(si->m_science); - } - } -} - -//----------------------------------------------------------------------------- -// this is intended ONLY for use by INI::scanScience. -// Don't use it anywhere else. In particular, never, ever, ever -// call this with a hardcoded science name. (srj) -ScienceType ScienceStore::friend_lookupScience(const char* scienceName) const -{ - NameKeyType nkt = NAMEKEY(scienceName); - ScienceType st = (ScienceType)nkt; - if (!isValidScience(st)) - { - DEBUG_CRASH(("Science name %s not known! (Did you define it in Science.ini?)",scienceName)); - throw INI_INVALID_DATA; - } - return st; -} - -//----------------------------------------------------------------------------- -Bool ScienceStore::isValidScience(ScienceType st) const -{ - const ScienceInfo* si = findScienceInfo(st); - return si != nullptr; -} - -//----------------------------------------------------------------------------- -void INI::parseScienceDefinition( INI* ini ) -{ - ScienceStore::friend_parseScienceDefinition(ini); -} - diff --git a/Generals/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp b/Generals/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp deleted file mode 100644 index 96396f14279..00000000000 --- a/Generals/Code/GameEngine/Source/Common/RTS/ScoreKeeper.cpp +++ /dev/null @@ -1,565 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ScoreKeeper.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Jun 2002 -// -// Filename: ScoreKeeper.cpp -// -// author: Chris Huybregts -// -// purpose: Score Keeper class will be an object attached to each player -// that will maintain accurate counts for the various stats we -// want to show on the score screen. The information in here -// could also be used for the observer screen -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GameState.h" -#include "Common/KindOf.h" -#include "Common/Player.h" -#include "Common/ScoreKeeper.h" -#include "Common/ThingFactory.h" -#include "Common/ThingTemplate.h" -#include "Common/Xfer.h" - -#include "GameLogic/Object.h" -#include "GameLogic/GameLogic.h" - -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -ScoreKeeper::ScoreKeeper() -{ - reset(0); -} - -ScoreKeeper::~ScoreKeeper() -{ - -} - -static KindOfMaskType scoringBuildingMask; -static KindOfMaskType scoringBuildingDestroyMask; -static KindOfMaskType scoringBuildingCreateMask; - -void ScoreKeeper::reset( Int playerIdx ) -{ - scoringBuildingMask.set(KINDOF_STRUCTURE); - scoringBuildingMask.set(KINDOF_SCORE); - - scoringBuildingCreateMask.set(KINDOF_STRUCTURE); - scoringBuildingCreateMask.set(KINDOF_SCORE_CREATE); - - scoringBuildingDestroyMask.set(KINDOF_STRUCTURE); - scoringBuildingDestroyMask.set(KINDOF_SCORE_DESTROY); - - m_totalMoneyEarned = m_totalMoneySpent = 0; - m_totalUnitsLost = m_totalUnitsBuilt = 0; - m_totalBuildingsLost = m_totalBuildingsBuilt = 0; - m_totalFactionBuildingsCaptured = m_totalTechBuildingsCaptured = 0; - m_currentScore = 0; - m_objectsBuilt.clear(); - m_objectsCaptured.clear(); - m_objectsLost.clear(); - for(int i = 0; i < MAX_PLAYER_COUNT; ++i) - { - m_objectsDestroyed[i].clear(); - m_totalBuildingsDestroyed[i] = m_totalUnitsDestroyed[i] = 0; - } - m_myPlayerIdx = playerIdx; -} - -void ScoreKeeper::addObjectBuilt( const Object *o) -{ - Bool addToCount = FALSE; - - if (TheGameLogic->isScoringEnabled() == FALSE) { - return; - } - - if(o->getTemplate()->isKindOfMulti(scoringBuildingMask, KINDOFMASK_NONE)) - { - ++m_totalBuildingsBuilt; - addToCount = TRUE; - } - else if (o->getTemplate()->isKindOfMulti(scoringBuildingCreateMask, KINDOFMASK_NONE)) - { - ++m_totalBuildingsBuilt; - addToCount = TRUE; - } - else if(o->getTemplate()->isKindOf(KINDOF_INFANTRY) || o->getTemplate()->isKindOf(KINDOF_VEHICLE)) - { - if (o->getTemplate()->isKindOf(KINDOF_SCORE) || o->getTemplate()->isKindOf(KINDOF_SCORE_CREATE)) - { - ++m_totalUnitsBuilt; - addToCount = TRUE; - } - } - - if(addToCount) - { - Int existingCount = 0; - ObjectCountMapIt it = m_objectsBuilt.find(o->getTemplate()); - if (it != m_objectsBuilt.end()) - existingCount = it->second; - m_objectsBuilt[o->getTemplate()] = existingCount + 1; - } -} - -Int ScoreKeeper::getTotalUnitsBuilt( KindOfMaskType validMask, KindOfMaskType invalidMask ) -{ - Int count = 0; - for (ObjectCountMapIt it = m_objectsBuilt.begin(); it != m_objectsBuilt.end(); ++it) - { - const ThingTemplate *theTemplate = it->first; - Int numBuilt = it->second; - if (theTemplate && theTemplate->isKindOfMulti(validMask, invalidMask)) - count += numBuilt; - } - return count; -} - -Int ScoreKeeper::getTotalObjectsBuilt( const ThingTemplate *pTemplate ) -{ - Int count = 0; - for (ObjectCountMapIt it = m_objectsBuilt.begin(); it != m_objectsBuilt.end(); ++it) - { - const ThingTemplate *theTemplate = it->first; - if (theTemplate && theTemplate->isEquivalentTo(pTemplate)) - ++count; - } - return count; -} - - -void ScoreKeeper::removeObjectBuilt( const Object *o) -{ - if (TheGameLogic->isScoringEnabled() == FALSE) { - return; - } - - Bool removeFromCount = FALSE; - if (o->getTemplate()->isKindOfMulti(scoringBuildingMask, KINDOFMASK_NONE)) - { - --m_totalBuildingsBuilt; - removeFromCount = TRUE; - } - else if (o->getTemplate()->isKindOfMulti(scoringBuildingCreateMask, KINDOFMASK_NONE)) - { - --m_totalBuildingsBuilt; - removeFromCount = TRUE; - } - else if (o->getTemplate()->isKindOf(KINDOF_INFANTRY) || o->getTemplate()->isKindOf(KINDOF_VEHICLE)) - { - if (o->getTemplate()->isKindOf(KINDOF_SCORE) || o->getTemplate()->isKindOf(KINDOF_SCORE_CREATE)) - { - --m_totalUnitsBuilt; - removeFromCount = TRUE; - } - } - - if (removeFromCount) - { - Int existingCount = 0; - ObjectCountMapIt it = m_objectsBuilt.find(o->getTemplate()); - if (it != m_objectsBuilt.end()) - existingCount = it->second; - m_objectsBuilt[o->getTemplate()] = existingCount - 1; - } -} - -void ScoreKeeper::addObjectCaptured( const Object *o ) -{ - if (TheGameLogic->isScoringEnabled() == FALSE) { - return; - } - - Bool addToCount = FALSE; - if(o->getTemplate()->isKindOf(KINDOF_STRUCTURE)) - { - if (o->getTemplate()->isKindOf(KINDOF_SCORE)) - { - ++m_totalFactionBuildingsCaptured; - } - else - { - ++m_totalTechBuildingsCaptured; - } - addToCount = TRUE; - } - - if(addToCount) - { - Int existingCount = 0; - ObjectCountMapIt it = m_objectsCaptured.find(o->getTemplate()); - if (it != m_objectsCaptured.end()) - existingCount = it->second; - m_objectsCaptured[o->getTemplate()] = existingCount + 1; - } -} - - - -void ScoreKeeper::addObjectDestroyed( const Object *o) -{ - - if (TheGameLogic->isScoringEnabled() == FALSE) { - return; - } - - Int playerIdx = o->getControllingPlayer()->getPlayerIndex(); - - Bool addToCount = FALSE; - if(o->getTemplate()->isKindOfMulti(scoringBuildingMask, KINDOFMASK_NONE)) - { - if (!(o->testStatus(OBJECT_STATUS_UNDER_CONSTRUCTION))) { - ++m_totalBuildingsDestroyed[playerIdx]; - addToCount = TRUE; - } - } - else if (o->getTemplate()->isKindOfMulti(scoringBuildingDestroyMask, KINDOFMASK_NONE)) - { - if (!(o->testStatus(OBJECT_STATUS_UNDER_CONSTRUCTION))) { - ++m_totalBuildingsDestroyed[playerIdx]; - addToCount = TRUE; - } - } - else if(o->getTemplate()->isKindOf(KINDOF_INFANTRY) || o->getTemplate()->isKindOf(KINDOF_VEHICLE)) - { - if (o->getTemplate()->isKindOf(KINDOF_SCORE) || o->getTemplate()->isKindOf(KINDOF_SCORE_DESTROY)) - { - if (!(o->testStatus(OBJECT_STATUS_UNDER_CONSTRUCTION))) { - m_totalUnitsDestroyed[playerIdx]++; - addToCount = TRUE; - } - } - } - - if(addToCount) - { - Int existingCount = 0; - ObjectCountMapIt it = m_objectsDestroyed[playerIdx].find(o->getTemplate()); - if (it != m_objectsDestroyed[playerIdx].end()) - existingCount = it->second; - m_objectsDestroyed[playerIdx][o->getTemplate()] = existingCount + 1; - } -} - -void ScoreKeeper::addObjectLost( const Object *o ) -{ - if (TheGameLogic->isScoringEnabled() == FALSE) { - return; - } - - Bool addToCount = FALSE; - if(o->getTemplate()->isKindOfMulti(scoringBuildingMask, KINDOFMASK_NONE)) - { - if (!(o->testStatus(OBJECT_STATUS_UNDER_CONSTRUCTION))) { - ++m_totalBuildingsLost; - addToCount = TRUE; - } - } - else if (o->getTemplate()->isKindOfMulti(scoringBuildingDestroyMask, KINDOFMASK_NONE)) - { - if (!(o->testStatus(OBJECT_STATUS_UNDER_CONSTRUCTION))) { - ++m_totalBuildingsLost; - addToCount = TRUE; - } - } - else if(o->getTemplate()->isKindOf(KINDOF_INFANTRY) || o->getTemplate()->isKindOf(KINDOF_VEHICLE)) - { - if (o->getTemplate()->isKindOf(KINDOF_SCORE) || o->getTemplate()->isKindOf(KINDOF_SCORE_DESTROY)) - { - if (!(o->testStatus(OBJECT_STATUS_UNDER_CONSTRUCTION))) { - ++m_totalUnitsLost; - addToCount = TRUE; - } - } - } - - if(addToCount) - { - Int existingCount = 0; - ObjectCountMapIt it = m_objectsLost.find(o->getTemplate()); - if (it != m_objectsLost.end()) - existingCount = it->second; - m_objectsLost[o->getTemplate()] = existingCount + 1; - } -} - -Int ScoreKeeper::calculateScore() -{ - Int score = 0; - score += m_totalUnitsBuilt * 100; - score += m_totalMoneyEarned; - score += m_totalBuildingsBuilt * 100; - for (Int i = 0; i < MAX_PLAYER_COUNT; ++i) - { - if(i == m_myPlayerIdx) - continue; - score += m_totalUnitsDestroyed[i] * 100; - score += m_totalBuildingsDestroyed[i] * 100; - } - - m_currentScore = score; - return m_currentScore; - -} - -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -Int ScoreKeeper::getTotalBuildingsDestroyed() -{ - int count = 0; - for (int i = 0; i< MAX_PLAYER_COUNT; ++i) - { - // Design change, display even if we killed our own -// if(i == m_myPlayerIdx) -// continue; - count += m_totalBuildingsDestroyed[i]; - //for (ObjectCountMapIt it = m_objectsDestroyed[i].begin(); it != m_objectsDestroyed[i].end(); ++it) - // { - // - // count += it->second; - // } - - } - return count; -} -Int ScoreKeeper::getTotalUnitsDestroyed() -{ - int count = 0; - for (int i = 0; i< MAX_PLAYER_COUNT; ++i) - { - // Design change, display even if we killed our own -// if(i == m_myPlayerIdx) -// continue; - count += m_totalUnitsDestroyed[i]; -// for (ObjectCountMapIt it = m_objectsDestroyed[i].begin(); it != m_objectsDestroyed[i].end(); ++it) -// { -// } - } - return count; -} - -// ------------------------------------------------------------------------------------------------ -/** CRC */ -// ------------------------------------------------------------------------------------------------ -void ScoreKeeper::crc( Xfer *xfer ) -{ - -} - -// ------------------------------------------------------------------------------------------------ -/** Xfer of an object count map - * Version Info: - * 1: Initial version */ -// ------------------------------------------------------------------------------------------------ -void ScoreKeeper::xferObjectCountMap( Xfer *xfer, ObjectCountMap *map ) -{ - - // sanity - if( map == nullptr ) - { - - DEBUG_CRASH(( "xferObjectCountMap - Invalid map parameter" )); - throw SC_INVALID_DATA; - - } - - // version info - XferVersion currentVersion = 1; - XferVersion version = currentVersion; - xfer->xferVersion( &version, currentVersion ); - - // size of the map - UnsignedShort mapSize = map->size(); - xfer->xferUnsignedShort( &mapSize ); - - // map data - Int count; - const ThingTemplate *thingTemplate; - AsciiString thingTemplateName; - if( xfer->getXferMode() == XFER_SAVE ) - { - ObjectCountMapIt it; - - // save all entries - for( it = map->begin(); it != map->end(); ++it ) - { - - // thing template - thingTemplate = it->first; - thingTemplateName = thingTemplate->getName(); - xfer->xferAsciiString( &thingTemplateName ); - - // the count - count = it->second; - xfer->xferInt( &count ); - - } - - } - else - { - - // read all entries - for( UnsignedShort i = 0; i < mapSize; ++i ) - { - - // read thing template name - xfer->xferAsciiString( &thingTemplateName ); - thingTemplate = TheThingFactory->findTemplate( thingTemplateName ); - if( thingTemplate == nullptr ) - { - - DEBUG_CRASH(( "xferObjectCountMap - Unknown thing template '%s'", thingTemplateName.str() )); - throw SC_INVALID_DATA; - - } - - // read count - xfer->xferInt( &count ); - - // add to map - (*map)[ thingTemplate ] = count; - - } - - } - -} - -// ------------------------------------------------------------------------------------------------ -/** Xfer method - * Version Info: - * 1: Initial version */ -// ------------------------------------------------------------------------------------------------ -void ScoreKeeper::xfer( Xfer *xfer ) -{ - - // version - XferVersion currentVersion = 1; - XferVersion version = currentVersion; - xfer->xferVersion( &version, currentVersion ); - - // money earned - xfer->xferInt( &m_totalMoneyEarned ); - - // money spent - xfer->xferInt( &m_totalMoneySpent ); - - // units destroyed - xfer->xferUser( m_totalUnitsDestroyed, sizeof( Int ) * MAX_PLAYER_COUNT ); - - // units built - xfer->xferInt( &m_totalUnitsBuilt ); - - // units lost - xfer->xferInt( &m_totalUnitsLost ); - - // buildings destroyed - xfer->xferUser( m_totalBuildingsDestroyed, sizeof( Int ) * MAX_PLAYER_COUNT ); - - // buildings built - xfer->xferInt( &m_totalBuildingsBuilt ); - - // buildings lost - xfer->xferInt( &m_totalBuildingsLost ); - - // tech buildings captured - xfer->xferInt( &m_totalTechBuildingsCaptured ); - - // faction buildings captured - xfer->xferInt( &m_totalFactionBuildingsCaptured ); - - // current score - xfer->xferInt( &m_currentScore ); - - // player index - xfer->xferInt( &m_myPlayerIdx ); - - // objects built - xferObjectCountMap( xfer, &m_objectsBuilt ); - - // objects destroyed - UnsignedShort destroyedArraySize = MAX_PLAYER_COUNT; - xfer->xferUnsignedShort( &destroyedArraySize ); - if( destroyedArraySize != MAX_PLAYER_COUNT ) - { - - DEBUG_CRASH(( "ScoreKeeper::xfer - size of objects destroyed array has changed" )); - throw SC_INVALID_DATA; - - } - for( UnsignedShort i = 0; i < destroyedArraySize; ++i ) - { - - // xfer map data - xferObjectCountMap( xfer, &m_objectsDestroyed[ i ] ); - - } - - // objects lost - xferObjectCountMap( xfer, &m_objectsLost ); - - // objects captured - xferObjectCountMap( xfer, &m_objectsCaptured ); - -} - -// ------------------------------------------------------------------------------------------------ -/** Load post process */ -// ------------------------------------------------------------------------------------------------ -void ScoreKeeper::loadPostProcess() -{ - -} diff --git a/GeneralsMD/Code/GameEngine/CMakeLists.txt b/GeneralsMD/Code/GameEngine/CMakeLists.txt index 694f7d267d8..1547a934187 100644 --- a/GeneralsMD/Code/GameEngine/CMakeLists.txt +++ b/GeneralsMD/Code/GameEngine/CMakeLists.txt @@ -53,7 +53,7 @@ set(GAMEENGINE_SRC # Include/Common/GameType.h Include/Common/Geometry.h Include/Common/GlobalData.h - Include/Common/Handicap.h +# Include/Common/Handicap.h Include/Common/IgnorePreferences.h # Include/Common/INI.h Include/Common/INIException.h @@ -69,7 +69,7 @@ set(GAMEENGINE_SRC # Include/Common/MessageStream.h # Include/Common/MiniLog.h # Include/Common/MiscAudio.h - Include/Common/MissionStats.h +# Include/Common/MissionStats.h Include/Common/ModelState.h Include/Common/Module.h Include/Common/ModuleFactory.h @@ -84,7 +84,7 @@ set(GAMEENGINE_SRC Include/Common/PerfMetrics.h # Include/Common/PerfTimer.h Include/Common/Player.h - Include/Common/PlayerList.h +# Include/Common/PlayerList.h Include/Common/PlayerTemplate.h Include/Common/ProductionPrerequisite.h Include/Common/QuickmatchPreferences.h @@ -95,10 +95,10 @@ set(GAMEENGINE_SRC Include/Common/Recorder.h # Include/Common/ReplaySimulation.h Include/Common/Registry.h - Include/Common/ResourceGatheringManager.h - Include/Common/Science.h +# Include/Common/ResourceGatheringManager.h +# Include/Common/Science.h Include/Common/ScopedMutex.h - Include/Common/ScoreKeeper.h +# Include/Common/ScoreKeeper.h # Include/Common/simpleplayer.h Include/Common/SkirmishBattleHonors.h Include/Common/SkirmishPreferences.h @@ -610,16 +610,16 @@ set(GAMEENGINE_SRC # Source/Common/RTS/AcademyStats.cpp Source/Common/RTS/ActionManager.cpp Source/Common/RTS/Energy.cpp - Source/Common/RTS/Handicap.cpp - Source/Common/RTS/MissionStats.cpp +# Source/Common/RTS/Handicap.cpp +# Source/Common/RTS/MissionStats.cpp Source/Common/RTS/Money.cpp Source/Common/RTS/Player.cpp - Source/Common/RTS/PlayerList.cpp +# Source/Common/RTS/PlayerList.cpp Source/Common/RTS/PlayerTemplate.cpp Source/Common/RTS/ProductionPrerequisite.cpp - Source/Common/RTS/ResourceGatheringManager.cpp - Source/Common/RTS/Science.cpp - Source/Common/RTS/ScoreKeeper.cpp +# Source/Common/RTS/ResourceGatheringManager.cpp +# Source/Common/RTS/Science.cpp +# Source/Common/RTS/ScoreKeeper.cpp Source/Common/RTS/SpecialPower.cpp Source/Common/RTS/Team.cpp Source/Common/RTS/TunnelTracker.cpp diff --git a/scripts/cpp/unify_move_files.py b/scripts/cpp/unify_move_files.py index 1bfb3539700..b2457aaddf3 100644 --- a/scripts/cpp/unify_move_files.py +++ b/scripts/cpp/unify_move_files.py @@ -643,6 +643,19 @@ def main(): #unify_file(Game.ZEROHOUR, "GameEngine/Include/Common/CommandLine.h", Game.CORE, "GameEngine/Include/Common/CommandLine.h") #unify_file(Game.ZEROHOUR, "GameEngine/Source/Common/CommandLine.cpp", Game.CORE, "GameEngine/Source/Common/CommandLine.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/Common/Handicap.h", Game.CORE, "GameEngine/Include/Common/Handicap.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/Common/RTS/Handicap.cpp", Game.CORE, "GameEngine/Source/Common/RTS/Handicap.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/Common/MissionStats.h", Game.CORE, "GameEngine/Include/Common/MissionStats.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/Common/RTS/MissionStats.cpp", Game.CORE, "GameEngine/Source/Common/RTS/MissionStats.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/Common/PlayerList.h", Game.CORE, "GameEngine/Include/Common/PlayerList.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/Common/RTS/PlayerList.cpp", Game.CORE, "GameEngine/Source/Common/RTS/PlayerList.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/Common/ResourceGatheringManager.h", Game.CORE, "GameEngine/Include/Common/ResourceGatheringManager.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp", Game.CORE, "GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/Common/Science.h", Game.CORE, "GameEngine/Include/Common/Science.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/Common/RTS/Science.cpp", Game.CORE, "GameEngine/Source/Common/RTS/Science.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/Common/ScoreKeeper.h", Game.CORE, "GameEngine/Include/Common/ScoreKeeper.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/Common/RTS/ScoreKeeper.cpp", Game.CORE, "GameEngine/Source/Common/RTS/ScoreKeeper.cpp") + return