Skip to content

Commit

Permalink
proper class variable initialization in constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyrAhmady committed May 18, 2024
1 parent 8b868ac commit 4160bce
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Server/Components/NPCs/NPC/npc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ float getAngleOfLine(float x, float y)
}

NPC::NPC(NPCComponent* component, IPlayer* playerPtr)
: moveType_(NPCMoveType_None)
, estimatedArrivalTimeNS_(0)
, moveSpeed_(0.0f)
, targetPosition_({ 0.0f, 0.0f, 0.0f })
, velocity_({ 0.0f, 0.0f, 0.0f })
, moving_(false)
{
// Keep a handle of NPC copmonent instance internally
npcComponent_ = component;
Expand All @@ -39,9 +45,6 @@ NPC::NPC(NPCComponent* component, IPlayer* playerPtr)
// Initial entity values
Vector3 initialPosition = { 0.0f, 0.0f, 3.5f };
GTAQuat initialRotation = { 0.960891485f, 0.0f, 0.0f, 0.276925147f };
moving_ = false;
velocity_ = { 0.0f, 0.0f, 0.0f };
moveType_ = NPCMoveType_None;

// Initial values for foot sync values
footSync_.LeftRight = 0;
Expand Down

0 comments on commit 4160bce

Please sign in to comment.