#include "angband.h"
#include "util.h"
+#include "world.h"
+#include "term.h"
#include "object.h"
+#include "cmd-dump.h"
+#include "cmd-spell.h"
#include "spells.h"
#include "dungeon.h"
#include "floor.h"
#include "grid.h"
+#include "objectkind.h"
#include "object-boost.h"
+#include "object-ego.h"
#include "object-flavor.h"
#include "object-hook.h"
#include "object-curse.h"
#include "player-status.h"
#include "player-move.h"
#include "player-effects.h"
+#include "player-class.h"
+#include "player-personality.h"
#include "monster.h"
#include "monsterrace-hook.h"
+#include "object-ego.h"
+#include "view-mainwindow.h"
/*!
* @brief 床上、モンスター所持でスタックされたアイテムを削除しスタックを補完する / Excise a dungeon object from any stacks
OBJECT_IDX prev_o_idx = 0;
/* Object */
- j_ptr = ¤t_floor_ptr->o_list[o_idx];
+ j_ptr = &p_ptr->current_floor_ptr->o_list[o_idx];
- if (j_ptr->held_m_idx)
+ if (OBJECT_IS_HELD_MONSTER(j_ptr))
{
monster_type *m_ptr;
- m_ptr = ¤t_floor_ptr->m_list[j_ptr->held_m_idx];
+ m_ptr = &p_ptr->current_floor_ptr->m_list[j_ptr->held_m_idx];
/* Scan all objects in the grid */
for (this_o_idx = m_ptr->hold_o_idx; this_o_idx; this_o_idx = next_o_idx)
{
object_type *o_ptr;
- o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
+ o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx];
next_o_idx = o_ptr->next_o_idx;
if (this_o_idx == o_idx)
object_type *k_ptr;
/* Previous object */
- k_ptr = ¤t_floor_ptr->o_list[prev_o_idx];
+ k_ptr = &p_ptr->current_floor_ptr->o_list[prev_o_idx];
/* Remove from list */
k_ptr->next_o_idx = next_o_idx;
POSITION y = j_ptr->iy;
POSITION x = j_ptr->ix;
- g_ptr = ¤t_floor_ptr->grid_array[y][x];
+ g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
/* Scan all objects in the grid */
for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
{
object_type *o_ptr;
- o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
+ o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx];
next_o_idx = o_ptr->next_o_idx;
if (this_o_idx == o_idx)
object_type *k_ptr;
/* Previous object */
- k_ptr = ¤t_floor_ptr->o_list[prev_o_idx];
+ k_ptr = &p_ptr->current_floor_ptr->o_list[prev_o_idx];
/* Remove from list */
k_ptr->next_o_idx = next_o_idx;
excise_object_idx(o_idx);
/* Object */
- j_ptr = ¤t_floor_ptr->o_list[o_idx];
+ j_ptr = &p_ptr->current_floor_ptr->o_list[o_idx];
/* Dungeon floor */
- if (!(j_ptr->held_m_idx))
+ if (!OBJECT_IS_HELD_MONSTER(j_ptr))
{
POSITION y, x;
y = j_ptr->iy;
object_wipe(j_ptr);
/* Count objects */
- o_cnt--;
+ p_ptr->current_floor_ptr->o_cnt--;
}
OBJECT_IDX this_o_idx, next_o_idx = 0;
/* Refuse "illegal" locations */
- if (!in_bounds(y, x)) return;
+ if (!in_bounds(p_ptr->current_floor_ptr, y, x)) return;
- g_ptr = ¤t_floor_ptr->grid_array[y][x];
+ g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
/* Scan all objects in the grid */
for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
{
object_type *o_ptr;
- o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
+ o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx];
next_o_idx = o_ptr->next_o_idx;
object_wipe(o_ptr);
/* Count objects */
- o_cnt--;
+ p_ptr->current_floor_ptr->o_cnt--;
}
/* Objects are gone */
if (i1 == i2) return;
/* Repair objects */
- for (i = 1; i < o_max; i++)
+ for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++)
{
- o_ptr = ¤t_floor_ptr->o_list[i];
+ o_ptr = &p_ptr->current_floor_ptr->o_list[i];
/* Skip "dead" objects */
if (!o_ptr->k_idx) continue;
o_ptr->next_o_idx = i2;
}
}
- o_ptr = ¤t_floor_ptr->o_list[i1];
+ o_ptr = &p_ptr->current_floor_ptr->o_list[i1];
- if (o_ptr->held_m_idx)
+ if (OBJECT_IS_HELD_MONSTER(o_ptr))
{
monster_type *m_ptr;
-
- /* Acquire monster */
- m_ptr = ¤t_floor_ptr->m_list[o_ptr->held_m_idx];
+ m_ptr = &p_ptr->current_floor_ptr->m_list[o_ptr->held_m_idx];
/* Repair monster */
if (m_ptr->hold_o_idx == i1)
x = o_ptr->ix;
/* Acquire grid */
- g_ptr = ¤t_floor_ptr->grid_array[y][x];
+ g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
/* Repair grid */
if (g_ptr->o_idx == i1)
}
/* Structure copy */
- current_floor_ptr->o_list[i2] = current_floor_ptr->o_list[i1];
+ p_ptr->current_floor_ptr->o_list[i2] = p_ptr->current_floor_ptr->o_list[i1];
/* Wipe the hole */
object_wipe(o_ptr);
cur_dis = 5 * (20 - cnt);
/* Examine the objects */
- for (i = 1; i < o_max; i++)
+ for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++)
{
- o_ptr = ¤t_floor_ptr->o_list[i];
+ o_ptr = &p_ptr->current_floor_ptr->o_list[i];
- /* Skip dead objects */
- if (!o_ptr->k_idx) continue;
+ if (!OBJECT_IS_VALID(o_ptr)) continue;
/* Hack -- High level objects start out "immune" */
if (k_info[o_ptr->k_idx].level > cur_lev) continue;
- if (o_ptr->held_m_idx)
+ if (OBJECT_IS_HELD_MONSTER(o_ptr))
{
monster_type *m_ptr;
-
- /* Acquire monster */
- m_ptr = ¤t_floor_ptr->m_list[o_ptr->held_m_idx];
+ m_ptr = &p_ptr->current_floor_ptr->m_list[o_ptr->held_m_idx];
y = m_ptr->fy;
x = m_ptr->fx;
/* Excise dead objects (backwards!) */
- for (i = o_max - 1; i >= 1; i--)
+ for (i = p_ptr->current_floor_ptr->o_max - 1; i >= 1; i--)
{
- o_ptr = ¤t_floor_ptr->o_list[i];
+ o_ptr = &p_ptr->current_floor_ptr->o_list[i];
/* Skip real objects */
if (o_ptr->k_idx) continue;
/* Move last object into open hole */
- compact_objects_aux(o_max - 1, i);
-
- /* Compress "o_max" */
- o_max--;
- }
-}
-
-
-/*!
- * @brief グローバルオブジェクト配列を初期化する /
- * Delete all the items when player leaves the level
- * @note we do NOT visually reflect these (irrelevant) changes
- * @details
- * Hack -- we clear the "g_ptr->o_idx" field for every grid,
- * and the "m_ptr->next_o_idx" field for every monster, since
- * we know we are clearing every object. Technically, we only
- * clear those fields for grids/monsters containing objects,
- * and we clear it once for every such object.
- * @return なし
- */
-void wipe_o_list(void)
-{
- int i;
-
- /* Delete the existing objects */
- for (i = 1; i < o_max; i++)
- {
- object_type *o_ptr = ¤t_floor_ptr->o_list[i];
-
- /* Skip dead objects */
- if (!o_ptr->k_idx) continue;
-
- /* Mega-Hack -- preserve artifacts */
- if (!character_dungeon || preserve_mode)
- {
- /* Hack -- Preserve unknown artifacts */
- if (object_is_fixed_artifact(o_ptr) && !object_is_known(o_ptr))
- {
- /* Mega-Hack -- Preserve the artifact */
- a_info[o_ptr->name1].cur_num = 0;
- }
- }
-
- if (o_ptr->held_m_idx)
- {
- monster_type *m_ptr;
- m_ptr = ¤t_floor_ptr->m_list[o_ptr->held_m_idx];
-
- /* Hack -- see above */
- m_ptr->hold_o_idx = 0;
- }
-
- /* Dungeon */
- else
- {
- grid_type *g_ptr;
+ compact_objects_aux(p_ptr->current_floor_ptr->o_max - 1, i);
- /* Access location */
- POSITION y = o_ptr->iy;
- POSITION x = o_ptr->ix;
-
- /* Access grid */
- g_ptr = ¤t_floor_ptr->grid_array[y][x];
-
- /* Hack -- see above */
- g_ptr->o_idx = 0;
- }
- object_wipe(o_ptr);
+ /* Compress "p_ptr->current_floor_ptr->o_max" */
+ p_ptr->current_floor_ptr->o_max--;
}
-
- /* Reset "o_max" */
- o_max = 1;
-
- /* Reset "o_cnt" */
- o_cnt = 0;
}
-
/*!
* @brief グローバルオブジェクト配列から空きを取得する /
* Acquires and returns the index of a "free" object.
OBJECT_IDX i;
/* Initial allocation */
- if (o_max < current_floor_ptr->max_o_idx)
+ if (p_ptr->current_floor_ptr->o_max < current_world_ptr->max_o_idx)
{
/* Get next space */
- i = o_max;
+ i = p_ptr->current_floor_ptr->o_max;
/* Expand object array */
- o_max++;
+ p_ptr->current_floor_ptr->o_max++;
/* Count objects */
- o_cnt++;
+ p_ptr->current_floor_ptr->o_cnt++;
/* Use this object */
return (i);
/* Recycle dead objects */
- for (i = 1; i < o_max; i++)
+ for (i = 1; i < p_ptr->current_floor_ptr->o_max; i++)
{
object_type *o_ptr;
- o_ptr = ¤t_floor_ptr->o_list[i];
+ o_ptr = &p_ptr->current_floor_ptr->o_list[i];
/* Skip live objects */
if (o_ptr->k_idx) continue;
/* Count objects */
- o_cnt++;
+ p_ptr->current_floor_ptr->o_cnt++;
/* Use this object */
return (i);
/* Warn the player (except during dungeon creation) */
- if (character_dungeon) msg_print(_("アイテムが多すぎる!", "Too many objects!"));
+ if (current_world_ptr->character_dungeon) msg_print(_("アイテムが多すぎる!", "Too many objects!"));
return (0);
}
+/*
+ * Hack -- function hook to restrict "get_obj_num_prep()" function
+ */
+bool(*get_obj_num_hook)(KIND_OBJECT_IDX k_idx);
/*!
* @brief オブジェクト生成テーブルに生成制約を加える /
* Note that if no objects are "appropriate", then this function will\n
* fail, and return zero, but this should *almost* never happen.\n
*/
-OBJECT_IDX get_obj_num(DEPTH level)
+OBJECT_IDX get_obj_num(DEPTH level, BIT_FLAGS mode)
{
int i, j, p;
KIND_OBJECT_IDX k_idx;
/* Access the actual kind */
k_ptr = &k_info[k_idx];
- /* Hack -- prevent embedded chests */
- if (opening_chest && (k_ptr->tval == TV_CHEST)) continue;
+ if ((mode & AM_FORBID_CHEST) && (k_ptr->tval == TV_CHEST)) continue;
/* Accept */
table[i].prob3 = table[i].prob2;
return (table[i].index);
}
-
/*!
* @brief オブジェクトを鑑定済にする /
* Known is true when the "attributes" of an object are "known".
q_ptr->number = 1;
object_desc(o_name, q_ptr, OD_NAME_ONLY);
- do_cmd_write_nikki(NIKKI_HANMEI, 0, o_name);
+ exe_write_diary(p_ptr, NIKKI_HANMEI, 0, o_name);
}
}
if (power > 1)
{
if (one_in_(30) || (power > 2)) /* power > 2 is debug only */
- create_artifact(o_ptr, FALSE);
+ become_random_artifact(o_ptr, FALSE);
else
/* Special Ego-item */
o_ptr->name2 = EGO_DIGGING;
{
if (one_in_(40) || (power > 2)) /* power > 2 is debug only */
{
- create_artifact(o_ptr, FALSE);
+ become_random_artifact(o_ptr, FALSE);
break;
}
while (1)
{
if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
{
- create_artifact(o_ptr, FALSE);
+ become_random_artifact(o_ptr, FALSE);
break;
}
o_ptr->name2 = get_random_ego(INVEN_BOW, TRUE);
{
if (power > 2) /* power > 2 is debug only */
{
- create_artifact(o_ptr, FALSE);
+ become_random_artifact(o_ptr, FALSE);
break;
}
case TV_DRAG_ARMOR:
{
if (one_in_(50) || (power > 2)) /* power > 2 is debug only */
- create_artifact(o_ptr, FALSE);
+ become_random_artifact(o_ptr, FALSE);
break;
}
if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
{
- create_artifact(o_ptr, FALSE);
+ become_random_artifact(o_ptr, FALSE);
break;
}
{
if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
{
- create_artifact(o_ptr, FALSE);
+ become_random_artifact(o_ptr, FALSE);
break;
}
{
if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
{
- create_artifact(o_ptr, FALSE);
+ become_random_artifact(o_ptr, FALSE);
break;
}
o_ptr->name2 = get_random_ego(INVEN_HANDS, TRUE);
{
if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
{
- create_artifact(o_ptr, FALSE);
+ become_random_artifact(o_ptr, FALSE);
break;
}
o_ptr->name2 = get_random_ego(INVEN_FEET, TRUE);
{
if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
{
- create_artifact(o_ptr, FALSE);
+ become_random_artifact(o_ptr, FALSE);
break;
}
while (1)
{
if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
{
- create_artifact(o_ptr, FALSE);
+ become_random_artifact(o_ptr, FALSE);
break;
}
while (1)
{
if (one_in_(20) || (power > 2)) /* power > 2 is debug only */
{
- create_artifact(o_ptr, FALSE);
+ become_random_artifact(o_ptr, FALSE);
break;
}
o_ptr->name2 = get_random_ego(INVEN_OUTER, TRUE);
{
o_ptr->pval = MIN(o_ptr->pval, 4);
/* Randart amulet */
- create_artifact(o_ptr, FALSE);
+ become_random_artifact(o_ptr, FALSE);
}
else if ((power == 2) && one_in_(2))
{
{
o_ptr->pval = MIN(o_ptr->pval, 4);
/* Randart amulet */
- create_artifact(o_ptr, FALSE);
+ become_random_artifact(o_ptr, FALSE);
}
else if ((power == 2) && one_in_(2))
{
if (power > 2) /* power > 2 is debug only */
{
- create_artifact(o_ptr, FALSE);
+ become_random_artifact(o_ptr, FALSE);
}
else if ((power == 2) || ((power == 1) && one_in_(3)))
{
r_ptr = &r_info[i];
- check = (current_floor_ptr->dun_level < r_ptr->level) ? (r_ptr->level - current_floor_ptr->dun_level) : 0;
+ check = (p_ptr->current_floor_ptr->dun_level < r_ptr->level) ? (r_ptr->level - p_ptr->current_floor_ptr->dun_level) : 0;
/* Ignore dead monsters */
if (!r_ptr->rarity) continue;
/* Pick a random non-unique monster race */
while (1)
{
- i = get_mon_num(current_floor_ptr->dun_level);
+ i = get_mon_num(p_ptr->current_floor_ptr->dun_level);
r_ptr = &r_info[i];
- check = (current_floor_ptr->dun_level < r_ptr->level) ? (r_ptr->level - current_floor_ptr->dun_level) : 0;
+ check = (p_ptr->current_floor_ptr->dun_level < r_ptr->level) ? (r_ptr->level - p_ptr->current_floor_ptr->dun_level) : 0;
/* Ignore dead monsters */
if (!r_ptr->rarity) continue;
o_ptr->pval = randint1(obj_level);
if (o_ptr->sval == SV_CHEST_KANDUME) o_ptr->pval = 6;
- o_ptr->xtra3 = current_floor_ptr->dun_level + 5;
+ o_ptr->xtra3 = p_ptr->current_floor_ptr->dun_level + 5;
/* Never exceed "difficulty" of 55 to 59 */
if (o_ptr->pval > 55) o_ptr->pval = 55 + (byte)randint0(5);
a_ptr->cur_num = 1;
/* Hack -- Memorize location of artifact in saved floors */
- if (character_dungeon)
+ if (current_world_ptr->character_dungeon)
a_ptr->floor_id = p_ptr->floor_id;
/* Extract the other fields */
* @return 生成に成功したらTRUEを返す。
* @details
* This routine plays nasty games to generate the "special artifacts".\n
- * This routine uses "current_floor_ptr->object_level" for the "generation level".\n
+ * This routine uses "p_ptr->current_floor_ptr->object_level" for the "generation level".\n
* We assume that the given object has been "wiped".\n
*/
bool make_object(object_type *j_ptr, BIT_FLAGS mode)
prob = ((mode & AM_GOOD) ? 10 : 1000);
/* Base level for the object */
- base = ((mode & AM_GOOD) ? (current_floor_ptr->object_level + 10) : current_floor_ptr->object_level);
+ base = ((mode & AM_GOOD) ? (p_ptr->current_floor_ptr->object_level + 10) : p_ptr->current_floor_ptr->object_level);
/* Generate a special object, or a normal object */
if (get_obj_num_hook) get_obj_num_prep();
/* Pick a random object */
- k_idx = get_obj_num(base);
+ k_idx = get_obj_num(base, mode);
/* Restricted objects */
if (get_obj_num_hook)
}
/* Apply magic (allow artifacts) */
- apply_magic(j_ptr, current_floor_ptr->object_level, mode);
+ apply_magic(j_ptr, p_ptr->current_floor_ptr->object_level, mode);
/* Hack -- generate multiple spikes/missiles */
switch (j_ptr->tval)
* @return 生成に成功したらTRUEを返す。
* @details
* This routine plays nasty games to generate the "special artifacts".\n
- * This routine uses "current_floor_ptr->object_level" for the "generation level".\n
+ * This routine uses "p_ptr->current_floor_ptr->object_level" for the "generation level".\n
* This routine requires a clean floor grid destination.\n
*/
void place_object(POSITION y, POSITION x, BIT_FLAGS mode)
OBJECT_IDX o_idx;
/* Acquire grid */
- grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
+ grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
object_type forge;
object_type *q_ptr;
/* Paranoia -- check bounds */
- if (!in_bounds(y, x)) return;
+ if (!in_bounds(p_ptr->current_floor_ptr, y, x)) return;
/* Require floor space */
- if (!cave_drop_bold(y, x)) return;
+ if (!cave_drop_bold(p_ptr->current_floor_ptr, y, x)) return;
/* Avoid stacking on other objects */
if (g_ptr->o_idx) return;
if (o_idx)
{
object_type *o_ptr;
- o_ptr = ¤t_floor_ptr->o_list[o_idx];
+ o_ptr = &p_ptr->current_floor_ptr->o_list[o_idx];
/* Structure Copy */
object_copy(o_ptr, q_ptr);
}
+OBJECT_SUBTYPE_VALUE coin_type; /* Hack -- force coin type */
+
/*!
* @brief 生成階に応じた財宝オブジェクトの生成を行う。
* Make a treasure object
s32b base;
/* Hack -- Pick a Treasure variety */
- i = ((randint1(current_floor_ptr->object_level + 2) + 2) / 2) - 1;
+ i = ((randint1(p_ptr->current_floor_ptr->object_level + 2) + 2) / 2) - 1;
/* Apply "extra" magic */
if (one_in_(GREAT_OBJ))
{
- i += randint1(current_floor_ptr->object_level + 1);
+ i += randint1(p_ptr->current_floor_ptr->object_level + 1);
}
/* Hack -- Creeping Coins only generate "themselves" */
OBJECT_IDX o_idx;
/* Acquire grid */
- grid_type *g_ptr = ¤t_floor_ptr->grid_array[y][x];
+ grid_type *g_ptr = &p_ptr->current_floor_ptr->grid_array[y][x];
object_type forge;
object_type *q_ptr;
/* Paranoia -- check bounds */
- if (!in_bounds(y, x)) return;
+ if (!in_bounds(p_ptr->current_floor_ptr, y, x)) return;
/* Require floor space */
- if (!cave_drop_bold(y, x)) return;
+ if (!cave_drop_bold(p_ptr->current_floor_ptr, y, x)) return;
/* Avoid stacking on other objects */
if (g_ptr->o_idx) return;
if (o_idx)
{
object_type *o_ptr;
- o_ptr = ¤t_floor_ptr->o_list[o_idx];
+ o_ptr = &p_ptr->current_floor_ptr->o_list[o_idx];
object_copy(o_ptr, q_ptr);
/* Save location */
* @brief 生成済のオブジェクトをフロアの所定の位置に落とす。
* Let an object fall to the ground at or near a location.
* @param j_ptr 落としたいオブジェクト構造体の参照ポインタ
- * @param chance ã\83\89ã\83ã\83\83ã\83\97ã\81®æ\88\90å\8a\9f率(%)
+ * @param chance ã\83\89ã\83ã\83\83ã\83\97ã\81®æ¶\88æ»\85率(%)
* @param y 配置したいフロアのY座標
* @param x 配置したいフロアのX座標
* @return 生成に成功したらオブジェクトのIDを返す。
* @details
- * The initial location is assumed to be "in_bounds()".\n
+ * The initial location is assumed to be "in_bounds(p_ptr->current_floor_ptr, )".\n
*\n
* This function takes a parameter "chance". This is the percentage\n
* chance that the item will "disappear" instead of drop. If the object\n
#else
msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
#endif
- if (p_ptr->wizard) msg_print(_("(破損)", "(breakage)"));
+ if (current_world_ptr->wizard) msg_print(_("(破損)", "(breakage)"));
/* Failure */
return (0);
ty = y + dy;
tx = x + dx;
- /* Skip illegal grids */
- if (!in_bounds(ty, tx)) continue;
+ if (!in_bounds(p_ptr->current_floor_ptr, ty, tx)) continue;
/* Require line of projection */
- if (!projectable(y, x, ty, tx)) continue;
+ if (!projectable(p_ptr->current_floor_ptr, y, x, ty, tx)) continue;
/* Obtain grid */
- g_ptr = ¤t_floor_ptr->grid_array[ty][tx];
+ g_ptr = &p_ptr->current_floor_ptr->grid_array[ty][tx];
/* Require floor space */
- if (!cave_drop_bold(ty, tx)) continue;
+ if (!cave_drop_bold(p_ptr->current_floor_ptr, ty, tx)) continue;
/* No objects */
k = 0;
for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
{
object_type *o_ptr;
- o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
+ o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx];
next_o_idx = o_ptr->next_o_idx;
/* Check for possible combination */
msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
#endif
- if (p_ptr->wizard) msg_print(_("(床スペースがない)", "(no floor space)"));
+ if (current_world_ptr->wizard) msg_print(_("(床スペースがない)", "(no floor space)"));
/* Failure */
return (0);
ty = rand_spread(by, 1);
tx = rand_spread(bx, 1);
- if (!in_bounds(ty, tx)) continue;
+ if (!in_bounds(p_ptr->current_floor_ptr, ty, tx)) continue;
/* Bounce to that location */
by = ty;
bx = tx;
/* Require floor space */
- if (!cave_drop_bold(by, bx)) continue;
+ if (!cave_drop_bold(p_ptr->current_floor_ptr, by, bx)) continue;
flag = TRUE;
}
{
int candidates = 0, pick;
- for (ty = 1; ty < current_floor_ptr->height - 1; ty++)
+ for (ty = 1; ty < p_ptr->current_floor_ptr->height - 1; ty++)
{
- for (tx = 1; tx < current_floor_ptr->width - 1; tx++)
+ for (tx = 1; tx < p_ptr->current_floor_ptr->width - 1; tx++)
{
/* A valid space found */
- if (cave_drop_bold(ty, tx)) candidates++;
+ if (cave_drop_bold(p_ptr->current_floor_ptr, ty, tx)) candidates++;
}
}
msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
#endif
- if (p_ptr->wizard) msg_print(_("(床スペースがない)", "(no floor space)"));
+ if (current_world_ptr->wizard) msg_print(_("(床スペースがない)", "(no floor space)"));
/* Mega-Hack -- preserve artifacts */
if (preserve_mode)
/* Choose a random one */
pick = randint1(candidates);
- for (ty = 1; ty < current_floor_ptr->height - 1; ty++)
+ for (ty = 1; ty < p_ptr->current_floor_ptr->height - 1; ty++)
{
- for (tx = 1; tx < current_floor_ptr->width - 1; tx++)
+ for (tx = 1; tx < p_ptr->current_floor_ptr->width - 1; tx++)
{
- if (cave_drop_bold(ty, tx))
+ if (cave_drop_bold(p_ptr->current_floor_ptr, ty, tx))
{
pick--;
}
- g_ptr = ¤t_floor_ptr->grid_array[by][bx];
+ g_ptr = &p_ptr->current_floor_ptr->grid_array[by][bx];
/* Scan objects in that grid for combination */
for (this_o_idx = g_ptr->o_idx; this_o_idx; this_o_idx = next_o_idx)
{
object_type *o_ptr;
- o_ptr = ¤t_floor_ptr->o_list[this_o_idx];
+ o_ptr = &p_ptr->current_floor_ptr->o_list[this_o_idx];
next_o_idx = o_ptr->next_o_idx;
/* Check for combination */
msg_format("The %s disappear%s.", o_name, (plural ? "" : "s"));
#endif
- if (p_ptr->wizard) msg_print(_("(アイテムが多過ぎる)", "(too many objects)"));
+ if (current_world_ptr->wizard) msg_print(_("(アイテムが多過ぎる)", "(too many objects)"));
/* Hack -- Preserve artifacts */
if (object_is_fixed_artifact(j_ptr))
if (!done)
{
/* Structure copy */
- object_copy(¤t_floor_ptr->o_list[o_idx], j_ptr);
+ object_copy(&p_ptr->current_floor_ptr->o_list[o_idx], j_ptr);
/* Access new object */
- j_ptr = ¤t_floor_ptr->o_list[o_idx];
+ j_ptr = &p_ptr->current_floor_ptr->o_list[o_idx];
/* Locate */
j_ptr->iy = by;
/* Mega-Hack -- no message if "dropped" by player */
/* Message when an object falls under the player */
- if (chance && player_bold(by, bx))
+ if (chance && player_bold(p_ptr, by, bx))
{
msg_print(_("何かが足下に転がってきた。", "You feel something roll beneath your feet."));
}
/*!
* @brief 魔道具の使用回数の残量を示すメッセージを表示する /
- * Describe the charges on an item in the p_ptr->inventory_list.
+ * Describe the charges on an item in the inventory.
* @param item 残量を表示したいプレイヤーのアイテム所持スロット
* @return なし
*/
/*!
* @brief アイテムの残り所持数メッセージを表示する /
- * Describe an item in the p_ptr->inventory_list.
+ * Describe an item in the inventory.
* @param item 残量を表示したいプレイヤーのアイテム所持スロット
* @return なし
*/
}
+void vary_item(INVENTORY_IDX item, ITEM_NUMBER num)
+{
+ if (item >= 0)
+ {
+ inven_item_increase(item, num);
+ inven_item_describe(item);
+ inven_item_optimize(item);
+ }
+ else
+ {
+ floor_item_increase(0 - item, num);
+ floor_item_describe(0 - item);
+ floor_item_optimize(0 - item);
+ }
+}
+
/*!
* @brief アイテムを増減させ残り所持数メッセージを表示する /
- * Increase the "number" of an item in the p_ptr->inventory_list
+ * Increase the "number" of an item in the inventory
* @param item 所持数を増やしたいプレイヤーのアイテム所持スロット
* @param num 増やしたい量
* @return なし
{
if ((item == INVEN_RARM) || (item == INVEN_LARM))
{
- if (!has_melee_weapon(INVEN_RARM + INVEN_LARM - item))
+ if (!has_melee_weapon(p_ptr, INVEN_RARM + INVEN_LARM - item))
{
/* Clear all temporary elemental brands */
- set_ele_attack(0, 0);
+ set_ele_attack(p_ptr, 0, 0);
}
}
}
/*!
* @brief 所持アイテムスロットから所持数のなくなったアイテムを消去する /
- * Erase an p_ptr->inventory_list slot if it has no more items
+ * Erase an inventory slot if it has no more items
* @param item 消去したいプレイヤーのアイテム所持スロット
* @return なし
*/
int i;
/* One less item */
- inven_cnt--;
+ p_ptr->inven_cnt--;
/* Slide everything down */
for (i = item; i < INVEN_PACK; i++)
else
{
/* One less item */
- equip_cnt--;
+ p_ptr->equip_cnt--;
/* Erase the empty slot */
object_wipe(&p_ptr->inventory_list[item]);
*/
void floor_item_charges(INVENTORY_IDX item)
{
- object_type *o_ptr = ¤t_floor_ptr->o_list[item];
+ object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[item];
/* Require staff/wand */
if ((o_ptr->tval != TV_STAFF) && (o_ptr->tval != TV_WAND)) return;
*/
void floor_item_describe(INVENTORY_IDX item)
{
- object_type *o_ptr = ¤t_floor_ptr->o_list[item];
+ object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[item];
GAME_TEXT o_name[MAX_NLEN];
object_desc(o_name, o_ptr, 0);
*/
void floor_item_increase(INVENTORY_IDX item, ITEM_NUMBER num)
{
- object_type *o_ptr = ¤t_floor_ptr->o_list[item];
+ object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[item];
/* Apply */
num += o_ptr->number;
*/
void floor_item_optimize(INVENTORY_IDX item)
{
- object_type *o_ptr = ¤t_floor_ptr->o_list[item];
+ object_type *o_ptr = &p_ptr->current_floor_ptr->o_list[item];
/* Paranoia -- be sure it exists */
if (!o_ptr->k_idx) return;
int j;
/* Empty slot? */
- if (inven_cnt < INVEN_PACK) return (TRUE);
+ if (p_ptr->inven_cnt < INVEN_PACK) return (TRUE);
/* Similar slot? */
for (j = 0; j < INVEN_PACK; j++)
/*!
* @brief オブジェクトをプレイヤーが拾って所持スロットに納めるメインルーチン /
- * Add an item to the players p_ptr->inventory_list, and return the slot used.
+ * Add an item to the players inventory, and return the slot used.
* @param o_ptr 拾うオブジェクトの構造体参照ポインタ
* @return 収められた所持スロットのID、拾うことができなかった場合-1を返す。
* @details
- * If the new item can combine with an existing item in the p_ptr->inventory_list,\n
+ * If the new item can combine with an existing item in the inventory,\n
* it will do so, using "object_similar()" and "object_absorb()", else,\n
- * the item will be placed into the "proper" location in the p_ptr->inventory_list.\n
+ * the item will be placed into the "proper" location in the inventory.\n
*\n
* This function can be used to "over-fill" the player's pack, but only\n
* once, and such an action must trigger the "overflow" code immediately.\n
* combined. This may be tricky. See "dungeon.c" for info.\n
*\n
* Note that this code must remove any location/stack information\n
- * from the object once it is placed into the p_ptr->inventory_list.\n
+ * from the object once it is placed into the inventory.\n
*/
s16b inven_carry(object_type *o_ptr)
{
}
}
- if (inven_cnt > INVEN_PACK) return (-1);
+ if (p_ptr->inven_cnt > INVEN_PACK) return (-1);
/* Find an empty slot */
for (j = 0; j <= INVEN_PACK; j++)
p_ptr->total_weight += (j_ptr->number * j_ptr->weight);
/* Count the items */
- inven_cnt++;
+ p_ptr->inven_cnt++;
p_ptr->update |= (PU_BONUS | PU_COMBINE | PU_REORDER);
p_ptr->window |= (PW_INVEN);
* Note that only one item at a time can be wielded per slot.\n
* Note that taking off an item when "full" may cause that item\n
* to fall to the ground.\n
- * Return the p_ptr->inventory_list slot into which the item is placed.\n
+ * Return the inventory slot into which the item is placed.\n
*/
INVENTORY_IDX inven_takeoff(INVENTORY_IDX item, ITEM_NUMBER amt)
{
/* Verify */
if (amt > o_ptr->number) amt = o_ptr->number;
q_ptr = &forge;
-
- /* Obtain a local object */
object_copy(q_ptr, o_ptr);
/* Modify quantity */
/*!
* @brief 所持スロットから床下にオブジェクトを落とすメインルーチン /
- * Drop (some of) a non-cursed p_ptr->inventory_list/equipment item
+ * Drop (some of) a non-cursed inventory/equipment item
* @param item 所持テーブルのID
* @param amt 落としたい個数
* @return なし
/* Drop it near the player */
(void)drop_near(q_ptr, 0, p_ptr->y, p_ptr->x);
- /* Modify, Describe, Optimize */
- inven_item_increase(item, -amt);
- inven_item_describe(item);
- inven_item_optimize(item);
+ vary_item(item, -amt);
}
* @details
* Note special handling of the "overflow" slot
*/
-void combine_pack(void)
+void combine_pack(player_type *owner_ptr)
{
int i, j, k;
object_type *o_ptr;
/* Combine the pack (backwards) */
for (i = INVEN_PACK; i > 0; i--)
{
- o_ptr = &p_ptr->inventory_list[i];
+ o_ptr = &owner_ptr->inventory_list[i];
/* Skip empty items */
if (!o_ptr->k_idx) continue;
{
int max_num;
- j_ptr = &p_ptr->inventory_list[j];
+ j_ptr = &owner_ptr->inventory_list[j];
/* Skip empty items */
if (!j_ptr->k_idx) continue;
object_absorb(j_ptr, o_ptr);
/* One object is gone */
- inven_cnt--;
+ owner_ptr->inven_cnt--;
/* Slide everything down */
for (k = i; k < INVEN_PACK; k++)
{
/* Structure copy */
- p_ptr->inventory_list[k] = p_ptr->inventory_list[k+1];
+ owner_ptr->inventory_list[k] = owner_ptr->inventory_list[k+1];
}
/* Erase the "final" slot */
- object_wipe(&p_ptr->inventory_list[k]);
+ object_wipe(&owner_ptr->inventory_list[k]);
}
else
{
}
}
- p_ptr->window |= (PW_INVEN);
+ owner_ptr->window |= (PW_INVEN);
/* Take note */
combined = TRUE;
for (i = 0; i < INVEN_PACK; i++)
{
/* Mega-Hack -- allow "proper" over-flow */
- if ((i == INVEN_PACK) && (inven_cnt == INVEN_PACK)) break;
+ if ((i == INVEN_PACK) && (p_ptr->inven_cnt == INVEN_PACK)) break;
o_ptr = &p_ptr->inventory_list[i];
}
/* Print spells */
- print_spells(0, spells, num, 2, 0, use_realm);
+ print_spells(p_ptr, 0, spells, num, 2, 0, use_realm);
}
}