Esempio n. 1
0
/**
 * @brief Window resize signal handler
 */
static void Sv_ResizeConsole(int32_t sig) {

	endwin();

	sv_console_state.dirty = true;

	Sv_DrawConsole();
}
Esempio n. 2
0
/*
 * @brief
 */
void Sv_Frame(const uint32_t msec) {

	// if server is not active, do nothing
	if (!svs.initialized)
		return;

	// read any pending packets from clients
	Sv_ReadPackets();

	// keep simulation time in sync with reality
	if (!time_demo->value){

		const uint32_t frame_millis = 1000 / svs.frame_rate;

		svs.frame_delta += msec;

		 if (svs.frame_delta < frame_millis) {
			Net_Sleep(frame_millis - svs.frame_delta);
			return;
		}
	}

	svs.frame_delta = 0;

	// check timeouts
	Sv_CheckTimeouts();

	// check command times for attempted cheating
	Sv_CheckCommandTimes();

	// update ping based on the last known frame from all clients
	Sv_UpdatePings();

	// let everything in the world think and move
	Sv_RunGameFrame();

	// send messages back to the clients that had packets read this frame
	Sv_SendClientPackets();

	// send a heartbeat to the master if needed
	Sv_HeartbeatMasters();

	// clear entity flags, etc for next frame
	Sv_ResetEntities();

	// redraw the console
	Sv_DrawConsole();
}