Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign upZ-level traps update #11445
Conversation
Coolthulhu
added some commits
Feb 27, 2015
BevapDin
reviewed
Mar 3, 2015
src/game.cpp
Outdated
| @@ -12106,6 +12124,9 @@ bool game::plmove(int dx, int dy) | |||
| u.lifetime_stats()->squares_walked++; | |||
| } | |||
|
|
|||
| // Recalc dest_loc after possible shift | |||
| dest_loc = tripoint( x, y, u.posz() ); | |||
This comment has been minimized.
This comment has been minimized.
BevapDin
Mar 3, 2015
Contributor
At this point forget about dest_loc and use u.pos3() instead (in the following trap related code). It's the same (just called u.set_x(x) above) and per definition one wants to trigger the trap the character is on (trap location == player location is a logically required condition for triggering the trap).
This also allows to make dest_loc const, which reduces the complexity of the function.
BevapDin
reviewed
Mar 3, 2015
src/npcmove.cpp
Outdated
| if (!this->avoid_trap(tr, x, y)) { | ||
| tr->trigger(this, x, y); | ||
| if (!this->avoid_trap( tripoint( x, y, posz() ), tr )) { | ||
| tr->trigger( tripoint( x, y, posz() ), this ); |
This comment has been minimized.
This comment has been minimized.
BevapDin
Mar 3, 2015
Contributor
Same here: just a few line above the position of the NPC has been set to (x,y), so you can use pos3() here instead of creating the tripoint manually.
This comment has been minimized.
This comment has been minimized.
|
Let Z-levels work commence! |
kevingranade
merged commit 80cd416
into
CleverRaven:master
Mar 21, 2015
1 check passed
default
Details
Coolthulhu
deleted the
cataclysmbnteam:zlev-traps
branch
Apr 10, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Coolthulhu commentedMar 2, 2015
Includes #11439
Doesn't yet change all trap functions, only the base trap system. I'll update them later, after item adding related functions.