Rename editor component Init to OnInit

This matches the naming convention used for client components and the
`GameServer()->OnInit()`
This commit is contained in:
ChillerDragon 2024-07-27 22:03:19 +08:00
parent 9b08eda763
commit 3c5320aa90
16 changed files with 25 additions and 25 deletions

View file

@ -42,7 +42,7 @@ static int HashLocation(uint32_t Seed, uint32_t Run, uint32_t Rule, uint32_t X,
CAutoMapper::CAutoMapper(CEditor *pEditor) CAutoMapper::CAutoMapper(CEditor *pEditor)
{ {
Init(pEditor); OnInit(pEditor);
} }
void CAutoMapper::Load(const char *pTileName) void CAutoMapper::Load(const char *pTileName)

View file

@ -14,7 +14,7 @@ void CEditorComponent::InitSubComponents()
{ {
for(CEditorComponent &Component : m_vSubComponents) for(CEditorComponent &Component : m_vSubComponents)
{ {
Component.Init(Editor()); Component.OnInit(Editor());
} }
} }

View file

@ -8324,15 +8324,15 @@ void CEditor::Init()
m_PopupEventWasActivated = false; m_PopupEventWasActivated = false;
}); });
m_RenderTools.Init(m_pGraphics, m_pTextRender); m_RenderTools.Init(m_pGraphics, m_pTextRender);
m_ZoomEnvelopeX.Init(this); m_ZoomEnvelopeX.OnInit(this);
m_ZoomEnvelopeY.Init(this); m_ZoomEnvelopeY.OnInit(this);
m_Map.m_pEditor = this; m_Map.m_pEditor = this;
m_vComponents.emplace_back(m_MapView); m_vComponents.emplace_back(m_MapView);
m_vComponents.emplace_back(m_MapSettingsBackend); m_vComponents.emplace_back(m_MapSettingsBackend);
m_vComponents.emplace_back(m_LayerSelector); m_vComponents.emplace_back(m_LayerSelector);
for(CEditorComponent &Component : m_vComponents) for(CEditorComponent &Component : m_vComponents)
Component.Init(this); Component.OnInit(this);
m_CheckerTexture = Graphics()->LoadTexture("editor/checker.png", IStorage::TYPE_ALL); m_CheckerTexture = Graphics()->LoadTexture("editor/checker.png", IStorage::TYPE_ALL);
m_BackgroundTexture = Graphics()->LoadTexture("editor/background.png", IStorage::TYPE_ALL); m_BackgroundTexture = Graphics()->LoadTexture("editor/background.png", IStorage::TYPE_ALL);

View file

@ -2,7 +2,7 @@
#include "editor.h" #include "editor.h"
void CEditorObject::Init(CEditor *pEditor) void CEditorObject::OnInit(CEditor *pEditor)
{ {
m_pEditor = pEditor; m_pEditor = pEditor;
OnReset(); OnReset();

View file

@ -28,7 +28,7 @@ public:
* Needs to be the first function that is called. * Needs to be the first function that is called.
* The default implentation also resets the component. * The default implentation also resets the component.
*/ */
virtual void Init(CEditor *pEditor); virtual void OnInit(CEditor *pEditor);
/** /**
* Maybe calls `OnHot` or `OnActive`. * Maybe calls `OnHot` or `OnActive`.

View file

@ -1049,9 +1049,9 @@ void CEditor::MapSettingsDropdownRenderCallback(const SPossibleValueMatch &Match
CMapSettingsBackend::CContext *CMapSettingsBackend::ms_pActiveContext = nullptr; CMapSettingsBackend::CContext *CMapSettingsBackend::ms_pActiveContext = nullptr;
void CMapSettingsBackend::Init(CEditor *pEditor) void CMapSettingsBackend::OnInit(CEditor *pEditor)
{ {
CEditorComponent::Init(pEditor); CEditorComponent::OnInit(pEditor);
// Register values loader // Register values loader
InitValueLoaders(); InitValueLoaders();

View file

@ -198,7 +198,7 @@ class CMapSettingsBackend : public CEditorComponent
public: // General methods public: // General methods
CMapSettingsBackend() = default; CMapSettingsBackend() = default;
void Init(CEditor *pEditor) override; void OnInit(CEditor *pEditor) override;
bool OnInput(const IInput::CEvent &Event) override; bool OnInput(const IInput::CEvent &Event) override;
void OnUpdate() override; void OnUpdate() override;
void OnMapLoad() override; void OnMapLoad() override;

View file

@ -2,9 +2,9 @@
#include "layer_selector.h" #include "layer_selector.h"
void CLayerSelector::Init(CEditor *pEditor) void CLayerSelector::OnInit(CEditor *pEditor)
{ {
CEditorComponent::Init(pEditor); CEditorComponent::OnInit(pEditor);
m_SelectionOffset = 0; m_SelectionOffset = 0;
} }

View file

@ -8,7 +8,7 @@ class CLayerSelector : public CEditorComponent
int m_SelectionOffset; int m_SelectionOffset;
public: public:
void Init(CEditor *pEditor) override; void OnInit(CEditor *pEditor) override;
bool SelectByTile(); bool SelectByTile();
}; };

View file

@ -8,9 +8,9 @@
#include "editor.h" #include "editor.h"
void CMapView::Init(CEditor *pEditor) void CMapView::OnInit(CEditor *pEditor)
{ {
CEditorComponent::Init(pEditor); CEditorComponent::OnInit(pEditor);
RegisterSubComponent(m_MapGrid); RegisterSubComponent(m_MapGrid);
RegisterSubComponent(m_ProofMode); RegisterSubComponent(m_ProofMode);
InitSubComponents(); InitSubComponents();
@ -19,7 +19,7 @@ void CMapView::Init(CEditor *pEditor)
void CMapView::OnReset() void CMapView::OnReset()
{ {
m_Zoom = CSmoothValue(200.0f, 10.0f, 2000.0f); m_Zoom = CSmoothValue(200.0f, 10.0f, 2000.0f);
m_Zoom.Init(Editor()); m_Zoom.OnInit(Editor());
m_WorldZoom = 1.0f; m_WorldZoom = 1.0f;
SetWorldOffset({0, 0}); SetWorldOffset({0, 0});

View file

@ -13,7 +13,7 @@ class CLayerGroup;
class CMapView : public CEditorComponent class CMapView : public CEditorComponent
{ {
public: public:
void Init(CEditor *pEditor) override; void OnInit(CEditor *pEditor) override;
void OnReset() override; void OnReset() override;
void OnMapLoad() override; void OnMapLoad() override;

View file

@ -5,7 +5,7 @@
CEditorImage::CEditorImage(CEditor *pEditor) : CEditorImage::CEditorImage(CEditor *pEditor) :
m_AutoMapper(pEditor) m_AutoMapper(pEditor)
{ {
Init(pEditor); OnInit(pEditor);
m_Texture.Invalidate(); m_Texture.Invalidate();
} }
@ -16,9 +16,9 @@ CEditorImage::~CEditorImage()
m_pData = nullptr; m_pData = nullptr;
} }
void CEditorImage::Init(CEditor *pEditor) void CEditorImage::OnInit(CEditor *pEditor)
{ {
CEditorComponent::Init(pEditor); CEditorComponent::OnInit(pEditor);
RegisterSubComponent(m_AutoMapper); RegisterSubComponent(m_AutoMapper);
InitSubComponents(); InitSubComponents();
} }

View file

@ -12,7 +12,7 @@ public:
explicit CEditorImage(CEditor *pEditor); explicit CEditorImage(CEditor *pEditor);
~CEditorImage(); ~CEditorImage();
void Init(CEditor *pEditor) override; void OnInit(CEditor *pEditor) override;
void AnalyseTileFlags(); void AnalyseTileFlags();
bool DataEquals(const CEditorImage &Other) const; bool DataEquals(const CEditorImage &Other) const;

View file

@ -4,7 +4,7 @@
CEditorSound::CEditorSound(CEditor *pEditor) CEditorSound::CEditorSound(CEditor *pEditor)
{ {
Init(pEditor); OnInit(pEditor);
} }
CEditorSound::~CEditorSound() CEditorSound::~CEditorSound()

View file

@ -4,9 +4,9 @@
#include "editor.h" #include "editor.h"
void CProofMode::Init(CEditor *pEditor) void CProofMode::OnInit(CEditor *pEditor)
{ {
CEditorComponent::Init(pEditor); CEditorComponent::OnInit(pEditor);
SetMenuBackgroundPositionNames(); SetMenuBackgroundPositionNames();
OnReset(); OnReset();
OnMapLoad(); OnMapLoad();

View file

@ -6,7 +6,7 @@
class CProofMode : public CEditorComponent class CProofMode : public CEditorComponent
{ {
public: public:
void Init(CEditor *pEditor) override; void OnInit(CEditor *pEditor) override;
void OnReset() override; void OnReset() override;
void OnMapLoad() override; void OnMapLoad() override;
void RenderScreenSizes(); void RenderScreenSizes();