Free Hero Mesh

Check-in [a1b15b3309]
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:Allow ,Destroyed to be used on nonexistent objects
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: a1b15b3309c7fb8c0e64cf3807f996e979de8557
User & Date: user on 2020-12-29 08:35:42
Other Links: manifest | tags
Context
2020-12-30
01:04
Make BEGIN_TURN message to receive the saved X/Y coordinates rather than the current coordinates check-in: 0d6a84171e user: user tags: trunk
2020-12-29
08:35
Allow ,Destroyed to be used on nonexistent objects check-in: a1b15b3309 user: user tags: trunk
08:27
Implement "is" instruction, and do not send MSG_CREATED for itself check-in: cc7a46d4df user: user tags: trunk
Changes

Modified class.doc from [2fefe38c20] to [04d4b7d173].

543
544
545
546
547
548
549
550



551
552
553
554
555
556
557
543
544
545
546
547
548
549

550
551
552
553
554
555
556
557
558
559







-
+
+
+







Departures : int32
  This is like Arrivals but for positions where it is triggered by objects
  leaving those locations rather than arriving there.

Destroyed : bool [ro]
  It is set if this object has been successfully destroyed (but not yet
  deleted from memory). You must use the Destroy or Assassinate command
  in order to set this flag; you cannot set it by yourself.
  in order to set this flag; you cannot set it by yourself. Unlike all
  other variables, you can access this variable even for an object that
  does not exist; it returns 1 in that case.

Dir : int3
  The current direction. When it moves (without teleportation), it will
  automatically be set to the direction it moved. You can also set this
  by yourself. Relative directions are relative to this direction. If you
  set this by yourself to a relative direction, then it will automatically
  be set to an absolute direction, based on the previous value.

Modified exec.c from [7198bae085] to [5a51fde78e].

514
515
516
517
518
519
520












521
522
523
524
525
526
527
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539







+
+
+
+
+
+
+
+
+
+
+
+







  } else if(x.t==TY_CLASS && y.t==TY_CLASS) {
    return (x.u==y.u)?1:0;
    //TODO: subclassing (using CF_GROUP)
  } else {
    Throw("Type mismatch");
  }
}

static Uint32 v_destroyed(Value v) {
  if(v.t==TY_NUMBER) {
    if(v.u) Throw("Cannot convert non-zero number to object");
    return 0;
  } else if(v.t>TY_MAXTYPE) {
    if(v.u>=nobjects || !objects[v.u] || objects[v.u]->generation!=v.t) return 1;
    return objects[v.u]->oflags&OF_DESTROYED?1:0;
  } else {
    Throw("Cannot convert non-object to object");
  }
}

static Uint8 collisions_at(Uint32 x,Uint32 y) {
  Uint8 c=0;
  Uint32 n;
  if(x<1 || y<1 || x>pfwidth || y>pfheight) return 0;
  n=playfield[x+y*64-65];
  while(n!=VOIDLINK) {
1262
1263
1264
1265
1266
1267
1268
1269

1270
1271
1272
1273
1274
1275
1276
1274
1275
1276
1277
1278
1279
1280

1281
1282
1283
1284
1285
1286
1287
1288







-
+







    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_DESTROYED_C: StackReq(1,1); t1=Pop(); Push(NVALUE(v_destroyed(t1))); 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;
    case OP_DISTANCE_C: StackReq(1,1); Push(GetVariableOf(distance,NVALUE)); break;
    case OP_DISTANCE_E: StackReq(1,0); t1=Pop(); Numeric(t1); o->distance=t1.u; break;