Free Hero Mesh

Check-in [b8f0f5f65a]
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:Always use objtrash to free objects in editor, not free
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b8f0f5f65a6af5ac2e74eec509b368962e082a76
User & Date: user on 2021-02-11 22:51:06
Other Links: manifest | tags
Context
2021-02-11
23:59
Add the "pick" instruction check-in: 23f422335e user: user tags: trunk
22:51
Always use objtrash to free objects in editor, not free check-in: b8f0f5f65a user: user tags: trunk
22:37
Check for collision layers when adding objects in the editor check-in: 73439c4682 user: user tags: trunk
Changes

Modified edit.c from [ecf182b369] to [f72f24e675].

403
404
405
406
407
408
409
410
411
412
413
414
415
416

417
418
419
420
421
422
423
  c=classes[m->class];
  if(!c) return;
  n=playfield[y*64+x-65];
  while(n!=VOIDLINK) {
    if(d && objects[n]->class==m->class) return;
    if(c->collisionLayers&classes[objects[n]->class]->collisionLayers) {
      u=objects[n]->up;
      pfunlink(n);
      free(objects[n]);
      n=u;
    } else {
      n=objects[n]->up;
    }
  }

  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;







|
<





>







403
404
405
406
407
408
409
410

411
412
413
414
415
416
417
418
419
420
421
422
423
  c=classes[m->class];
  if(!c) return;
  n=playfield[y*64+x-65];
  while(n!=VOIDLINK) {
    if(d && objects[n]->class==m->class) return;
    if(c->collisionLayers&classes[objects[n]->class]->collisionLayers) {
      u=objects[n]->up;
      objtrash(n);

      n=u;
    } 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;

Modified function.c from [0fdb3a7faa] to [89bf3c9a8b].

866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
static int vt1_objects_update(sqlite3_vtab*vt,int argc,sqlite3_value**argv,sqlite3_int64*rowid) {
  sqlite3_int64 id;
  int x,y,z;
  if(!main_options['e']) return SQLITE_LOCKED;
  if(argc==1) {
    // DELETE
    id=sqlite3_value_int64(argv[0]);
    pfunlink(id);
    free(objects[id]);
    objects[id]=0;
  } else if(sqlite3_value_type(argv[0])==SQLITE_NULL) {
    // INSERT
    if(sqlite3_value_type(argv[1])!=SQLITE_NULL || sqlite3_value_type(argv[2])!=SQLITE_NULL) return SQLITE_CONSTRAINT_VTAB;
    if(sqlite3_value_type(argv[3])==SQLITE_NULL) return SQLITE_CONSTRAINT_NOTNULL;
    if(sqlite3_value_type(argv[7])==SQLITE_NULL) return SQLITE_CONSTRAINT_NOTNULL;
    if(sqlite3_value_type(argv[11])!=SQLITE_NULL) return SQLITE_CONSTRAINT_VTAB;
    if(sqlite3_value_type(argv[12])!=SQLITE_NULL) return SQLITE_CONSTRAINT_VTAB;







|
<
<







866
867
868
869
870
871
872
873


874
875
876
877
878
879
880
static int vt1_objects_update(sqlite3_vtab*vt,int argc,sqlite3_value**argv,sqlite3_int64*rowid) {
  sqlite3_int64 id;
  int x,y,z;
  if(!main_options['e']) return SQLITE_LOCKED;
  if(argc==1) {
    // DELETE
    id=sqlite3_value_int64(argv[0]);
    objtrash(id);


  } else if(sqlite3_value_type(argv[0])==SQLITE_NULL) {
    // INSERT
    if(sqlite3_value_type(argv[1])!=SQLITE_NULL || sqlite3_value_type(argv[2])!=SQLITE_NULL) return SQLITE_CONSTRAINT_VTAB;
    if(sqlite3_value_type(argv[3])==SQLITE_NULL) return SQLITE_CONSTRAINT_NOTNULL;
    if(sqlite3_value_type(argv[7])==SQLITE_NULL) return SQLITE_CONSTRAINT_NOTNULL;
    if(sqlite3_value_type(argv[11])!=SQLITE_NULL) return SQLITE_CONSTRAINT_VTAB;
    if(sqlite3_value_type(argv[12])!=SQLITE_NULL) return SQLITE_CONSTRAINT_VTAB;