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

Function MultiUpdateRobotMovedList

Descent3/multi_server.cpp:2157–2184  ·  view source on GitHub ↗

Figures out which robots have moved since the last time this player slot was updated

Source from the content-addressed store, hash-verified

2155
2156// Figures out which robots have moved since the last time this player slot was updated
2157void MultiUpdateRobotMovedList(int slot) {
2158 bool skip_this_obj = false;
2159 // check for moved robots
2160 for (int a = 0; a <= Highest_object_index; a++) {
2161 object *obj = &Objects[a];
2162 if (obj->type == OBJ_NONE)
2163 continue;
2164
2165 if (MultiIsValidMovedObject(obj)) {
2166 if ((obj->flags & OF_MOVED_THIS_FRAME)) {
2167 skip_this_obj = false;
2168 // mprintf(0,"Object %d (type=%d) moved this frame!\n",a,obj->type);
2169 // Check to see if this robot is on the list already
2170 for (int b = 0; b < Num_moved_robots[slot] && !skip_this_obj; b++) {
2171 if (Moved_robots[slot][b] == obj->handle) {
2172 skip_this_obj = true;
2173 }
2174 }
2175
2176 if (!skip_this_obj) {
2177 Moved_robots[slot][Num_moved_robots[slot]] = obj->handle;
2178 ASSERT(Objects[a].flags & OF_CLIENT_KNOWS);
2179 Num_moved_robots[slot]++;
2180 }
2181 }
2182 }
2183 }
2184}
2185
2186// Sets up our data structures so that the nonvisible robots will be sent when they are needed
2187void MultiSetupNonVisRobots(int slot, object *obj) { obj->generic_nonvis_flags |= (1 << slot); }

Callers 1

MultiDoServerFrameFunction · 0.85

Calls 1

MultiIsValidMovedObjectFunction · 0.85

Tested by

no test coverage detected