Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add createBuilding for server #3897

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

TheNormalnij
Copy link
Member

@TheNormalnij TheNormalnij commented Dec 22, 2024

Closes #3716
Test resource: building_serverside.zip

@@ -129,8 +129,12 @@ class CClientGame
SCRIPTFILE,
WATER,
WEAPON,
POINTLIGHTS,
_DATABASE_CONNECTION, // server only
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not DATABASE_CONNECTION?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it's server only and unexpected on the client.

POINTLIGHTS,
_DATABASE_CONNECTION, // server only
TRAIN_TRACK,
ROOT,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ROOT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Synced with the server.

case CCLIENTBUILDING:
{
CClientBuilding* pBuilding = static_cast<CClientBuilding*>(pSource);
const unsigned short usCurrentModel = pBuilding->GetModel();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auto or std::uint16_t
currentModel instead of usCurrentModel?
building instead of pBuilding?

CClientBuilding* pBuilding = static_cast<CClientBuilding*>(pSource);
const unsigned short usCurrentModel = pBuilding->GetModel();

if (usCurrentModel != usModel)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

early break?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's ok with one break at the end of the block.

Comment on lines 34 to 35
CBuildingListType::const_iterator IterBegin() const { return m_List.begin(); };
CBuildingListType::const_iterator IterEnd() const { return m_List.end(); };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

begin() and end()
const noexcept
useless trailing ;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should share the same interface with another managers. It's useful for lambda functions

Copy link
Contributor

@TracerDS TracerDS Dec 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should share the same interface with another managers.

Understandable. Please make at least a begin and end methods for standard range based loop

It's useful for lambda functions

Not really since for range loops exist

@@ -82,6 +82,8 @@ class CElement
TRAIN_TRACK,
ROOT,
UNKNOWN,
BUILDING,
_POINTLIGHTS, // client only
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why _?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clientside only

Server/mods/deathmatch/logic/CGame.h Outdated Show resolved Hide resolved
Server/mods/deathmatch/logic/luadefs/CLuaBuildingDefs.cpp Outdated Show resolved Hide resolved
@TheNormalnij TheNormalnij marked this pull request as ready for review January 5, 2025 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding createBuilding server side
3 participants