Free Hero Mesh

Check-in [42049107bf]
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:Add the internal "level_changed" variable; this is set in the level editor if changes are made which would potentially invalidate the solution, requiring the level version number to be incremented. (Some changes do not set this, such as changing the level title, or its order number. In this case, the level version number remains unchanged when the level is saved.)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 42049107bf5ce35a0efd11af1dffad74f11a7df1
User & Date: user on 2021-02-17 06:00:46
Other Links: manifest | tags
Context
2021-02-18
05:06
Add 'lc' and 'lv' to set level code and level version. check-in: 5439829a5f user: user tags: trunk
2021-02-17
06:00
Add the internal "level_changed" variable; this is set in the level editor if changes are made which would potentially invalidate the solution, requiring the level version number to be incremented. (Some changes do not set this, such as changing the level title, or its order number. In this case, the level version number remains unchanged when the level is saved.) check-in: 42049107bf user: user tags: trunk
2021-02-16
22:21
In add_mru function in editor, do not add blank MRUs check-in: a87bcb73f5 user: user tags: trunk
Changes

Modified edit.c from [7b51e96b29] to [7284a1e678].

527
528
529
530
531
532
533

534
535
536
537
538
539
540
    } else {
      n=objects[n]->up;
    }
  }
  generation_number_inc=0;
  n=objalloc(m->class);
  if(n==VOIDLINK) return;

  objects[n]->x=x;
  objects[n]->y=y;
  objects[n]->image=m->img;
  objects[n]->dir=m->dir;
  objects[n]->misc1=m->misc1;
  objects[n]->misc2=m->misc2;
  objects[n]->misc3=m->misc3;







>







527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
    } else {
      n=objects[n]->up;
    }
  }
  generation_number_inc=0;
  n=objalloc(m->class);
  if(n==VOIDLINK) return;
  level_changed=1;
  objects[n]->x=x;
  objects[n]->y=y;
  objects[n]->image=m->img;
  objects[n]->dir=m->dir;
  objects[n]->misc1=m->misc1;
  objects[n]->misc2=m->misc2;
  objects[n]->misc3=m->misc3;
572
573
574
575
576
577
578

579
580
581
582
583
584
585
      if(number>=0 && number<MRUCOUNT) curmru=number;
      return 0;
    case 're': // Resize and clear
      if(argc<3) return 0;
      x=sqlite3_column_int(args,1);
      y=sqlite3_column_int(args,2);
      if(x<1 || y<1 || x>64 || y>64) return 0;

      annihilate();
      pfwidth=x;
      pfheight=y;
      return 0;
    default:
      return prev;
  }







>







573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
      if(number>=0 && number<MRUCOUNT) curmru=number;
      return 0;
    case 're': // Resize and clear
      if(argc<3) return 0;
      x=sqlite3_column_int(args,1);
      y=sqlite3_column_int(args,2);
      if(x<1 || y<1 || x>64 || y>64) return 0;
      level_changed=1;
      annihilate();
      pfwidth=x;
      pfheight=y;
      return 0;
    default:
      return prev;
  }

Modified function.c from [7eed9dd543] to [33eea068bd].

929
930
931
932
933
934
935

936
937
938
939
940
941
942
    objects[id]->misc2.u=sqlite3_value_int64(argv[5])&0xFFFF;
    objects[id]->misc2.t=sqlite3_value_int64(argv[5])>>32;
    if(objects[id]->misc2.t&~3) objects[id]->misc2=NVALUE(0);
    objects[id]->misc3.u=sqlite3_value_int64(argv[6])&0xFFFF;
    objects[id]->misc3.t=sqlite3_value_int64(argv[6])>>32;
    if(objects[id]->misc3.t&~3) objects[id]->misc3=NVALUE(0);
  }

  return SQLITE_OK;
}

Module(vt_objects,
  .xBestIndex=vt1_objects_index,
  .xColumn=vt1_objects_column,
  .xFilter=vt1_objects_filter,







>







929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
    objects[id]->misc2.u=sqlite3_value_int64(argv[5])&0xFFFF;
    objects[id]->misc2.t=sqlite3_value_int64(argv[5])>>32;
    if(objects[id]->misc2.t&~3) objects[id]->misc2=NVALUE(0);
    objects[id]->misc3.u=sqlite3_value_int64(argv[6])&0xFFFF;
    objects[id]->misc3.t=sqlite3_value_int64(argv[6])>>32;
    if(objects[id]->misc3.t&~3) objects[id]->misc3=NVALUE(0);
  }
  level_changed=1;
  return SQLITE_OK;
}

Module(vt_objects,
  .xBestIndex=vt1_objects_index,
  .xColumn=vt1_objects_column,
  .xFilter=vt1_objects_filter,

Modified heromesh.h from [fad2c669ac] to [7378f2ea70].

45
46
47
48
49
50
51

52
53
54
55
56
57
58
extern xrm_quark optionquery[16];
extern char main_options[128];
extern Uint8 message_trace[0x4100/8];
extern Uint16 level_id,level_ord,level_version,level_code;
extern unsigned char*level_title;
extern Uint16*level_index;
extern int level_nindex;


#ifdef __GNUC__
extern char stack_protect_mode;
extern void*stack_protect_mark;
extern void*stack_protect_low;
extern void*stack_protect_high;
#define StackProtection() (stack_protect_mode && ( \







>







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
extern xrm_quark optionquery[16];
extern char main_options[128];
extern Uint8 message_trace[0x4100/8];
extern Uint16 level_id,level_ord,level_version,level_code;
extern unsigned char*level_title;
extern Uint16*level_index;
extern int level_nindex;
extern char level_changed; // 1 if solution is potentially invalidated by edits

#ifdef __GNUC__
extern char stack_protect_mode;
extern void*stack_protect_mark;
extern void*stack_protect_low;
extern void*stack_protect_high;
#define StackProtection() (stack_protect_mode && ( \

Modified main.c from [b062b0f69d] to [310c045da5].

43
44
45
46
47
48
49

50
51
52
53
54
55
56
xrm_quark optionquery[16];
char main_options[128];
Uint8 message_trace[0x4100/8];
Uint16 level_id,level_ord,level_version,level_code;
unsigned char*level_title;
Uint16*level_index;
int level_nindex;


#ifdef __GNUC__
char stack_protect_mode=0;
void*stack_protect_mark;
void*stack_protect_low;
void*stack_protect_high;
#endif







>







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
xrm_quark optionquery[16];
char main_options[128];
Uint8 message_trace[0x4100/8];
Uint16 level_id,level_ord,level_version,level_code;
unsigned char*level_title;
Uint16*level_index;
int level_nindex;
char level_changed;

#ifdef __GNUC__
char stack_protect_mode=0;
void*stack_protect_mark;
void*stack_protect_low;
void*stack_protect_high;
#endif
223
224
225
226
227
228
229

230
231
232
233
234
235
236
    lo=-lvl;
    lvl=level_index[~lvl];
    p=buf=read_lump(FIL_LEVEL,lvl,&sz);
    end=buf+sz;
  }
  if(lvl<0) return "Invalid level ID";
  if(!buf) return "Cannot find level";

  free(level_title);
  level_title=0;
  annihilate();
  generation_number=TY_MAXTYPE+1;
  generation_number_inc=0;
  level_version=p[0]|(p[1]<<8);
  level_code=p[2]|(p[3]<<8);







>







224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
    lo=-lvl;
    lvl=level_index[~lvl];
    p=buf=read_lump(FIL_LEVEL,lvl,&sz);
    end=buf+sz;
  }
  if(lvl<0) return "Invalid level ID";
  if(!buf) return "Cannot find level";
  level_changed=1;
  free(level_title);
  level_title=0;
  annihilate();
  generation_number=TY_MAXTYPE+1;
  generation_number_inc=0;
  level_version=p[0]|(p[1]<<8);
  level_code=p[2]|(p[3]<<8);
347
348
349
350
351
352
353

354
355
356
357
358
359
360
  level_ord=lo;
  if(level_index && !lo) {
    for(i=0;i<level_nindex;i++) if(level_index[i]==lvl) {
      level_ord=i+1;
      break;
    }
  }

  return 0;
bad1:
  free(buf);
  return "Corrupted level data";
bad2:
  free(buf);
  return "Object out of bounds";







>







349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
  level_ord=lo;
  if(level_index && !lo) {
    for(i=0;i<level_nindex;i++) if(level_index[i]==lvl) {
      level_ord=i+1;
      break;
    }
  }
  level_changed=0;
  return 0;
bad1:
  free(buf);
  return "Corrupted level data";
bad2:
  free(buf);
  return "Object out of bounds";