MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / AllocGamePath

Function AllocGamePath

editor/EPath.cpp:89–114  ·  view source on GitHub ↗

Allocs a gamepath that a robot will follow. Returns an index into the GamePaths array

Source from the content-addressed store, hash-verified

87// Allocs a gamepath that a robot will follow. Returns an index into the GamePaths
88// array
89int AllocGamePath() {
90 int i;
91
92 if (Viewer_object->flags & OF_OUTSIDE_MINE) {
93 OutrageMessageBox("You must be in a room or on the terrain to create a path");
94 return -1;
95 }
96
97 for (i = 0; i < MAX_GAME_PATHS; i++) {
98 if (GamePaths[i].used == 0) {
99 GamePaths[i].used = 1;
100 GamePaths[i].name[0] = 0;
101 GamePaths[i].num_nodes = 0;
102 GamePaths[i].flags = 0;
103
104 GamePaths[i].pathnodes = (node *)mem_malloc(MAX_NODES_PER_PATH * sizeof(node));
105 mprintf(0, "Path %d got some\n", i);
106
107 Num_game_paths++;
108 return i;
109 }
110 }
111
112 OutrageMessageBox("ERROR: Too many paths to add another.");
113 return -1;
114}
115
116int MovePathNode(int pathnum, int nodenum, vector *delta_pos) {
117 vector attempted_pos = GamePaths[pathnum].pathnodes[nodenum].pos + *delta_pos;

Callers 1

OnPathpadAddPathMethod · 0.85

Calls 1

OutrageMessageBoxFunction · 0.85

Tested by

no test coverage detected