Free Hero Mesh

Check-in [eb593e0796]
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:Implement the Destroy instruction (currently untested).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: eb593e07962cf83588922b3a7a61d9c732e7a21e
User & Date: user on 2020-12-13 08:41:27
Other Links: manifest | tags
Context
2020-12-13
21:28
Implement the CollisionLayers and Inertia instructions. check-in: c08f797ece user: user tags: trunk
08:41
Implement the Destroy instruction (currently untested). check-in: eb593e0796 user: user tags: trunk
2020-12-12
21:12
Remove NoIgnore() from writes to the Distance variable; it is safe to alter this variable during ignored turns check-in: 3ec2889a26 user: user tags: trunk
Changes

Modified exec.c from [4559008384] to [9a263aee63].

382
383
384
385
386
387
388
389

390
391

392
393
394
395
396
397
398
382
383
384
385
386
387
388

389
390

391
392
393
394
395
396
397
398







-
+

-
+







}

static Value destroy(Uint32 from,Uint32 to,Uint32 why) {
  Object*o;
  Value v;
  int i,x,y,xx,yy;
  Uint32 n;
  if(n==VOIDLINK) return NVALUE(0);
  if(to==VOIDLINK) return NVALUE(0);
  o=objects[to];
  // Not checking if it is already destroyed, since EKS Hero Mesh doesn't check.
  // EKS Hero Mesh doesn't check if it already destroyed.
  v=send_message(from,to,MSG_DESTROY,NVALUE(0),NVALUE(0),NVALUE(why));
  if(!v_bool(v)) {
    o->oflags|=OF_DESTROYED;
    if(firstobj==to) firstobj=o->next;
    if(lastobj==to) lastobj=o->prev;
    if(o->prev!=VOIDLINK) objects[o->prev]->next=o->next;
    if(o->next!=VOIDLINK) objects[o->next]->prev=o->prev;
620
621
622
623
624
625
626




627
628
629
630
631
632
633
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637







+
+
+
+







    case OP_DEPARTED_C: StackReq(1,1); Push(GetVariableOf(departed&0x1FFFFFF,NVALUE)); break;
    case OP_DEPARTED_E: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->departed=t1.u; break;
    case OP_DEPARTED_EC: NoIgnore(); StackReq(2,0); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i!=VOIDLINK) objects[i]->departed=t1.u; break;
    case OP_DEPARTURES: StackReq(0,1); Push(NVALUE(o->departures&0x1FFFFFF)); break;
    case OP_DEPARTURES_C: StackReq(1,1); Push(GetVariableOrAttributeOf(departures&0x1FFFFFF,NVALUE)); break;
    case OP_DEPARTURES_E: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->departures=t1.u; break;
    case OP_DEPARTURES_EC: NoIgnore(); StackReq(2,0); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i!=VOIDLINK) objects[i]->departures=t1.u; break;
    case OP_DESTROY: NoIgnore(); StackReq(0,1); Push(destroy(obj,obj,0)); break;
    case OP_DESTROY_C: NoIgnore(); StackReq(1,1); i=v_object(Pop()); Push(destroy(obj,i,0)); break;
    case OP_DESTROY_D: NoIgnore(); destroy(obj,obj,0); break;
    case OP_DESTROY_CD: NoIgnore(); StackReq(1,0); i=v_object(Pop()); destroy(obj,i,0); break;
    case OP_DESTROYED: StackReq(0,1); if(o->oflags&OF_DESTROYED) Push(NVALUE(1)); else Push(NVALUE(0)); break;
    case OP_DESTROYED_C: StackReq(1,1); GetFlagOf(OF_DESTROYED); break;
    case OP_DIR: StackReq(0,1); Push(NVALUE(o->dir)); break;
    case OP_DIR_C: StackReq(1,1); Push(GetVariableOf(dir,NVALUE)); break;
    case OP_DIR_E: NoIgnore(); StackReq(1,0); t1=Pop(); Numeric(t1); o->dir=resolve_dir(obj,t1.u); break;
    case OP_DIR_EC: NoIgnore(); StackReq(2,0); t1=Pop(); Numeric(t1); i=v_object(Pop()); if(i!=VOIDLINK) objects[i]->dir=resolve_dir(i,t1.u); break;
    case OP_DISTANCE: StackReq(0,1); Push(NVALUE(o->distance)); break;