mirror of
https://github.com/ondra-novak/gates_of_skeldal.git
synced 2025-07-05 06:00:33 -04:00
fix crashes
This commit is contained in:
parent
04ab5898ef
commit
a8c9fced4c
12 changed files with 65 additions and 59 deletions
|
@ -606,7 +606,7 @@ static int process_actions(const char *command) {
|
|||
if (istrcmp(command, "world-list") == 0) {
|
||||
int cnt = 0;
|
||||
list_files(gpathtable[SR_MAP], file_type_normal|file_type_just_name, add_file_to_console, &cnt);
|
||||
printf("\n");
|
||||
wzprintf("\n");
|
||||
return 1;
|
||||
}
|
||||
if (istrcmp(command, "beam-me-up") == 0) {
|
||||
|
|
|
@ -543,6 +543,7 @@ int q_vidis_postavu(int sector,int dir,TMOB *p,int *otocit_se,char ret)
|
|||
{
|
||||
char ok=0;
|
||||
THUMAN *ps=&postavy[i];
|
||||
if (ps->used && ps->inmaphash == current_map_hash) {
|
||||
xs=map_coord[sector].x-map_coord[postavy[i].sektor].x;
|
||||
ys=map_coord[sector].y-map_coord[postavy[i].sektor].y;
|
||||
d=MAX(abs(xs),abs(ys));
|
||||
|
@ -588,6 +589,7 @@ int q_vidis_postavu(int sector,int dir,TMOB *p,int *otocit_se,char ret)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dis==255) dis=-2;
|
||||
if (ret)return z;else return dis/2;
|
||||
}
|
||||
|
|
|
@ -618,6 +618,7 @@ void show_cel(int celx,int cely,const void *stena,int xofs,int yofs,char rev, in
|
|||
x=x3d->xpos+xofs;
|
||||
if (-x>realsx) return;
|
||||
p=stena;p+=SHADE_PAL+2*2+2;
|
||||
zoom.texture_end = p + txtsx*txtsy;
|
||||
i=0;
|
||||
while (x<0)
|
||||
{
|
||||
|
@ -690,6 +691,7 @@ void show_cel2(int celx,int cely,const void *stena,int xofs,int yofs,char rev, i
|
|||
if (celx<=0) x=x3d->xpos+xofs; else x=x3d->xpos2+xofs;
|
||||
if (-x>realsx) return;
|
||||
p=stena;p+=SHADE_PAL+2*2+2;
|
||||
zoom.texture_end = p + txtsx*txtsy;
|
||||
i=0;
|
||||
while (x<0)
|
||||
{
|
||||
|
|
|
@ -57,6 +57,7 @@ typedef struct zoominfo
|
|||
word *palette;
|
||||
word ycount;
|
||||
word xmax;
|
||||
const void *texture_end;
|
||||
}ZOOMINFO;
|
||||
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ void sikma_zleva_##suffx(void) \
|
|||
word cy = zoom.ycount; \
|
||||
const unsigned char *pixmap = zoom.texture; \
|
||||
const short *ytable = zoom.ytable; \
|
||||
while (cy) { \
|
||||
while (cy && pixmap < (const unsigned char *)zoom.texture_end) { \
|
||||
const int32_t *xtable = zoom.xtable; \
|
||||
word cx = zoom.xmax; \
|
||||
word *scr_iter = scr; \
|
||||
|
@ -48,7 +48,7 @@ void sikma_zprava_##suffx(void) \
|
|||
word cy = zoom.ycount; \
|
||||
const unsigned char *pixmap = zoom.texture; \
|
||||
const short *ytable = zoom.ytable; \
|
||||
while (cy) { \
|
||||
while (cy && pixmap < (const unsigned char *)zoom.texture_end) { \
|
||||
const int32_t *xtable = zoom.xtable; \
|
||||
word cx = zoom.xmax; \
|
||||
word *scr_iter = scr; \
|
||||
|
|
|
@ -208,7 +208,7 @@ void restore_items(TMPFILE_RD *f)
|
|||
int32_t i,j;
|
||||
|
||||
for(i=0;i<mapsize*4;i++) if (map_items[i]!=NULL) free(map_items[i]);
|
||||
memset(map_items,0,mapsize*16);
|
||||
memset(map_items,0,mapsize*4*sizeof(*map_items));
|
||||
while(temp_storage_read(&i,sizeof(i),f) && i!=-1)
|
||||
{
|
||||
temp_storage_read(&j,sizeof(j),f);
|
||||
|
|
|
@ -1193,7 +1193,7 @@ void fletna_pridej_notu(char note)
|
|||
{
|
||||
note+=65;
|
||||
fletna_str[pos]=note;
|
||||
if (pos==13) memmove(fletna_str,fletna_str+1,pos-1);
|
||||
if (pos==countof(fletna_str)) memmove(fletna_str,fletna_str+1,pos-1);
|
||||
else pos++;
|
||||
}
|
||||
|
||||
|
@ -1415,7 +1415,7 @@ int load_string_list_ex(TSTR_LIST *list,const char *filename)
|
|||
return lin;
|
||||
}
|
||||
if (i==-1) break;
|
||||
while ((j=temp_storage_getc(f))<33 && j!=EOF);
|
||||
while ((j=temp_storage_getc(f))<33 && j!=EOF && j!='\n');
|
||||
if (j!=EOF) temp_storage_ungetc(f);
|
||||
if (temp_storage_gets(c,1022,f)==NULL)
|
||||
{
|
||||
|
|
|
@ -2049,11 +2049,11 @@ int weigth_defect(THUMAN *p)
|
|||
}
|
||||
|
||||
static char check_double_wield() {
|
||||
short i1 = human_selected->wearing[PO_RUKA_L]-1;
|
||||
short i2 = human_selected->wearing[PO_RUKA_R]-1;
|
||||
short i1 = human_selected->wearing[PO_RUKA_L];
|
||||
short i2 = human_selected->wearing[PO_RUKA_R];
|
||||
if (!i1 || !i2) return 0;
|
||||
const TITEM *it1 = glob_items+i1;
|
||||
const TITEM *it2 = glob_items+i2;
|
||||
const TITEM *it1 = glob_items+i1-1;
|
||||
const TITEM *it2 = glob_items+i2-1;
|
||||
if (it1->druh!=TYP_UTOC || it2->druh!=TYP_UTOC ) return 0;
|
||||
for (int i = VLS_SILA; i <=VLS_OBRAT; ++i) {
|
||||
if ((it1->podminky[i] + it2->podminky[i] > human_selected->vlastnosti[i])
|
||||
|
|
|
@ -925,10 +925,9 @@ void spell_pripojenia(int owner)
|
|||
{
|
||||
int sect;
|
||||
sect=postavy[i].sektor;
|
||||
if (map_coord[sect].flags & MC_NOSUMMON)
|
||||
if (sect > 0 && sect < mapsize && map_coord[sect].flags & MC_NOSUMMON) {
|
||||
if (h==NULL) h=postavy+i;else more=1;
|
||||
else
|
||||
{
|
||||
} else {
|
||||
postavy[i].sektor=postavy[owner].sektor;
|
||||
postavy[i].direction=postavy[owner].direction;
|
||||
postavy[i].inmaphash = postavy[owner].inmaphash;
|
||||
|
|
|
@ -149,7 +149,7 @@ void new_setup()
|
|||
|
||||
mix_back_sound(256000-16384);
|
||||
memset(&ctl,0,sizeof(ctl));
|
||||
change_click_map(setup,4);
|
||||
change_click_map(setup,countof(setup));
|
||||
set_font(H_FBOLD,SETUP_COL2);
|
||||
default_font=curfont;
|
||||
memcpy(f_default,charcolors,sizeof(f_default));
|
||||
|
|
|
@ -544,7 +544,8 @@ void play_sample_at_sector(int sample,int listener,int source,int track, char lo
|
|||
int oldtrack;
|
||||
|
||||
if (!sound_enabled) return;
|
||||
if (map_coord[listener].layer!=map_coord[source].layer) return;
|
||||
if (listener<0 || listener>=mapsize || map_coord[listener].layer!=map_coord[source].layer) return;
|
||||
if (source<0 || source >=mapsize) return;
|
||||
xd=map_coord[source].x;
|
||||
yd=map_coord[source].y;
|
||||
chan=find_free_channel(track);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <fstream>
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
void SDLContext::SDL_Deleter::operator ()(SDL_Window* window) {
|
||||
SDL_DestroyWindow(window);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue