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

Function MultiDoServerFrame

Descent3/multi_server.cpp:2546–2737  ·  view source on GitHub ↗

Does whatever the server needs to do for this frame

Source from the content-addressed store, hash-verified

2544#define MT_DATA_UPDATE_INTERVAL 300 // 300 seconds
2545// Does whatever the server needs to do for this frame
2546void MultiDoServerFrame() {
2547 int i;
2548
2549 if (Netgame.flags & NF_EXIT_NOW) {
2550 // DLL says we should bail!
2551 Netgame.flags &= ~NF_EXIT_NOW;
2552 MultiLeaveGame();
2553 SetFunctionMode(MENU_MODE);
2554 return;
2555 }
2556
2557 if (NetPlayers[Player_num].sequence == NETSEQ_PREGAME) {
2558 MultiFlushAllIncomingBuffers();
2559 NetPlayers[Player_num].sequence = NETSEQ_PLAYING;
2560
2561 Players[Player_num].time_in_game = timer_GetTime();
2562
2563 // Pick a start slot for me
2564 Players[Player_num].start_index = PlayerGetRandomStartPosition(Player_num);
2565 PlayerMoveToStartPos(Player_num, Players[Player_num].start_index);
2566
2567 // Update the tracker if it's a master tracker game
2568 CallMultiDLL(MT_EVT_FIRST_FRAME);
2569 if (Game_is_master_tracker_game) {
2570 NetPlayers[Player_num].flags |= NPF_MT_READING_PILOT;
2571 strcpy(MTPilotinfo[Player_num].tracker_id, Players[Player_num].tracker_id);
2572 strcpy(MTPilotinfo[Player_num].pilot_name, Players[Player_num].callsign);
2573 NetPlayers[Player_num].flags &= ~NPF_WROTE_RANK;
2574 }
2575
2576 if (Dedicated_server) // Make this player an observer
2577 PlayerSwitchToObserver(Player_num, OBSERVER_MODE_ROAM);
2578
2579 for (int i = 0; i < MAX_PLAYERS; i++)
2580 Multi_visible_players[i] = 0xFFFFFFFF;
2581 }
2582
2583 if (Game_is_master_tracker_game) {
2584 CallMultiDLL(MT_EVT_FRAME);
2585 }
2586
2587 // Check for new connections
2588 MultiCheckListen();
2589 MultiDisconnectDeadPlayers();
2590 MultiCheckToRespawnPowerups();
2591 MultiCheckToRepositionPowerups();
2592
2593 // get the other net players data
2594 MultiProcessIncoming();
2595
2596 // Find destination room if they fired
2597 MultiGetDestFireRooms();
2598
2599 Player_count = 1;
2600
2601 // Send out data
2602 for (i = 0; i < MAX_NET_PLAYERS; i++) {
2603

Callers 1

MultiDoFrameFunction · 0.85

Calls 15

MultiLeaveGameFunction · 0.85
SetFunctionModeFunction · 0.85
PlayerMoveToStartPosFunction · 0.85
CallMultiDLLFunction · 0.85
PlayerSwitchToObserverFunction · 0.85
MultiCheckListenFunction · 0.85
MultiProcessIncomingFunction · 0.85

Tested by

no test coverage detected