Free Hero Mesh

Check-in [063db0939e]
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.
Overview
Comment:Make do_load_moves and the SQL solution move list function using the new move list decoding functions.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 063db0939e67470548d9855579606b465f62e302
User & Date: user on 2022-06-29 05:54:45
Other Links: manifest | tags
Context
2022-06-29
06:24
FAQ entry about how was figuring out the working of the original game engine. check-in: 1f566350d9 user: user tags: trunk
05:54
Make do_load_moves and the SQL solution move list function using the new move list decoding functions. check-in: 063db0939e user: user tags: trunk
2022-06-28
06:49
Use the new user state format in the level table implementation. check-in: 98625fd224 user: user tags: trunk
Changes

Modified function.c from [7dea84fa1f] to [9d360dcc17].

459
460
461
462
463
464
465

466
467
468
469
470
471
472
  long sz;
  int i=3;
  unsigned char*d=read_lump(FIL_SOLUTION,level_id,&sz);
  if(sz<4 || !d || ((!argc || !sqlite3_value_int(*argv)) && (d[0]|(d[1]<<8))!=level_version)) {
    free(d);
    return;
  }

  if(d[2]&1) {
    while(i<sz && d[i]) i++;
    i++;
  }
  if(d[2]&2) i+=8;
  if(i<sz) sqlite3_result_blob(cxt,d+i,sz-i,SQLITE_TRANSIENT);
  free(d);







>







459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
  long sz;
  int i=3;
  unsigned char*d=read_lump(FIL_SOLUTION,level_id,&sz);
  if(sz<4 || !d || ((!argc || !sqlite3_value_int(*argv)) && (d[0]|(d[1]<<8))!=level_version)) {
    free(d);
    return;
  }
  if(d[2]&128) i+=4;
  if(d[2]&1) {
    while(i<sz && d[i]) i++;
    i++;
  }
  if(d[2]&2) i+=8;
  if(i<sz) sqlite3_result_blob(cxt,d+i,sz-i,SQLITE_TRANSIENT);
  free(d);

Modified game.c from [e7202bf383] to [941e9e54d5].

773
774
775
776
777
778
779

780
781
782
783
784
785
786
787
788
789
790
791
792
    return;
  }
  encode_move_list(fp);
  pclose(fp);
}

static void do_load_moves(sqlite3_stmt*st) {

  int i=sqlite3_column_bytes(st,1);
  if(i&~0xFFFF) return;
  if(replay_size<i) replay_list=realloc(replay_list,replay_size=i);
  if(!replay_list) fatal("Allocation failed");
  replay_count=i;
  if(i) memcpy(replay_list,sqlite3_column_blob(st,1),i);
}

static int copy_text_to_plain(unsigned char*out,int maxlen,const unsigned char*in) {
  int at=0;
  if(!in) {
    *out=0;
    return 0;







>

<
|
|
|
|







773
774
775
776
777
778
779
780
781

782
783
784
785
786
787
788
789
790
791
792
    return;
  }
  encode_move_list(fp);
  pclose(fp);
}

static void do_load_moves(sqlite3_stmt*st) {
  FILE*fp;
  int i=sqlite3_column_bytes(st,1);

  fp=fmemopen((char*)sqlite3_column_blob(st,1)?:"",i,"r");
  if(!fp) fatal("Allocation failed\n");
  decode_move_list(fp);
  fclose(fp);
}

static int copy_text_to_plain(unsigned char*out,int maxlen,const unsigned char*in) {
  int at=0;
  if(!in) {
    *out=0;
    return 0;