mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 10:21:57 -05:00
Rename the callback types
This commit is contained in:
parent
53d1c27771
commit
9dfd4f3b19
14 changed files with 30 additions and 30 deletions
|
@ -246,7 +246,7 @@ public:
|
|||
{
|
||||
uint32_t type = intent->GetUIntExtra(INTENT_EXTRA_LOADSAVE_TYPE);
|
||||
std::string defaultName = intent->GetStringExtra(INTENT_EXTRA_PATH);
|
||||
loadsave_callback callback = reinterpret_cast<loadsave_callback>(
|
||||
LoadSaveCallback callback = reinterpret_cast<LoadSaveCallback>(
|
||||
intent->GetCloseCallbackExtra(INTENT_EXTRA_CALLBACK));
|
||||
TrackDesign* trackDesign = static_cast<TrackDesign*>(intent->GetPointerExtra(INTENT_EXTRA_TRACK_DESIGN));
|
||||
auto* w = LoadsaveOpen(
|
||||
|
@ -265,7 +265,7 @@ public:
|
|||
case WindowClass::NetworkStatus:
|
||||
{
|
||||
std::string message = intent->GetStringExtra(INTENT_EXTRA_MESSAGE);
|
||||
close_callback callback = intent->GetCloseCallbackExtra(INTENT_EXTRA_CALLBACK);
|
||||
CloseCallback callback = intent->GetCloseCallbackExtra(INTENT_EXTRA_CALLBACK);
|
||||
return NetworkStatusOpen(message, callback);
|
||||
}
|
||||
case WindowClass::ObjectLoadError:
|
||||
|
@ -294,7 +294,7 @@ public:
|
|||
}
|
||||
case WindowClass::ScenarioSelect:
|
||||
return ScenarioselectOpen(
|
||||
reinterpret_cast<scenarioselect_callback>(intent->GetCloseCallbackExtra(INTENT_EXTRA_CALLBACK)));
|
||||
reinterpret_cast<ScenarioSelectCallback>(intent->GetCloseCallbackExtra(INTENT_EXTRA_CALLBACK)));
|
||||
|
||||
case WindowClass::Null:
|
||||
// Intent does not hold a window class
|
||||
|
@ -335,7 +335,7 @@ public:
|
|||
case INTENT_ACTION_PROGRESS_OPEN:
|
||||
{
|
||||
std::string message = intent->GetStringExtra(INTENT_EXTRA_MESSAGE);
|
||||
close_callback callback = intent->GetCloseCallbackExtra(INTENT_EXTRA_CALLBACK);
|
||||
CloseCallback callback = intent->GetCloseCallbackExtra(INTENT_EXTRA_CALLBACK);
|
||||
return ProgressWindowOpen(message, callback);
|
||||
}
|
||||
|
||||
|
|
|
@ -942,7 +942,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
auto intent = Intent(WindowClass::Loadsave);
|
||||
intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_HEIGHTMAP);
|
||||
intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast<close_callback>(HeightmapLoadsaveCallback));
|
||||
intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast<CloseCallback>(HeightmapLoadsaveCallback));
|
||||
ContextOpenIntent(&intent);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
DrawText(dpi, screenCoords, { COLOUR_BLACK }, _buffer.c_str());
|
||||
}
|
||||
|
||||
void SetCloseCallBack(close_callback onClose)
|
||||
void SetCloseCallBack(CloseCallback onClose)
|
||||
{
|
||||
_onClose = onClose;
|
||||
}
|
||||
|
@ -127,12 +127,12 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
|
||||
private:
|
||||
close_callback _onClose = nullptr;
|
||||
CloseCallback _onClose = nullptr;
|
||||
std::string _windowNetworkStatusText;
|
||||
std::string _password;
|
||||
};
|
||||
|
||||
WindowBase* NetworkStatusOpen(const std::string& text, close_callback onClose)
|
||||
WindowBase* NetworkStatusOpen(const std::string& text, CloseCallback onClose)
|
||||
{
|
||||
ContextForceCloseWindowByClass(WindowClass::ProgressWindow);
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
class ProgressWindow final : public Window
|
||||
{
|
||||
private:
|
||||
close_callback _onClose = nullptr;
|
||||
CloseCallback _onClose = nullptr;
|
||||
|
||||
StringId _progressFormat;
|
||||
std::string _progressTitle;
|
||||
|
@ -213,7 +213,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
Invalidate();
|
||||
}
|
||||
|
||||
void SetCloseCallback(close_callback onClose)
|
||||
void SetCloseCallback(CloseCallback onClose)
|
||||
{
|
||||
_onClose = onClose;
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
};
|
||||
|
||||
WindowBase* ProgressWindowOpen(const std::string& text, close_callback onClose)
|
||||
WindowBase* ProgressWindowOpen(const std::string& text, CloseCallback onClose)
|
||||
{
|
||||
ContextForceCloseWindowByClass(WindowClass::NetworkStatus);
|
||||
|
||||
|
|
|
@ -5456,7 +5456,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_TRACK);
|
||||
intent.PutExtra(INTENT_EXTRA_TRACK_DESIGN, _trackDesign.get());
|
||||
intent.PutExtra(INTENT_EXTRA_PATH, trackName);
|
||||
intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast<close_callback>(&TrackDesignCallback));
|
||||
intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast<CloseCallback>(&TrackDesignCallback));
|
||||
|
||||
ContextOpenIntent(&intent);
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
intent = CreateSaveGameAsIntent();
|
||||
}
|
||||
Close();
|
||||
intent->PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast<close_callback>(WindowSavePromptCallback));
|
||||
intent->PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast<CloseCallback>(WindowSavePromptCallback));
|
||||
ContextOpenIntent(intent.get());
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -761,7 +761,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
};
|
||||
|
||||
WindowBase* ScenarioselectOpen(scenarioselect_callback callback)
|
||||
WindowBase* ScenarioselectOpen(ScenarioSelectCallback callback)
|
||||
{
|
||||
return ScenarioselectOpen([callback](std::string_view scenario) { callback(std::string(scenario).c_str()); });
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
NetworkSetPassword(_password);
|
||||
auto intent = Intent(WindowClass::Loadsave);
|
||||
intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME);
|
||||
intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast<close_callback>(LoadSaveCallback));
|
||||
intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast<CloseCallback>(LoadSaveCallback));
|
||||
ContextOpenIntent(&intent);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ struct Vehicle;
|
|||
enum class GuestListFilterType : int32_t;
|
||||
enum class ScatterToolDensity : uint8_t;
|
||||
|
||||
using loadsave_callback = void (*)(int32_t result, const utf8* path);
|
||||
using scenarioselect_callback = void (*)(const utf8* path);
|
||||
using LoadSaveCallback = void (*)(int32_t result, const utf8* path);
|
||||
using ScenarioSelectCallback = void (*)(const utf8* path);
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -118,7 +118,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
WindowBase* GuestListOpen();
|
||||
WindowBase* GuestListOpenWithFilter(GuestListFilterType type, int32_t index);
|
||||
WindowBase* StaffFirePromptOpen(Peep* peep);
|
||||
WindowBase* ScenarioselectOpen(scenarioselect_callback callback);
|
||||
WindowBase* ScenarioselectOpen(ScenarioSelectCallback callback);
|
||||
WindowBase* ScenarioselectOpen(std::function<void(std::string_view)> callback);
|
||||
|
||||
WindowBase* ErrorOpen(StringId title, StringId message, const class Formatter& formatter, bool autoClose = false);
|
||||
|
@ -174,11 +174,11 @@ namespace OpenRCT2::Ui::Windows
|
|||
WindowBase* MazeConstructionOpen();
|
||||
void WindowMazeConstructionUpdatePressedWidgets();
|
||||
|
||||
WindowBase* NetworkStatusOpen(const std::string& text, close_callback onClose);
|
||||
WindowBase* NetworkStatusOpen(const std::string& text, CloseCallback onClose);
|
||||
WindowBase* NetworkStatusOpenPassword();
|
||||
void WindowNetworkStatusClose();
|
||||
|
||||
WindowBase* ProgressWindowOpen(const std::string& text, close_callback onClose = nullptr);
|
||||
WindowBase* ProgressWindowOpen(const std::string& text, CloseCallback onClose = nullptr);
|
||||
void ProgressWindowSet(uint32_t currentProgress, uint32_t totalCount, StringId format = STR_NONE);
|
||||
void ProgressWindowClose();
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ namespace OpenRCT2::Editor
|
|||
ToolCancel();
|
||||
auto intent = Intent(WindowClass::Loadsave);
|
||||
intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME);
|
||||
intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast<close_callback>(ConvertSaveToScenarioCallback));
|
||||
intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast<CloseCallback>(ConvertSaveToScenarioCallback));
|
||||
ContextOpenIntent(&intent);
|
||||
}
|
||||
|
||||
|
|
|
@ -654,7 +654,7 @@ void GameLoadOrQuitNoSavePrompt()
|
|||
{
|
||||
auto intent = Intent(WindowClass::Loadsave);
|
||||
intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_LOAD | LOADSAVETYPE_GAME);
|
||||
intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast<close_callback>(GameLoadOrQuitNoSavePromptCallback));
|
||||
intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast<CloseCallback>(GameLoadOrQuitNoSavePromptCallback));
|
||||
ContextOpenIntent(&intent);
|
||||
}
|
||||
break;
|
||||
|
@ -683,7 +683,7 @@ void GameLoadOrQuitNoSavePrompt()
|
|||
GameActions::Execute(&loadOrQuitAction);
|
||||
ToolCancel();
|
||||
auto intent = Intent(WindowClass::ScenarioSelect);
|
||||
intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast<close_callback>(NewGameWindowCallback));
|
||||
intent.PutExtra(INTENT_EXTRA_CALLBACK, reinterpret_cast<CloseCallback>(NewGameWindowCallback));
|
||||
ContextOpenIntent(&intent);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -445,7 +445,7 @@ extern Tool gCurrentToolId;
|
|||
extern WidgetRef gCurrentToolWidget;
|
||||
|
||||
using modal_callback = void (*)(int32_t result);
|
||||
using close_callback = void (*)();
|
||||
using CloseCallback = void (*)();
|
||||
|
||||
constexpr int8_t kWindowLimitMin = 4;
|
||||
constexpr int8_t kWindowLimitMax = 64;
|
||||
|
|
|
@ -82,7 +82,7 @@ Intent* Intent::PutExtra(uint32_t key, std::string value)
|
|||
return this;
|
||||
}
|
||||
|
||||
Intent* Intent::PutExtra(uint32_t key, close_callback value)
|
||||
Intent* Intent::PutExtra(uint32_t key, CloseCallback value)
|
||||
{
|
||||
putExtraImpl(_Data, key, value);
|
||||
return this;
|
||||
|
@ -123,7 +123,7 @@ std::string Intent::GetStringExtra(uint32_t key) const
|
|||
return getExtraImpl<std::string>(_Data, key);
|
||||
}
|
||||
|
||||
close_callback Intent::GetCloseCallbackExtra(uint32_t key) const
|
||||
CloseCallback Intent::GetCloseCallbackExtra(uint32_t key) const
|
||||
{
|
||||
return getExtraImpl<close_callback>(_Data, key);
|
||||
return getExtraImpl<CloseCallback>(_Data, key);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ enum IntentAction
|
|||
// The maximum amount of data the Intent can hold, 8 should be sufficient, raise this if needed.
|
||||
static constexpr size_t kIntentMaxDataSlots = 8;
|
||||
|
||||
using IntentData = std::variant<int64_t, std::string, close_callback, void*>;
|
||||
using IntentData = std::variant<int64_t, std::string, CloseCallback, void*>;
|
||||
using IntentDataEntry = std::pair<uint32_t, IntentData>;
|
||||
using IntentDataStorage = sfl::static_vector<IntentDataEntry, kIntentMaxDataSlots>;
|
||||
|
||||
|
@ -86,13 +86,13 @@ public:
|
|||
std::string GetStringExtra(uint32_t key) const;
|
||||
uint32_t GetUIntExtra(uint32_t key) const;
|
||||
int32_t GetSIntExtra(uint32_t key) const;
|
||||
close_callback GetCloseCallbackExtra(uint32_t key) const;
|
||||
CloseCallback GetCloseCallbackExtra(uint32_t key) const;
|
||||
|
||||
Intent* PutExtra(uint32_t key, uint32_t value);
|
||||
Intent* PutExtra(uint32_t key, void* value);
|
||||
Intent* PutExtra(uint32_t key, int32_t value);
|
||||
Intent* PutExtra(uint32_t key, std::string value);
|
||||
Intent* PutExtra(uint32_t key, close_callback value);
|
||||
Intent* PutExtra(uint32_t key, CloseCallback value);
|
||||
|
||||
template<typename T, T TNull, typename TTag>
|
||||
Intent* PutExtra(uint32_t key, const TIdentifier<T, TNull, TTag>& value)
|
||||
|
|
Loading…
Reference in a new issue