mirror of
https://github.com/diasurgical/DevilutionX.git
synced 2026-05-21 05:40:35 +00:00
4fa3732526
Done with the following script:
```ruby
Dir["Source/**/*.{h,c,cc,cpp,hpp}"].each do |path|
v = File.read(path)
next if !v.include?("uint32_t") || v.include?("cstdint")
lines = v.lines
line_num = if lines[2].start_with?(" *")
lines.index { |l| l.start_with?(" */") } + 3
else
3
end
lines.insert(line_num, "#include <cstdint>\n")
File.write(path, lines.join(""))
end
```
then fixed-up manually
44 lines
1.2 KiB
C++
44 lines
1.2 KiB
C++
/**
|
|
* @file nthread.h
|
|
*
|
|
* Interface of functions for managing game ticks.
|
|
*/
|
|
#pragma once
|
|
|
|
#include <cstdint>
|
|
|
|
#include "player.h"
|
|
#include "utils/attributes.h"
|
|
|
|
namespace devilution {
|
|
|
|
extern uint8_t 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;
|
|
/** @brief the progress as a fraction (see AnimationInfo::baseValueFraction) in time to the next game tick */
|
|
extern DVL_API_FOR_TEST uint8_t ProgressToNextGameTick;
|
|
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(bool *drawGame = nullptr);
|
|
/**
|
|
* @brief Updates the progress in time to the next game tick
|
|
*/
|
|
void nthread_UpdateProgressToNextGameTick();
|
|
|
|
} // namespace devilution
|