Free Hero Mesh

Diff
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.

Differences From Artifact [4242250daf]:

To Artifact [2701a43599]:


104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119

120
121
122
123
124
125
126
  FILE*fp;
  SliceCookie*d;
  int c,n;
  sqlite3_int64 t;
  rewind(compositefp);
  look:
  n=0;
  if(*suffix>'Z') for(;;) {
    c=fgetc(compositefp);
    if(c==EOF) goto notfound;
    if(!c) goto skip;
    if(c=='.') break;
  }
  for(;;) {
    c=fgetc(compositefp);
    if(c==EOF) goto notfound;

    if(!c) {
      if(suffix[n]) goto skip; else goto found;
    }
    if(c==suffix[n]) {
      n++;
    } else {
      do c=fgetc(compositefp); while(c>0);







|



|




>







104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
  FILE*fp;
  SliceCookie*d;
  int c,n;
  sqlite3_int64 t;
  rewind(compositefp);
  look:
  n=0;
  if(*suffix=='.') for(;;) {
    c=fgetc(compositefp);
    if(c==EOF) goto notfound;
    if(!c) goto skip;
    if(c=='.') goto name;
  }
  for(;;) {
    c=fgetc(compositefp);
    if(c==EOF) goto notfound;
    name:
    if(!c) {
      if(suffix[n]) goto skip; else goto found;
    }
    if(c==suffix[n]) {
      n++;
    } else {
      do c=fgetc(compositefp); while(c>0);
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
  if(!fp) fatal("Cannot open '%s' for reading: %m\n",basefilename);
  fprintf(stderr,"Loading puzzle set...\n");
  if(z=sqlite3_exec(userdb,"BEGIN;",0,0,0)) fatal("SQL error (%d): %s\n",z,sqlite3_errmsg(userdb));
  if(z=sqlite3_prepare_v2(userdb,"SELECT `ID`, `TIME` FROM `USERCACHEINDEX` WHERE `NAME` = CHAR(?2)||'//'||?1;",-1,&st,0)) fatal("SQL error (%d): %s\n",z,sqlite3_errmsg(userdb));
  basefilename=realpath(basefilename,0);
  if(!basefilename) fatal("Cannot find real path of puzzle set: %m\n");
  sqlite3_bind_text(st,1,basefilename,-1,0);
  levelfp=composite_slice("level",1);
  solutionfp=composite_slice("solution",1);
  sqlite3_bind_int(st,2,'L');
  z=sqlite3_step(st);
  if(z==SQLITE_ROW) {
    leveluc=sqlite3_column_int64(st,0);
    t1=sqlite3_column_int64(st,1);
  } else if(z==SQLITE_DONE) {
    leveluc=t1=-1;







|
|







557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
  if(!fp) fatal("Cannot open '%s' for reading: %m\n",basefilename);
  fprintf(stderr,"Loading puzzle set...\n");
  if(z=sqlite3_exec(userdb,"BEGIN;",0,0,0)) fatal("SQL error (%d): %s\n",z,sqlite3_errmsg(userdb));
  if(z=sqlite3_prepare_v2(userdb,"SELECT `ID`, `TIME` FROM `USERCACHEINDEX` WHERE `NAME` = CHAR(?2)||'//'||?1;",-1,&st,0)) fatal("SQL error (%d): %s\n",z,sqlite3_errmsg(userdb));
  basefilename=realpath(basefilename,0);
  if(!basefilename) fatal("Cannot find real path of puzzle set: %m\n");
  sqlite3_bind_text(st,1,basefilename,-1,0);
  levelfp=composite_slice(".level",1);
  solutionfp=composite_slice(".solution",1);
  sqlite3_bind_int(st,2,'L');
  z=sqlite3_step(st);
  if(z==SQLITE_ROW) {
    leveluc=sqlite3_column_int64(st,0);
    t1=sqlite3_column_int64(st,1);
  } else if(z==SQLITE_DONE) {
    leveluc=t1=-1;