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

Function MultiDoNonVisGenericForSlot

Descent3/multi_server.cpp:2212–2320  ·  view source on GitHub ↗

Does the bookkeeping that needs to be done for non visible generic objects and a player

Source from the content-addressed store, hash-verified

2210
2211// Does the bookkeeping that needs to be done for non visible generic objects and a player
2212void MultiDoNonVisGenericForSlot(int slot) {
2213 // Keep track of the ones we need to send about
2214 uint16_t send_out[MAX_OBJECTS];
2215 int num_to_send = 0;
2216 int i;
2217
2218 // Deal with non-vis objects
2219 for (i = 0; i <= Highest_object_index; i++) {
2220 int objnum = i;
2221 object *obj = &Objects[i];
2222 if (obj->type == OBJ_NONE)
2223 continue;
2224
2225 if (obj->generic_nonvis_flags & (1 << slot)) {
2226 if (MultiIsValidMovedObject(obj)) {
2227 if (!(obj->generic_sent_nonvis & (1 << slot))) {
2228 ASSERT(obj->flags & OF_CLIENT_KNOWS);
2229 send_out[num_to_send++] = objnum;
2230 obj->generic_sent_nonvis |= (1 << slot);
2231 }
2232
2233 bool skip_this_obj = false;
2234 int b;
2235
2236 // For movement, Check to see if this robot is on the list already
2237 for (b = 0; b < Num_moved_robots[slot] && !skip_this_obj; b++) {
2238 if (Moved_robots[slot][b] == obj->handle) {
2239 skip_this_obj = true;
2240 }
2241 }
2242
2243 if (!skip_this_obj) {
2244 if (Num_moved_robots[slot] < MAX_CHANGED_OBJECTS) {
2245 Moved_robots[slot][Num_moved_robots[slot]] = obj->handle;
2246 ASSERT(Objects[i].flags & OF_CLIENT_KNOWS);
2247 Num_moved_robots[slot]++;
2248 }
2249 }
2250
2251 // Now do changed anim
2252 skip_this_obj = false;
2253 // Check to see if this robot is on the list already
2254 for (b = 0; b < Num_changed_anim[slot]; b++) {
2255 if (Changed_anim[b][slot] == Objects[objnum].handle) {
2256 skip_this_obj = true;
2257 break;
2258 }
2259 }
2260 if (skip_this_obj == false) {
2261 if (Num_changed_anim[slot] < MAX_CHANGED_OBJECTS) {
2262 Changed_anim[Num_changed_anim[slot]][slot] = Objects[objnum].handle;
2263 ASSERT(Objects[i].flags & OF_CLIENT_KNOWS);
2264 Num_changed_anim[slot]++;
2265 }
2266 }
2267
2268 // Now do changed turrets
2269 skip_this_obj = false;

Callers 1

MultiDoServerRobotFrameFunction · 0.85

Calls 2

MultiIsValidMovedObjectFunction · 0.85
MultiSendGenericNonVisFunction · 0.85

Tested by

no test coverage detected