curiousdannii-testing / inform7-imported-bugs

0 stars 0 forks source link

[I7-2025] [Mantis 2062] "best route" and "number of moves" don't work on things #59

Open curiousdannii-testing opened 2 years ago

curiousdannii-testing commented 2 years ago

Reported by : zarf

Description :

The documentation and phrase specs for these phrases are defined for "objects", but the implementation only works on rooms. If you try to use them on things, you get nonsensical results.

The phrases should either be limited to rooms, or the top-level call (MapRouteTo) should do a "location of..." canonicalization on non-room arguments.

Steps to reproduce :

The Kitchen is a room.
The Dining Room is east of the Kitchen.
The Bathroom is south of the Dining Room.
The tub is in the Bathroom.

Every turn:
    showme the number of moves from the player to the tub;
    showme the best route from the player to the tub.

Additional information :

imported from: [Mantis 2062] "best route" and "number of moves" don't work on things
  • status: Reported
  • resolution: Open
  • resolved: 2022-04-07T05:02:37+10:00
  • imported: 2022/01/10
curiousdannii-testing commented 2 years ago

557058:4c095ffd-6d6f-47ce-9e73-77c613347b86:

Comment by zarf :
While I'm in here, I notice that "number of moves from" inconsistently returns 0 when one room or the other is nothing. It should return -1.

This is a fairly common case when the code looks like "number of moves from the location of X to the location of Y". If Y is out of play, this should return -1.

The problem is that MapRouteTo() has some fail-early checks which always return nothing. They should look like "if (count) return -1; else return nothing;"