Another consistency pass

- change NotifyObject to use u16 string
- move stuff to header that is inline
- use u16strings instead of converting to u16 string
- move entity to dEntity
This commit is contained in:
David Markowitz
2023-06-16 01:01:13 -07:00
parent 9a9b9aa813
commit 92006123b8
29 changed files with 142 additions and 183 deletions

View File

@@ -1,6 +1,7 @@
#include "NjRailPostServer.h"
#include "QuickBuildComponent.h"
#include "EntityManager.h"
#include "Entity.h"
void NjRailPostServer::OnStartup(Entity* self) {
auto* quickBuildComponent = self->GetComponent<QuickBuildComponent>();
@@ -9,11 +10,11 @@ void NjRailPostServer::OnStartup(Entity* self) {
}
}
void NjRailPostServer::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1,
void NjRailPostServer::OnNotifyObject(Entity* self, Entity* sender, const std::u16string& name, int32_t param1,
int32_t param2) {
if (name == "PostRebuilt") {
if (name == u"PostRebuilt") {
self->SetNetworkVar<bool>(NetworkNotActiveVariable, false);
} else if (name == "PostDied") {
} else if (name == u"PostDied") {
self->SetNetworkVar<bool>(NetworkNotActiveVariable, true);
}
}
@@ -24,7 +25,7 @@ void NjRailPostServer::OnRebuildNotifyState(Entity* self, eRebuildState state) {
if (relatedRail == nullptr)
return;
relatedRail->NotifyObject(self, "PostRebuilt");
relatedRail->NotifyObject(self, u"PostRebuilt");
if (self->GetVar<bool>(NotActiveVariable))
return;
@@ -35,7 +36,7 @@ void NjRailPostServer::OnRebuildNotifyState(Entity* self, eRebuildState state) {
if (relatedRail == nullptr)
return;
relatedRail->NotifyObject(self, "PostDied");
relatedRail->NotifyObject(self, u"PostDied");
}
}

View File

@@ -3,7 +3,7 @@
class NjRailPostServer : public CppScripts::Script {
void OnStartup(Entity* self) override;
void OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) override;
void OnNotifyObject(Entity* self, Entity* sender, const std::u16string& name, int32_t param1, int32_t param2) override;
void OnRebuildNotifyState(Entity* self, eRebuildState state) override;
private:
Entity* GetRelatedRail(Entity* self);