Skip to content

Commit a822d2a

Browse files
authored
Merge pull request #5016 from Goober5000/navpoint_fixes
initialize NavPoint properly
2 parents 386e068 + 5a674a7 commit a822d2a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

code/autopilot/autopilot.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,17 @@
2929
class NavPoint
3030
{
3131
public:
32-
char m_NavName[32];
33-
int flags;
34-
ubyte normal_color[3];
35-
ubyte visited_color[3];
32+
char m_NavName[32] = { 0 };
33+
int flags = 0;
34+
ubyte normal_color[3] = { 0x80, 0x80, 0xFF };
35+
ubyte visited_color[3] = { 0xFF, 0xFF, 0x00 };
3636

37-
const void *target_obj;
38-
int waypoint_num; //only used when flags & NP_WAYPOINT
37+
const void *target_obj = nullptr;
38+
int waypoint_num = -1; //only used when flags & NP_WAYPOINT
3939

4040
const vec3d *GetPosition();
4141

42+
// these assignments should match the initialization
4243
void clear()
4344
{
4445
m_NavName[0] = 0;

0 commit comments

Comments
 (0)