From fed5a04323ef9eccfb7ec1e5abdee27bfadfbaa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Nov=C3=A1k?= Date: Sat, 1 Mar 2025 12:33:29 +0100 Subject: [PATCH] Merge branch 'main' of https://github.com/ondra-novak/gates_of_skeldal.git into main --- game/gamesave.c | 37 +++++++++---------------------------- platform/error.cpp | 8 ++++---- 2 files changed, 13 insertions(+), 32 deletions(-) diff --git a/game/gamesave.c b/game/gamesave.c index 0b62078..c6d4c4f 100644 --- a/game/gamesave.c +++ b/game/gamesave.c @@ -209,9 +209,9 @@ void restore_items(TMPFILE_RD *f) { int32_t i,j; - short **new_item_map = getmem(mapsize*4*sizeof(*map_items)); + short **new_item_map = getmem(mapsize*4*sizeof(*map_items)); memset(new_item_map,0,mapsize*4*sizeof(*map_items)); - while(temp_storage_read(&i,sizeof(i),f) && i!=-1) { + while(temp_storage_read(&i,sizeof(i),f) && i!=-1) { temp_storage_read(&j,sizeof(j),f); new_item_map[i]=(short *)getmem(j*2); temp_storage_read(new_item_map[i],2*j,f); @@ -230,7 +230,7 @@ void restore_items(TMPFILE_RD *f) for(i=0;itm2?-1:0; -} static int dedup_strings_prefix(TSTR_LIST lst, int count) { int j = -1; @@ -1813,16 +1804,6 @@ int load_map_automap(char *mapfile) return load_map_state_partial(mapfile,mapsize); //nahrej ulozenou mapu } -static void herni_cas_for_savegame(char *c) { - int32_t inmin = game_time/6; - if (inmin >= 96*60) { - int32_t inhours = inmin/60; - sprintf(c,"%dd %dh", inhours/24, inhours%24); - } else { - sprintf(c,"%02d:%02d", inmin/60, inmin%60); - } -} - #define DEFAULT_GAME_NAME(extra) \ char game_name[100];\ @@ -1839,8 +1820,8 @@ long get_save_game_slot_id() { void do_autosave() { DEFAULT_GAME_NAME(" (A)"); - if (cur_time - prev_game_time_save<300) return; //autosave is no more often than each 5 minutes - prev_game_time_save = cur_time; + if (cur_time - prev_game_time_save<300) return; //autosave is no more often than each 5 minutes + prev_game_time_save = cur_time; save_game(get_save_game_slot_id(), game_name); } diff --git a/platform/error.cpp b/platform/error.cpp index f13803f..46b26d2 100644 --- a/platform/error.cpp +++ b/platform/error.cpp @@ -7,7 +7,7 @@ #include "error.h" #include "platform.h" -#ifdef _WIN32 +#ifdef _WIN32 #define WIN32_LEAN_AND_MEAN #include #endif @@ -18,8 +18,8 @@ void send_log_impl(const char *format, ...) { va_list args; int task = q_current_task(); char buff2[1000]; - char buff[1000]; - va_start(args, format); + char buff[1334]; + va_start(args, format); auto reltik = get_game_tick_count() - gtick; double sec = reltik * 0.001; vsnprintf(buff2,1000,format, args); @@ -27,7 +27,7 @@ void send_log_impl(const char *format, ...) { snprintf(buff, sizeof(buff), "%f [%d] %s\r\n", sec, task, buff2); - #ifdef _WIN32 + #ifdef _WIN32 OutputDebugStringA(buff); #else std::cerr << buff;