holy mother of const

Use const everywhere that makes sense
return const variables when it makes sense
const functions and variables again, where it makes sense
No raw access and modifications to protected members
Move template definitions to tcc file

idk how I feel about this one
This commit is contained in:
EmosewaMC
2023-06-09 01:04:42 -07:00
parent d11e2db887
commit ec00f5fd9d
28 changed files with 334 additions and 336 deletions

View File

@@ -30,7 +30,7 @@
#include "UpdateActionMessage.h"
#include "UpdateStripUiMessage.h"
void ControlBehaviors::RequestUpdatedID(int32_t behaviorID, std::shared_ptr<ModelBehaviorComponent> modelComponent, Entity* modelOwner, const SystemAddress& sysAddr) {
void ControlBehaviors::RequestUpdatedID(int32_t behaviorID, ModelBehaviorComponent* modelComponent, Entity* modelOwner, const SystemAddress& sysAddr) {
// auto behavior = modelComponent->FindBehavior(behaviorID);
// if (behavior->GetBehaviorID() == -1 || behavior->GetShouldSetNewID()) {
// ObjectIDManager::Instance()->RequestPersistentID(
@@ -79,7 +79,7 @@ void ControlBehaviors::SendBehaviorListToClient(Entity* modelEntity, const Syste
GameMessages::SendUIMessageServerToSingleClient(modelOwner, sysAddr, "UpdateBehaviorList", behaviorsToSerialize);
}
void ControlBehaviors::ModelTypeChanged(AMFArrayValue* arguments, std::shared_ptr<ModelBehaviorComponent> ModelBehaviorComponent) {
void ControlBehaviors::ModelTypeChanged(AMFArrayValue* arguments, ModelBehaviorComponent* ModelComponent) {
auto* modelTypeAmf = arguments->Get<double>("ModelType");
if (!modelTypeAmf) return;
@@ -137,7 +137,7 @@ void ControlBehaviors::Rename(Entity* modelEntity, const SystemAddress& sysAddr,
}
// TODO This is also supposed to serialize the state of the behaviors in progress but those aren't implemented yet
void ControlBehaviors::SendBehaviorBlocksToClient(std::shared_ptr<ModelBehaviorComponent> modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments) {
void ControlBehaviors::SendBehaviorBlocksToClient(ModelBehaviorComponent* modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments) {
// uint32_t behaviorID = ControlBehaviors::GetBehaviorIDFromArgument(arguments);
// auto modelBehavior = modelComponent->FindBehavior(behaviorID);
@@ -266,7 +266,7 @@ void ControlBehaviors::UpdateAction(AMFArrayValue* arguments) {
}
}
void ControlBehaviors::MoveToInventory(std::shared_ptr<ModelBehaviorComponent> modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments) {
void ControlBehaviors::MoveToInventory(ModelBehaviorComponent* modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments) {
// This closes the UI menu should it be open while the player is removing behaviors
AMFArrayValue args;

View File

@@ -41,9 +41,9 @@ public:
*/
BlockDefinition* GetBlockInfo(const BlockName& blockName);
private:
void RequestUpdatedID(int32_t behaviorID, std::shared_ptr<ModelBehaviorComponent> modelComponent, Entity* modelOwner, const SystemAddress& sysAddr);
void RequestUpdatedID(int32_t behaviorID, ModelBehaviorComponent* modelComponent, Entity* modelOwner, const SystemAddress& sysAddr);
void SendBehaviorListToClient(Entity* modelEntity, const SystemAddress& sysAddr, Entity* modelOwner);
void ModelTypeChanged(AMFArrayValue* arguments, std::shared_ptr<ModelBehaviorComponent> ModelBehaviorComponent);
void ModelTypeChanged(AMFArrayValue* arguments, ModelBehaviorComponent* ModelComponent);
void ToggleExecutionUpdates();
void AddStrip(AMFArrayValue* arguments);
void RemoveStrip(AMFArrayValue* arguments);
@@ -56,9 +56,9 @@ private:
void Add(AMFArrayValue* arguments);
void RemoveActions(AMFArrayValue* arguments);
void Rename(Entity* modelEntity, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments);
void SendBehaviorBlocksToClient(std::shared_ptr<ModelBehaviorComponent> modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments);
void SendBehaviorBlocksToClient(ModelBehaviorComponent* modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments);
void UpdateAction(AMFArrayValue* arguments);
void MoveToInventory(std::shared_ptr<ModelBehaviorComponent> modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments);
void MoveToInventory(ModelBehaviorComponent* modelComponent, const SystemAddress& sysAddr, Entity* modelOwner, AMFArrayValue* arguments);
std::map<BlockName, BlockDefinition*> blockTypes{};
// If false, property behaviors will not be able to be edited.