Free Hero Mesh

Check-in [48e77da6af]
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:Improve the error message for "Attempt to use a nonexistent object"; shortcut checking if oF is VOIDLINK in move_dir
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 48e77da6af4a3267487218dd69c562d754f91b58
User & Date: user on 2020-12-18 19:36:04
Other Links: manifest | tags
Context
2020-12-18
20:46
Implement "traceObject" resource to halt when a specific object is destroyed check-in: cb5540680c user: user tags: trunk
19:36
Improve the error message for "Attempt to use a nonexistent object"; shortcut checking if oF is VOIDLINK in move_dir check-in: 48e77da6af user: user tags: trunk
19:34
Change the object examination screen to correctly check the generation of any object which is referenced in a variable check-in: 6925d721e0 user: user tags: trunk
Changes

Modified exec.c from [7382111b50] to [5bd169313d].

445
446
447
448
449
450
451
452

453

454
455
456
457
458
459
460
}

static Uint32 v_object(Value v) {
  if(v.t==TY_NUMBER) {
    if(v.u) Throw("Cannot convert non-zero number to object");
    return VOIDLINK;
  } else if(v.t>TY_MAXTYPE) {
    if(v.u>=nobjects || !objects[v.u]) Throw("Attempt to use a nonexistent object");

    if(objects[v.u]->generation!=v.t) Throw("Attempt to use a nonexistent object");

    return v.u;
  } else {
    Throw("Cannot convert non-object to object");
  }
}

static inline int v_sh_dir(Value x) {







|
>
|
>







445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
}

static Uint32 v_object(Value v) {
  if(v.t==TY_NUMBER) {
    if(v.u) Throw("Cannot convert non-zero number to object");
    return VOIDLINK;
  } else if(v.t>TY_MAXTYPE) {
    if(v.u>=nobjects || !objects[v.u] || objects[v.u]->generation!=v.t) {
      if(main_options['t']) printf("Object %lu in generation %lu does not exist\n",(long)v.u,(long)v.t);
      Throw("Attempt to use a nonexistent object");
    }
    return v.u;
  } else {
    Throw("Cannot convert non-object to object");
  }
}

static inline int v_sh_dir(Value x) {
746
747
748
749
750
751
752

753
754
755
756
757
758
759
        }
        objE=obj_below(objE);
      }
    }
  } else {
    // Orthogonal movement
    if(hit) hit=(hit&0x0C000000)|0x800;

    objE=objF;
    while(objE!=VOIDLINK) {
      oE=objects[objE];
      if(oE->height>0) {
        hit&=~7;
        // HIT/HITBY messages
        v=send_message(objE,obj,MSG_HIT,NVALUE(oE->x),NVALUE(oE->y),NVALUE(hit));







>







748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
        }
        objE=obj_below(objE);
      }
    }
  } else {
    // Orthogonal movement
    if(hit) hit=(hit&0x0C000000)|0x800;
    if(!oF) goto fail;
    objE=objF;
    while(objE!=VOIDLINK) {
      oE=objects[objE];
      if(oE->height>0) {
        hit&=~7;
        // HIT/HITBY messages
        v=send_message(objE,obj,MSG_HIT,NVALUE(oE->x),NVALUE(oE->y),NVALUE(hit));
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
      objE=obj_below(objE);
    }
    if(hit&0x2008) goto fail;
    if((hit&0x48000)==0x8000) goto restart;
    if(!(hit&0x400000)) {
      if(hF<=o->climb || (hit&0x200000)) {
        if(hit&0x20000) goto success;
        if(!oF) goto fail;
        if(move_to(from,obj,oF->x,oF->y)) goto success; else goto fail;
      }
    }
    // Sliding
    if(hit&0x80) goto fail;
    hit|=0x10000;
    







<







788
789
790
791
792
793
794

795
796
797
798
799
800
801
      objE=obj_below(objE);
    }
    if(hit&0x2008) goto fail;
    if((hit&0x48000)==0x8000) goto restart;
    if(!(hit&0x400000)) {
      if(hF<=o->climb || (hit&0x200000)) {
        if(hit&0x20000) goto success;

        if(move_to(from,obj,oF->x,oF->y)) goto success; else goto fail;
      }
    }
    // Sliding
    if(hit&0x80) goto fail;
    hit|=0x10000;