windows release build, fix book crash, fix lock, fix finale

This commit is contained in:
Ondrej Novak 2025-02-08 20:08:01 +01:00
parent 3d8ee275e4
commit d13297e4f4
24 changed files with 158 additions and 63 deletions

View file

@ -78,7 +78,7 @@ int build_tables()
case 128:while (fgetc(source)!='\n');
fgetc(source);
i=fscanf(source,"%[^\n]",global_name);
strcopy_n(kouzla_tab[cur_spell].spellname,global_name,29);
strcopy_n(kouzla_tab[cur_spell].spellname,global_name,sizeof(kouzla_tab[cur_spell].spellname));
printf("(%3d, 0x%05X) %s\n",cur_spell, kouzla_tab[cur_spell].start,global_name);
break;
case 129:add_prog_command(0xff);

View file

@ -352,7 +352,7 @@ inline bool CSVReader<Source>::readRow(const CSVFieldIndexMapping<T> &mapping,T
} else {
static_assert(std::is_same_v<TVal, bool>);
CSVState st = read(buff);
std::transform(buff.begin(), buff.end(), buff.begin(), [](char c) -> char { return std::tolower(c); });
std::transform(buff.begin(), buff.end(), buff.begin(), [](char c) -> char { return static_cast<char>(std::tolower(c)); });
if (buff == "y" || buff == "t" || buff =="true" || buff == "yes" || buff == "on") {
target.*ptr = true;
} else if (buff == "n" || buff == "f" || buff =="false" || buff == "no" || buff == "off") {

View file

@ -39,11 +39,10 @@ TSTR_LIST merge_configs(TSTR_LIST target, TSTR_LIST source)
char buff[256];
int i;
char *c;
buff[255]=0;
for (i=0;i<str_count(source);i++) if (source[i])
{
strcopy_n(buff,source[i],255);
strcopy_n(buff,source[i],sizeof(buff));
c=strchr(buff,' ');
if (c!=NULL)
{

View file

@ -666,7 +666,7 @@ void display_status()
int k;
for(k=0;k<5;k++) copys[k]=h->flags & (1<<k)?flags[k]:'.';
if (h->src_file[0]) strcopy_n(nname,h->src_file,12);else strcpy(nname,"<local>");
if (h->src_file[0]) strcopy_n(nname,h->src_file,sizeof(nname));else strcpy(nname,"<local>");
printf("%04Xh ... %12s %s %s %08lXh %6d %10d %6d \n",i*BK_MINOR_HANDLES+j,
nname,names[h->status-1],
copys,(unsigned long)(uintptr_t)h->blockdata,h->size,h->counter,h->lockcount);

View file

@ -363,7 +363,7 @@ char mgif_play(const void *mgif) //dekoduje a zobrazi frame
const char *pc;
char *ff;
// int acts,size,act,csize;
const void *scr_sav;
const void *scr_sav = 0;
int scr_act=-1;

View file

@ -17,10 +17,10 @@ class MUSStreamParser: public IMusicStream {
public:
MUSStreamParser(const char *name) {
data = map_file_to_memory(file_icase_find(name), &sz);
if (data) {
_data = map_file_to_memory(file_icase_find(name), &sz);
if (_data) {
_loaded = true;
iter = reinterpret_cast<const uint8_t *>(data);
iter = reinterpret_cast<const uint8_t *>(_data);
chans = read_short();
freq = read_int();
iter += 4;
@ -32,7 +32,7 @@ public:
}
~MUSStreamParser() {
if (data) unmap_file(data, sz);
if (_data) unmap_file(_data, sz);
}
MUSStreamParser(const MUSStreamParser &) = delete;
MUSStreamParser& operator=(const MUSStreamParser &) = delete;
@ -60,7 +60,7 @@ public:
protected:
bool _loaded = false;
void *data;
void *_data;
std::size_t sz;
std::int16_t chans;

View file

@ -30,7 +30,7 @@ TSTRINGTABLE *stringtable_load(const char *filename) {
CSVRecord rec;
std::unique_ptr<TSTRINGTABLE> tbl = std::make_unique<TSTRINGTABLE>();
while (reader.readRow(mapping, rec)) {
windows2kamenik(rec.string.data(), rec.string.size(), rec.string.data());
windows2kamenik(rec.string.data(), (int)rec.string.size(), rec.string.data());
tbl->_strings[rec.index] = rec.string;
}
return tbl.release();