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

Function DebugGraph_AddNode

Descent3/debuggraph.cpp:128–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126tDebugGraphNode *DebugGraphNode_root = NULL;
127
128tGraphNode *DebugGraph_AddNode(void) {
129 if (graph_num_nodes == MAX_GRAPH_NODES)
130 return NULL;
131
132 tDebugGraphNode *curr = DebugGraphNode_root;
133
134 if (!curr) {
135 curr = DebugGraphNode_root = (tDebugGraphNode *)mem_malloc(sizeof(tDebugGraphNode));
136 } else {
137 while (curr->next) {
138 curr = curr->next;
139 }
140 curr->next = (tDebugGraphNode *)mem_malloc(sizeof(tDebugGraphNode));
141 curr = curr->next;
142 }
143
144 if (!curr) {
145 Error("Out of Memory");
146 }
147
148 graph_num_nodes++;
149 curr->next = NULL;
150 curr->node = new tGraphNode;
151
152 if (!curr->node) {
153 Error("Out of Memory");
154 }
155
156 return curr->node;
157}
158
159tGraphNode *DebugGraph_FindNode(int index) {
160 if (index >= graph_num_nodes)

Callers 1

DebugGraph_AddFunction · 0.85

Calls 1

ErrorFunction · 0.85

Tested by

no test coverage detected