mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-18 04:06:45 -04:00
fix crash entering sopka.map for second time
This commit is contained in:
parent
93caf370e4
commit
0ae638276e
3 changed files with 10 additions and 9 deletions
|
@ -455,7 +455,7 @@ static PARSED_COMMAND parse_command(const char *cmd) {
|
|||
extern int ghost_walls;
|
||||
extern int nofloors;
|
||||
|
||||
static int add_file_to_console(const char *name, LIST_FILE_TYPE , size_t, void *ctx) {
|
||||
static int add_file_to_console(const char *name, LIST_FILE_TYPE _, size_t __, void *ctx) {
|
||||
int *cnt = (void *)ctx;
|
||||
char buff[20] = "";
|
||||
for (int i = 0; i < 19; ++i) buff[i] = ' ';
|
||||
|
|
|
@ -218,14 +218,14 @@ extern TSTR_LIST texty_v_mape;
|
|||
void save_map_description(TMPFILE_WR *f)
|
||||
{
|
||||
int count,max;
|
||||
int i;
|
||||
int32_t i;
|
||||
|
||||
if (texty_v_mape==NULL) max=0;else max=str_count(texty_v_mape);
|
||||
for(i=0,count=0;i<max;i++) if (texty_v_mape[i]!=NULL) count++;
|
||||
temp_storage_write(&count,1*sizeof(count),f);
|
||||
for(i=0;i<max;i++) if (texty_v_mape[i]!=NULL)
|
||||
{
|
||||
int len;
|
||||
word len;
|
||||
len=strlen(texty_v_mape[i]+12)+12+1;
|
||||
temp_storage_write(&len,1*2,f);
|
||||
temp_storage_write(texty_v_mape[i],1*len,f);
|
||||
|
@ -234,8 +234,8 @@ void save_map_description(TMPFILE_WR *f)
|
|||
|
||||
void load_map_description(TMPFILE_RD *f)
|
||||
{
|
||||
int count;
|
||||
int i;
|
||||
int32_t count;
|
||||
int32_t i;
|
||||
word len;
|
||||
|
||||
if (texty_v_mape!=NULL)release_list(texty_v_mape);
|
||||
|
@ -328,8 +328,9 @@ int load_all_fly(TMPFILE_RD *fsta)
|
|||
memcpy(n->items,items,(c-items)*sizeof(short));
|
||||
}
|
||||
add_fly(n);
|
||||
temp_storage_read(&sz,sizeof(sz),fsta);
|
||||
}
|
||||
return 0;
|
||||
return sz != 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -441,9 +442,9 @@ int load_map_state() //obnovuje stav mapy; nutno volat po zavolani load_map;
|
|||
for (i=0;i<mapsize;i++)
|
||||
if ((bf[i>>3]>>(i & 7)) & 1) map_coord[i].flags|=MC_DISCLOSED;
|
||||
load_map_description(fsta);
|
||||
while (temp_storage_read(&i,sizeof(i),fsta) && i > 0 && i<=mapsize*4)
|
||||
while (temp_storage_read(&i,sizeof(i),fsta) && i >= 0 && i<=mapsize*4)
|
||||
if (temp_storage_read(map_sides+i,1*sizeof(TSTENA),fsta)!=sizeof(TSTENA)) goto err;
|
||||
while (temp_storage_read(&i,sizeof(i),fsta) && i >0 && i<=mapsize)
|
||||
while (temp_storage_read(&i,sizeof(i),fsta) && i >= 0 && i<=mapsize)
|
||||
if (temp_storage_read(map_sectors+i,1*sizeof(TSECTOR),fsta)!=sizeof(TSECTOR)) goto err;
|
||||
if (reset_mobiles) //reloads mobiles if flag present
|
||||
{
|
||||
|
|
|
@ -705,7 +705,7 @@ void wire_end_game()
|
|||
for(i=0;i<MAX_MOBS;i++) if (mobs[i].vlajky & MOB_LIVE) mobs[i].vlajky&=~MOB_IN_BATTLE;
|
||||
|
||||
for (int i = 0; i < POCET_POSTAV; ++i) {
|
||||
if (postavy[i].used && postavy[i].inmaphash != current_map_hash) {
|
||||
if (postavy[i].used && postavy[i].inmaphash != current_map_hash && postavy[i].lives) {
|
||||
const char *mname = find_map_from_hash(postavy[i].inmaphash);
|
||||
if (mname != NULL) {
|
||||
cur_group = postavy[i].groupnum;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue