Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Z-level traps update #11445

Merged
merged 5 commits into from Mar 21, 2015

Conversation

Projects
None yet
4 participants
@Coolthulhu
Copy link
Contributor

commented Mar 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.

@@ -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.

Copy link
@BevapDin

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.

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.

Copy link
@BevapDin

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.

@Zireael07

This comment has been minimized.

Copy link
Contributor

commented Mar 9, 2015

Let Z-levels work commence!

@kevingranade kevingranade merged commit 80cd416 into CleverRaven:master Mar 21, 2015

1 check passed

default
Details

@Coolthulhu 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
You can’t perform that action at this time.