Implement various manager resets (#1112)

This commit is contained in:
Duncan 2021-08-16 14:19:53 +01:00 committed by GitHub
parent 51789bd329
commit f4f3d0d72c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 3 deletions

View File

@ -4,6 +4,7 @@
#include "Math/Vector.hpp"
#include "Objects/IndustryObject.h"
#include "OpenLoco.h"
#include "Ui/WindowManager.h"
using namespace OpenLoco::Interop;
@ -14,7 +15,11 @@ namespace OpenLoco::IndustryManager
// 0x00453214
void reset()
{
call(0x00453214);
for (auto& industry : _industries)
{
industry.name = StringIds::null;
}
Ui::Windows::IndustryList::reset();
}
LocoFixedVector<Industry> industries()

View File

@ -24,7 +24,11 @@ namespace OpenLoco::StationManager
// 0x0048B1D8
void reset()
{
call(0x0048B1D8);
for (auto& station : _stations)
{
station.name = StringIds::null;
}
Ui::Windows::Station::reset();
}
LocoFixedVector<Station> stations()

View File

@ -167,6 +167,7 @@ namespace OpenLoco::Ui::Windows
namespace IndustryList
{
Window* open();
void reset();
}
namespace KeyboardShortcuts
@ -280,6 +281,7 @@ namespace OpenLoco::Ui::Windows
namespace Station
{
Window* open(uint16_t id);
void reset();
void showStationCatchment(uint16_t windowNumber);
}

View File

@ -116,10 +116,19 @@ namespace OpenLoco::Ui::Windows::Construction::Construction
static std::optional<TrackPieceId> getRoadPieceId(uint8_t trackPiece, uint8_t gradient, uint8_t rotation);
static std::optional<TrackPieceId> getTrackPieceId(uint8_t trackPiece, uint8_t gradient, uint8_t rotation);
static loco_global<uint8_t, 0x00525FB0> _pickupDirection; // From Vehicle.cpp window
// 0x0049B50C
void reset()
{
call(0x0049B50C);
std::fill(std::begin(_scenarioSignals), std::end(_scenarioSignals), 0xFF);
std::fill(std::begin(_scenarioBridges), std::end(_scenarioBridges), 0xFF);
std::fill(std::begin(_scenarioTrainStations), std::end(_scenarioTrainStations), 0xFF);
std::fill(std::begin(_scenarioTrackMods), std::end(_scenarioTrackMods), 0xFF);
_lastAirport = 0xFF;
_lastShipPort = 0xFF;
_pickupDirection = 0;
}
// 0x0049F92D

View File

@ -570,6 +570,11 @@ namespace OpenLoco::Ui::Windows::IndustryList
return window;
}
void reset()
{
_lastSelectedIndustry = 0xFF;
}
namespace NewIndustries
{

View File

@ -310,6 +310,11 @@ namespace OpenLoco::Ui::Windows::Station
return window;
}
void reset()
{
_lastSelectedStation = StationId::null;
}
namespace Cargo
{
enum widx