forked from diasurgical/devilutionX
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnthread.h
40 lines (34 loc) · 1.15 KB
/
nthread.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* @file nthread.h
*
* Interface of functions for managing game ticks.
*/
#pragma once
#include "player.h"
namespace devilution {
extern BYTE sgbNetUpdateRate;
extern size_t gdwMsgLenTbl[MAX_PLRS];
extern uint32_t gdwTurnsInTransit;
extern uintptr_t glpMsgTbl[MAX_PLRS];
extern uint32_t gdwLargestMsgSize;
extern uint32_t gdwNormalMsgSize;
extern float gfProgressToNextGameTick; // the progress as a fraction (0.0f to 1.0f) in time to the next game tick
extern int last_tick;
void nthread_terminate_game(const char *pszFcn);
uint32_t nthread_send_and_recv_turn(uint32_t curTurn, int turnDelta);
bool nthread_recv_turns(bool *pfSendAsync = nullptr);
void nthread_set_turn_upper_bit();
void nthread_start(bool setTurnUpperBit);
void nthread_cleanup();
void nthread_ignore_mutex(bool bStart);
/**
* @brief Checks if it's time for the logic to advance
* @return True if the engine should tick
*/
bool nthread_has_500ms_passed();
/**
* @brief Calculates the progress in time to the next game tick
* @return Progress as a fraction (0.0f to 1.0f)
*/
void nthread_UpdateProgressToNextGameTick();
} // namespace devilution