Skip to content

Commit

Permalink
Merge pull request ddnet#8656 from ChillerDragon/pr_editor_oninit
Browse files Browse the repository at this point in the history
Rename editor component `Init` to `OnInit`
  • Loading branch information
Robyt3 authored Jul 27, 2024
2 parents 9b08eda + 3c5320a commit 78cbb45
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/game/editor/auto_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/game/editor/component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void CEditorComponent::InitSubComponents()
{
for(CEditorComponent &Component : m_vSubComponents)
{
Component.Init(Editor());
Component.OnInit(Editor());
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/game/editor/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/game/editor/editor_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "editor.h"

void CEditorObject::Init(CEditor *pEditor)
void CEditorObject::OnInit(CEditor *pEditor)
{
m_pEditor = pEditor;
OnReset();
Expand Down
2 changes: 1 addition & 1 deletion src/game/editor/editor_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class CEditorObject
* 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`.
Expand Down
4 changes: 2 additions & 2 deletions src/game/editor/editor_server_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/game/editor/editor_server_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/game/editor/layer_selector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/editor/layer_selector.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CLayerSelector : public CEditorComponent
int m_SelectionOffset;

public:
void Init(CEditor *pEditor) override;
void OnInit(CEditor *pEditor) override;
bool SelectByTile();
};

Expand Down
6 changes: 3 additions & 3 deletions src/game/editor/map_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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});
Expand Down
2 changes: 1 addition & 1 deletion src/game/editor/map_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions src/game/editor/mapitems/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
CEditorImage::CEditorImage(CEditor *pEditor) :
m_AutoMapper(pEditor)
{
Init(pEditor);
OnInit(pEditor);
m_Texture.Invalidate();
}

Expand All @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/editor/mapitems/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CEditorImage : public CImageInfo, public CEditorComponent
explicit CEditorImage(CEditor *pEditor);
~CEditorImage();

void Init(CEditor *pEditor) override;
void OnInit(CEditor *pEditor) override;
void AnalyseTileFlags();
bool DataEquals(const CEditorImage &Other) const;

Expand Down
2 changes: 1 addition & 1 deletion src/game/editor/mapitems/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

CEditorSound::CEditorSound(CEditor *pEditor)
{
Init(pEditor);
OnInit(pEditor);
}

CEditorSound::~CEditorSound()
Expand Down
4 changes: 2 additions & 2 deletions src/game/editor/proof_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/game/editor/proof_mode.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 78cbb45

Please sign in to comment.