Skip to content

Commit d98e196

Browse files
committed
Minor style fix
1 parent 2a4b815 commit d98e196

File tree

3 files changed

+32
-65
lines changed

3 files changed

+32
-65
lines changed

src/Ext/Event/Body.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
#include "Body.h"
2121
#include <Spawner/ProtocolZero.h>
22-
#include <Spawner/Spawner.h>
2322

2423
#include <Helpers/Macro.h>
2524
#include <EventClass.h>

src/Spawner/Spawner.Config.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ void SpawnerConfig::LoadFromINIFile(CCINIClass* pINI)
5252
MultiByteToWideChar(CP_UTF8, 0, Main::readBuffer, strlen(Main::readBuffer), UIGameMode, std::size(UIGameMode));
5353
}
5454

55-
{// SaveGame Options
56-
LoadSaveGame = pINI->ReadBool(pSettingsSection, "LoadSaveGame", LoadSaveGame);
55+
{ // SaveGame Options
56+
LoadSaveGame = pINI->ReadBool(pSettingsSection, "LoadSaveGame", LoadSaveGame);
5757
/* SavedGameDir */ pINI->ReadString(pSettingsSection, "SavedGameDir", SavedGameDir, SavedGameDir, sizeof(SavedGameDir));
5858
/* SaveGameName */ pINI->ReadString(pSettingsSection, "SaveGameName", SaveGameName, SaveGameName, sizeof(SaveGameName));
59-
AutoSaveCount = pINI->ReadInteger(pSettingsSection, "AutoSaveCount", AutoSaveCount);
60-
AutoSaveInterval = pINI->ReadInteger(pSettingsSection, "AutoSaveInterval", AutoSaveInterval);
59+
AutoSaveCount = pINI->ReadInteger(pSettingsSection, "AutoSaveCount", AutoSaveCount);
60+
AutoSaveInterval = pINI->ReadInteger(pSettingsSection, "AutoSaveInterval", AutoSaveInterval);
6161
NextAutoSaveNumber = pINI->ReadInteger(pSettingsSection, "NextAutoSaveNumber", NextAutoSaveNumber);
6262
}
6363

src/Spawner/Spawner.cpp

Lines changed: 28 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -297,16 +297,22 @@ bool Spawner::StartScenario(const char* pScenarioName)
297297
if (SessionClass::IsCampaign())
298298
{
299299
pGameModeOptions->Crates = true;
300-
return Config->LoadSaveGame ? Spawner::LoadSavedGame(Config->SaveGameName) : ScenarioClass::StartScenario(pScenarioName, 1, 0);
300+
return Config->LoadSaveGame
301+
? Spawner::LoadSavedGame(Config->SaveGameName)
302+
: ScenarioClass::StartScenario(pScenarioName, 1, 0);
301303
}
302304
else if (SessionClass::IsSkirmish())
303305
{
304-
return Config->LoadSaveGame ? Spawner::LoadSavedGame(Config->SaveGameName) : ScenarioClass::StartScenario(pScenarioName, 0, -1);
306+
return Config->LoadSaveGame
307+
? Spawner::LoadSavedGame(Config->SaveGameName)
308+
: ScenarioClass::StartScenario(pScenarioName, 0, -1);
305309
}
306310
else /* if (SessionClass::IsMultiplayer()) */
307311
{
308312
Spawner::InitNetwork();
309-
bool result = Config->LoadSaveGame ? Spawner::LoadSavedGame(Config->SaveGameName) : ScenarioClass::StartScenario(pScenarioName, 0, -1);
313+
bool result = Config->LoadSaveGame
314+
? Spawner::LoadSavedGame(Config->SaveGameName)
315+
: ScenarioClass::StartScenario(pScenarioName, 0, -1);
310316

311317
if (!result)
312318
return false;
@@ -434,15 +440,11 @@ bool Spawner::Reconcile_Players()
434440
// Just use this as Playernodes.
435441
auto players = SessionClass::Instance.StartSpots;
436442

437-
/**
438-
* If there are no players, there's nothing to do.
439-
*/
443+
// If there are no players, there's nothing to do.
440444
if (players.Count == 0)
441445
return true;
442446

443-
/**
444-
* Make sure every name we're connected to can be found in a House.
445-
*/
447+
// Make sure every name we're connected to can be found in a House.
446448
for (i = 0; i < players.Count; i++)
447449
{
448450
found = false;
@@ -485,9 +487,7 @@ bool Spawner::Reconcile_Players()
485487
if (!pHouse)
486488
continue;
487489

488-
/**
489-
* Skip this house if it wasn't human to start with.
490-
*/
490+
// Skip this house if it wasn't human to start with.
491491
if (!pHouse->IsHumanPlayer)
492492
continue;
493493

@@ -506,9 +506,7 @@ bool Spawner::Reconcile_Players()
506506
}
507507
}
508508

509-
/**
510-
* If this name wasn't found, remove it
511-
*/
509+
// If this name wasn't found, remove it
512510
if (!found)
513511
{
514512
/**
@@ -548,9 +546,7 @@ void Spawner::LoadSidesStuff()
548546

549547
void Spawner::RespondToSaveGame(EventExt* event)
550548
{
551-
/**
552-
* Mark that we'd like to save the game.
553-
*/
549+
// Mark that we'd like to save the game.
554550
Spawner::DoSave = true;
555551
}
556552

@@ -562,19 +558,13 @@ void Spawner::RespondToSaveGame(EventExt* event)
562558
*/
563559
void Print_Saving_Game_Message()
564560
{
565-
/**
566-
* Calculate the message delay.
567-
*/
561+
// Calculate the message delay.
568562
const int message_delay = (int)(RulesClass::Instance->MessageDelay * 900);
569563

570-
/**
571-
* Send the message.
572-
*/
564+
// Send the message.
573565
MessageListClass::Instance.AddMessage(nullptr, 0, L"Saving game...", 4, TextPrintType::Point6Grad | TextPrintType::UseGradPal | TextPrintType::FullShadow, message_delay, false);
574566

575-
/**
576-
* Force a redraw so that our message gets printed.
577-
*/
567+
// Force a redraw so that our message gets printed.
578568
MapClass::Instance.MarkNeedsRedraw(2);
579569
MapClass::Instance.Render();
580570
}
@@ -592,12 +582,10 @@ void Spawner::After_Main_Loop()
592582
{
593583
auto pConfig = Spawner::GetConfig();
594584

595-
const bool doSaveCampaign = SessionClass::Instance.GameMode == GameMode::Campaign && pConfig->AutoSaveCount > 0 && pConfig->AutoSaveInterval > 0;
585+
const bool doSaveCampaign = SessionClass::Instance.GameMode == GameMode::Campaign && pConfig->AutoSaveCount > 0 && pConfig->AutoSaveInterval > 0;
596586
const bool doSaveMP = Spawner::Active && SessionClass::Instance.GameMode == GameMode::LAN && pConfig->AutoSaveInterval > 0;
597587

598-
/**
599-
* Schedule to make a save if it's time to autosave.
600-
*/
588+
// Schedule to make a save if it's time to autosave.
601589
if (doSaveCampaign || doSaveMP)
602590
{
603591
if (Unsorted::CurrentFrame == Spawner::NextAutoSaveFrame)
@@ -608,60 +596,40 @@ void Spawner::After_Main_Loop()
608596

609597
if (Spawner::DoSave)
610598
{
611-
612599
Print_Saving_Game_Message();
613600

614-
/**
615-
* Campaign autosave.
616-
*/
601+
// Campaign autosave.
617602
if (SessionClass::Instance.GameMode == GameMode::Campaign)
618603
{
619604
static char saveFileName[32];
620605
static wchar_t saveDescription[32];
621606

622-
/**
623-
* Prepare the save name and description.
624-
*/
607+
// Prepare the save name and description.
625608
std::sprintf(saveFileName, "AUTOSAVE%d.SAV", Spawner::NextAutoSaveNumber + 1);
626609
std::swprintf(saveDescription, L"Mission Auto-Save (Slot %d)", Spawner::NextAutoSaveNumber + 1);
627610

628-
/**
629-
* Pause the mission timer.
630-
*/
611+
// Pause the mission timer.
631612
ScenarioClass::PauseGame();
632613
Game::CallBack();
633614

634-
/**
635-
* Save!
636-
*/
615+
// Save!
637616
ScenarioClass::Instance->SaveGame(saveFileName, saveDescription);
638617

639-
/**
640-
* Unpause the mission timer.
641-
*/
618+
// Unpause the mission timer.
642619
ScenarioClass::ResumeGame();
643620

644-
/**
645-
* Increment the autosave number.
646-
*/
621+
// Increment the autosave number.
647622
Spawner::NextAutoSaveNumber = (Spawner::NextAutoSaveNumber + 1) % pConfig->AutoSaveCount;
648623

649-
/**
650-
* Schedule the next autosave.
651-
*/
624+
// Schedule the next autosave.
652625
Spawner::NextAutoSaveFrame = Unsorted::CurrentFrame + pConfig->AutoSaveInterval;
653626
}
654627
else if (SessionClass::Instance.GameMode == GameMode::LAN)
655628
{
656-
657-
/**
658-
* Save!
659-
*/
629+
// Save!
660630
ScenarioClass::Instance->SaveGame("SAVEGAME.NET", L"Multiplayer Game");
661631

662-
/**
663-
* Schedule the next autosave.
664-
*/
632+
// Schedule the next autosave.
665633
Spawner::NextAutoSaveFrame = Unsorted::CurrentFrame + pConfig->AutoSaveInterval;
666634
}
667635

0 commit comments

Comments
 (0)