Before this commit, the new location of the monster was put in project_m_x and project_m_y, but since these have been removed, the code now uses the old location.
Commit c108115 breaks teleport other
Collapse
X
-
Commit c108115 breaks teleport other
PWMAngband variant maintainer - check https://github.com/draconisPW/PWMAngband (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!Tags: None -
Old code:
Code:/* Check for NULL, since polymorph can occasionally return NULL. */ if (mon != NULL) { /* Update the monster */ if (!mon_died) update_mon(mon, cave, FALSE); [B]/* Hack -- get new location in case of teleport */ <-- changes x and y y = mon->fy; x = mon->fx;[/B] /* Redraw the monster grid */ square_light_spot(cave, y, x); /* Update monster recall window */ if (player->upkeep->monster_race == mon->race) { /* Window stuff */ player->upkeep->redraw |= (PR_MONSTER); } } /* Track it */ project_m_n++; project_m_x = x; project_m_y = y;
Code:/* Track it */ *did_hit = true;
Code:/* Check monsters */ if (flg & (PROJECT_KILL)) { bool was_obvious = false; bool did_hit = false; int num_hit = 0; int last_hit_x = 0; int last_hit_y = 0; /* Scan for monsters */ for (i = 0; i < num_grids; i++) { /* Get the grid location */ y = blast_grid[i].y; x = blast_grid[i].x; /* Check this monster hasn't been processed already */ if (!square_isproject(cave, y, x)) continue; /* Affect the monster in the grid */ project_m(who, distance_to_grid[i], y, x, dam_at_dist[distance_to_grid[i]], typ, flg, &did_hit, &was_obvious); if (was_obvious) notice = TRUE; if (did_hit) { num_hit++; [B]last_hit_x = x; <-- old coordinates last_hit_y = y;[/B] } } /* Player affected one monster (without "jumping") */ if ((who < 0) && (num_hit == 1) && !(flg & (PROJECT_JUMP))) { /* Location */ [B]x = last_hit_x; <-- old coordinates y = last_hit_y;[/B] [B]/* Track if possible */ <-- does nothing in case of teleport, since the coordinates have changed if (cave->squares[y][x].mon > 0) { struct monster *mon = square_monster(cave, y, x); /* Recall and track */ if (mflag_has(mon->mflag, MFLAG_VISIBLE)) { monster_race_track(player->upkeep, mon->race); health_track(player->upkeep, mon); } }[/B] } }
PWMAngband variant maintainer - check https://github.com/draconisPW/PWMAngband (or http://www.mangband.org/forum/viewforum.php?f=9) to learn more about this new variant!Comment
Comment