curiousdannii-testing / inform7-imported-bugs

0 stars 0 forks source link

[I7-1315] [Mantis 1351] Giving orders to your former self causes stack overflow #769

Closed curiousdannii-testing closed 2 years ago

curiousdannii-testing commented 2 years ago

Reported by : DavidG

Description :

If you switch bodies, then order your former self to do something, the game crashes with a stack overflow.

Steps to reproduce :

Constant DEBUG;
Constant STORY "Selves: An investigation of switching bodies.^";
Include "parser.h";
Include "verblib.h";
Include "Grammar";

[ Initialise;
    location = theroom;
    player.narrative_voice = 3;
    player.short_name = "George";
    player.name = 'George';
    player.nameless = false;
];

Object theroom "The Room"
    with description "This is just a plain room like any other.",
    has light;

Object -> Box "box"
    with name 'box',
    description "It's a big wooden box with a lock.",
    with_key Key,
    has container openable enterable lockable;

Object -> Key "key"
    with name "key",
    description "It's an ordinary looking key.";

Object -> Hat "hat"
    with name 'hat',
    description "Just an ordinary hat.",
    has clothing;

Object -> Table "table"
    with name "table",
    capacity 2,
    has supporter;

Object -> -> Button "button"
    with name 'button',
    description "An unlabeled button.",
    before [;
      Push:
        if (player == Kitty)
            ChangePlayer(selfobj);
        else
            ChangePlayer(Kitty);
        "You feel strange and suddenly you realize you're in a 
        different body.";
    ],
    has static;

Object -> Kitty "Kitty"
    with name "kitty" "cat",
    short_name "Kitty",
    description "Kitty is a cute kitty-cat.",
    narrative_voice 3,
    orders [;
    Take:   <>;
    Give:   <>;
    Drop:   <>;
    Go: <>;
    Open:   <>;
    Close:  <>;
    Enter:  <>;
    Wear:   <>;
    ],
    has female proper animate transparent;

Verb 'who'
    * 'am' 'i'  -> WhoAmI;

[WhoAmISub;
    "You are ", (string) player.short_name, ".";
];

Additional information :

imported from: [Mantis 1351] Giving orders to your former self causes stack overflow
  • status: Closed
  • resolution: Resolved
  • resolved: 2022-04-15T09:11:24+10:00
  • imported: 2022/01/10
curiousdannii-testing commented 2 years ago

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

Comment by DavidG :
This appears to be related to my confusion expressed in this post: http://www.intfiction.org/forum/viewtopic.php?f=7&t=14471.

If I prefix Kitty's order action code with "if (self ~= player)", then ordering George to do something will return the expected "George has better things to do.".

This is not something the Library should keep track of.

curiousdannii-testing commented 2 years ago

61eedb62875fc10070240916:

Closed due to age.