kohakulee / corsix-th

Automatically exported from code.google.com/p/corsix-th
0 stars 0 forks source link

Error when placing doctor in GP and nearest desk is in another room #38

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Construct two GPs, opposite to each other so the doors of the two are
very near to each other. Furthermore, one of them has to be very big.
2. Place the desk in the big GP far away from the door, the desk in the
other GP near its door.
3. Hire a doctor and place him inside the big GP, but near its door, so the
path to the desk in the other GP is shorter than the path to the room he's in.

What version of the product are you using? On what operating system?
r103

Please provide any additional information below.
An error has occured while running the buttonup handler.
A stack trace is included below, and the handler has been disconnected.
Lua\rooms\gp.lua:72: attempt to index local 'desk' (a nil value)
stack traceback:
        Lua\rooms\gp.lua:72: in function 'onHumanoidEnter'
        Lua\humanoid_actions\pickup.lua:28: in function 'on_interrupt'
        Lua\humanoid.lua:163: in function 'setNextAction'
        Lua\dialogs\place_staff.lua:51: in function 'close'
        Lua\dialogs\place_staff.lua:90: in function 'onMouseUp'
        Lua\window.lua:238: in function 'onMouseUp'
        Lua\ui.lua:391: in function 'dispatch'
        Lua\app.lua:251: in function <Lua\app.lua:246>

Original issue reported on code.google.com by roujin.mw on 20 Nov 2009 at 4:47

GoogleCodeExporter commented 9 years ago
I cannot reproduce this using your instructions - see the attached image for
something which fits your instructions but works fine. The error message sounds 
like
the pathfinding code cannot find the desk in the current room - had it found 
the desk
in the other room then 'desk' wouldn't be nil. The object pathfinding code 
should
only be searching within the current room anyway, so having a second nearby 
shouldn't
affect it.

I can get the same error message with just one GP's room, and by placing the 
desk
facing east and such that there is no path to the back of the desk (for 
example, by
placing it up against a wall).

Original comment by cor...@gmail.com on 20 Nov 2009 at 8:37

GoogleCodeExporter commented 9 years ago
Sorry, seems I misinterpreted the situation. Indeed, in my test the desk in the
second room was placed east and up against a wall, like you're describing, this 
seems
to be the cause for the error.

Actually from glancing at your last commit I *thought* there might be a problem 
if
the nearest (as the crow flies) desk is in another room - so I tested it and 
when I
got an error I thought my theory was proven. What a funny coincidence that I 
stumbled
over a completely different bug by mistake :)

---
I just found another configuration where the same error happens, without the 
desk
facing east.
A 4x4 GP with the following layout (up corresponds to north):
. = empty; D = desk; R = drawer; C = chair; small letters = walkable tile of
desk/drawer/chair

....
DDDR
cDdr
C...
  ^
Interestingly, placing the doc behind the desk won't produce the error. But 
placing
the doc so he's stuck between the desk and the chair (i.e. on 'c') will.

Original comment by roujin.mw on 20 Nov 2009 at 10:18

GoogleCodeExporter commented 9 years ago
There are a two issues here:
1) THOB markers being on the same tile as the object is attached to for 
rendering
purposes. This works for most objects, but for east-facing desks, the tile 
which is
attached to for rendering purposes is not adjacent to the usage tile, so if 
there is
no path to the back of the desk, the usage tile is not found, even if the usage 
tile
is reachable.
2) Allowing objects to be placed in rooms such that not every walkable tile is 
reachable

Original comment by cor...@gmail.com on 20 Nov 2009 at 10:49

GoogleCodeExporter commented 9 years ago
r104 should fix the original issue (point 1 in my above post)

Original comment by cor...@gmail.com on 21 Nov 2009 at 12:03

GoogleCodeExporter commented 9 years ago
r105 should fix the remainder of this issue (by making your given layout 
invalid).

Original comment by cor...@gmail.com on 21 Nov 2009 at 1:45