| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213 |
- /*
- ** 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 <http://www.gnu.org/licenses/>.
- */
- ////////////////////////////////////////////////////////////////////////////////
- // //
- // (c) 2001-2003 Electronic Arts Inc. //
- // //
- ////////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////////////
- // FILE: SkirmishBattleHonors.cpp
- // Author: Matthew D. Campbell, April 2002
- // Description: Saving/Loading of skirmish battle honors info
- ///////////////////////////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------------
- // SYSTEM INCLUDES ////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------------
- #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
- //-----------------------------------------------------------------------------
- // USER INCLUDES //////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------------
- #include "Common/UserPreferences.h"
- #include "Common/SkirmishBattleHonors.h"
- #include "Common/Player.h"
- #include "Common/PlayerTemplate.h"
- #include "Common/QuotedPrintable.h"
- #include "Common/MultiplayerSettings.h"
- #include "GameClient/MapUtil.h"
- //-----------------------------------------------------------------------------
- // DEFINES ////////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------------
- //-----------------------------------------------------------------------------
- // PRIVATE TYPES //////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------------
- //-----------------------------------------------------------------------------
- // PRIVATE DATA ///////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------------
- //-----------------------------------------------------------------------------
- // PUBLIC DATA ////////////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------------
- //-----------------------------------------------------------------------------
- // PRIVATE PROTOTYPES /////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------------
- //-----------------------------------------------------------------------------
- // PRIVATE FUNCTIONS //////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------------
- //-----------------------------------------------------------------------------
- // PUBLIC FUNCTIONS ///////////////////////////////////////////////////////////
- //-----------------------------------------------------------------------------
- //-----------------------------------------------------------------------------
- // SkirmishBattleHonors base class
- //-----------------------------------------------------------------------------
- SkirmishBattleHonors::SkirmishBattleHonors()
- {
- load("SkirmishStats.ini");
- }
- SkirmishBattleHonors::~SkirmishBattleHonors()
- {
- }
- void SkirmishBattleHonors::setWins(Int val)
- {
- setInt("Wins", val);
- }
- Int SkirmishBattleHonors::getWins(void) const
- {
- return getInt("Wins", 0);
- }
- void SkirmishBattleHonors::setLosses(Int val)
- {
- setInt("Losses", val);
- }
- Int SkirmishBattleHonors::getLosses(void) const
- {
- return getInt("Losses", 0);
- }
- void SkirmishBattleHonors::setWinStreak(Int val)
- {
- setInt("WinStreak", val);
- }
- Int SkirmishBattleHonors::getWinStreak(void) const
- {
- return getInt("WinStreak", 0);
- }
- void SkirmishBattleHonors::setBestWinStreak(Int val)
- {
- setInt("BestWinStreak", val);
- }
- Int SkirmishBattleHonors::getBestWinStreak(void) const
- {
- return getInt("BestWinStreak", 0);
- }
- void SkirmishBattleHonors::setChallengeMedals(Int val)
- {
- setInt("Challenge", val);
- }
- Int SkirmishBattleHonors::getChallengeMedals(void) const
- {
- return getInt("Challenge", 0);
- }
- void SkirmishBattleHonors::setBuiltSCUD(void)
- {
- setBool("SCUD", TRUE);
- }
- Bool SkirmishBattleHonors::builtSCUD(void) const
- {
- return getBool("SCUD", FALSE);
- }
- void SkirmishBattleHonors::setBuiltParticleCannon(void)
- {
- setBool("PPC", TRUE);
- }
- Bool SkirmishBattleHonors::builtParticleCannon(void) const
- {
- return getBool("PPC", FALSE);
- }
- void SkirmishBattleHonors::setBuiltNuke(void)
- {
- setBool("Nuke", TRUE);
- }
- Bool SkirmishBattleHonors::builtNuke(void) const
- {
- return getBool("Nuke", FALSE);
- }
- void SkirmishBattleHonors::setHonors(Int which)
- {
- Int honors = getInt("Honors", 0);
- setInt("Honors", honors | which);
- }
- Int SkirmishBattleHonors::getHonors(void) const
- {
- return getInt("Honors", 0);
- }
- void SkirmishBattleHonors::setEnduranceMedal(AsciiString mapName, Int difficulty, int numAIs)
- {
- AsciiString key;
- key.format("%s_%d", mapName.str(), difficulty);
- setInt(key, numAIs);
- }
- Int SkirmishBattleHonors::getEnduranceMedal(AsciiString mapName, Int difficulty) const
- {
- AsciiString key;
- key.format("%s_%d", mapName.str(), difficulty);
- return getInt(key, 0);
- }
- void SkirmishBattleHonors::setLastGeneral(AsciiString val)
- {
- setAsciiString("LastHouse", val);
- }
- AsciiString SkirmishBattleHonors::getLastGeneral(void) const
- {
- return getAsciiString("LastHouse", AsciiString::TheEmptyString);
- }
- void SkirmishBattleHonors::setNumGamesLoyal(Int val)
- {
- setInt("LoyalGames", val);
- }
- Int SkirmishBattleHonors::getNumGamesLoyal(void) const
- {
- return getInt("LoyalGames", 0);
- }
|