ref: f4fc7ec0a6cfa2b6a0db00f8d34f2f7d0471cd60
parent: 2a9f768f9e36997f1cc75773ad892cfc72719ea0
author: qwx <[email protected]>
date: Mon Nov 22 18:48:03 EST 2021
sim: consider move a success if next to target this shouldn't even be a problem, but will have to be solved later
--- a/path.c
+++ b/path.c
@@ -445,15 +445,17 @@
}
int
-isnextto(Mobj *, Mobj *tgt)
+isnextto(Mobj *mo, Mobj *tgt)
{
+ Rectangle r1, r2;
+
if(tgt == nil)
return 0;
- /*
- FIXME: ??
- get nearest tgt node, distance = 0? other functions would use that too
- */
- return 0;
+ r1.min = mo->Point;
+ r1.max = addpt(r1.min, Pt(mo->o->w, mo->o->h));
+ r2.min = tgt->Point;
+ r2.max = addpt(r2.min, Pt(tgt->o->w, tgt->o->h));
+ return rectXrect(insetrect(r1, -1), r2);
}
static Node *
--- a/sim.move.c
+++ b/sim.move.c
@@ -271,6 +271,7 @@
movedone(mo);
return;
}
+ /* FIXME: this is a shitty hack, see notes */
if(isnextto(mo, mo->cmds[0].target1)){
dprint("%M stepmove: next to target, stopping\n", mo);
movedone(mo);