20static int lastchange = 0;
23 char const* cpos = start;
27 cpos = parsers::parse_fixed_amount_csv_values<4>(cpos, end,
';', [&](std::string_view
const* values) {
34 if(first_text.length() > 0 && second_text.length() > 0) {
36 if(second_value == 0) {
40 auto source = dcon::nation_id{ uint16_t ( second_value ) };
44 auto p =
load_mp_player(state, name, password_hash, password_salt);
46 state.world.nation_set_is_player_controlled(source,
true);
47 state.world.force_create_player_nation(source, p);
58 state.console_log(
"persistent | type:read_player | nickname:" + name.to_string() +
" | nation:" + std::to_string(source.index()) +
"| password:" + password_hash.to_string() +
" | salt: " + password_salt.to_string());
73 auto pl_csv_file = open_file(folder,
NATIVE(
"players.csv"));
75 auto pl_content = view_contents(*pl_csv_file);
85 std::string res =
"Nickname;NationID;PasswordHash;PasswordSalt\n";
87 for(
auto pl : state.world.in_mp_player) {
91 res += nickname.to_string() +
";" + std::to_string(pl.get_nation_from_player_nation().id.index()) +
";"
92 + password_hash.to_string() +
";" + password_salt.to_string() +
"\n";
104 auto moment = std::chrono::system_clock::now();
105 std::time_t curtime = std::chrono::system_clock::to_time_t(moment);
106 int h = (curtime / 3600) % 24;
107 tm local_tm = *localtime(&curtime);
109 if(h >= state.host_settings.alice_persistent_server_pause && state.actual_game_speed != 0 && local_tm.tm_yday != lastchange) {
112 lastchange = local_tm.tm_yday;
115 if(h >= state.host_settings.alice_persistent_server_unpause && h < state.host_settings.alice_persistent_server_pause && state.actual_game_speed != state.ui_state.held_game_speed && local_tm.tm_yday != lastchange) {
118 lastchange = local_tm.tm_yday;
Header file describing the function signatures and the constants of the SHA512 Algorithm.
bool pause_game(sys::state &state)
void every_tick_checks(sys::state &state) noexcept
bool unpause_game(sys::state &state)
dcon::mp_player_id load_mp_player(sys::state &state, sys::player_name &name, sys::player_password_hash &password_hash, sys::player_password_salt &password_salt)
void load_player_nations(sys::state &state) noexcept
void read_player_nations(sys::state &state, char const *start, char const *end) noexcept
void log_player_nations(sys::state &state)
void write_player_nations(sys::state &state) noexcept
int32_t parse_int(std::string_view content, int32_t line, error_handler &err)
std::string_view remove_surrounding_whitespace(std::string_view txt)
void write_file(directory const &dir, native_string_view file_name, char const *file_data, uint32_t file_size)
directory get_or_create_data_dumps_directory()
std::string resolve_string_substitution(sys::state &state, dcon::text_key source_text, substitution_map const &mp)
void add_to_substitution_map(substitution_map &mp, variable_type key, substitution value)
ankerl::unordered_dense::map< uint32_t, substitution > substitution_map
player_value< _Size > from_string_view(std::string_view sv) noexcept
Holds important data about the game world, state, and other data regarding windowing,...