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)
{
Init(pEditor);
OnInit(pEditor);
}
void CAutoMapper::Load(const char *pTileName)

View file

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

View file

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

View file

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

View file

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

View file

@ -1049,9 +1049,9 @@ void CEditor::MapSettingsDropdownRenderCallback(const SPossibleValueMatch &Match
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
InitValueLoaders();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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