<ClCompile Include="..\..\src\cmd-visual\cmd-map.c" />\r
<ClCompile Include="..\..\src\core\asking-player.c" />\r
<ClCompile Include="..\..\src\core\disturbance.c" />\r
+ <ClCompile Include="..\..\src\core\object-compressor.c" />\r
<ClCompile Include="..\..\src\core\status-reseter.c" />\r
<ClCompile Include="..\..\src\core\visuals-reseter.c" />\r
<ClCompile Include="..\..\src\core\window-redrawer.c" />\r
<ClInclude Include="..\..\src\cmd-visual\cmd-map.h" />\r
<ClInclude Include="..\..\src\core\asking-player.h" />\r
<ClInclude Include="..\..\src\core\disturbance.h" />\r
+ <ClInclude Include="..\..\src\core\object-compressor.h" />\r
<ClInclude Include="..\..\src\core\player-redraw-types.h" />\r
<ClInclude Include="..\..\src\core\status-reseter.h" />\r
<ClInclude Include="..\..\src\core\visuals-reseter.h" />\r
<ClCompile Include="..\..\src\grid\stair.c">
<Filter>grid</Filter>
</ClCompile>
+ <ClCompile Include="..\..\src\core\object-compressor.c">
+ <Filter>core</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\src\combat\shoot.h">
<ClInclude Include="..\..\src\grid\stair.h">
<Filter>grid</Filter>
</ClInclude>
+ <ClInclude Include="..\..\src\core\object-compressor.h">
+ <Filter>core</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\src\wall.bmp" />
core/hp-mp-processor.c core/hp-mp-processor.h \
core/hp-mp-regenerator.c core/hp-mp-regenerator.h \
core/magic-effects-timeout-reducer.c core/magic-effects-timeout-reducer.h \
+ core/object-compressor.c core/object-compressor.h \
core/output-updater.c core/output-updater.h \
core/player-processor.c core/player-processor.h \
core/player-redraw-types.h \
--- /dev/null
+#include "core/object-compressor.h"
+#include "core/player-redraw-types.h"
+#include "core/window-redrawer.h"
+#include "floor/floor-object.h"
+#include "grid/grid.h"
+#include "object-hook/hook-checker.h"
+#include "object-hook/hook-enchant.h"
+#include "object/object-generator.h"
+#include "object/object-kind.h"
+#include "system/floor-type-definition.h"
+#include "system/monster-type-definition.h"
+#include "system/object-type-definition.h"
+#include "view/display-messages.h"
+
+/*!
+ * @brief \83O\83\8d\81[\83o\83\8b\83I\83u\83W\83F\83N\83g\94z\97ñ\82É\91Î\82µ\8ew\92è\94Í\88Í\82Ì\83I\83u\83W\83F\83N\83g\82ð\90®\97\9d\82µ\82ÄID\82Ì\8eá\82¢\8f\87\82É\8añ\82¹\82é /
+ * Move an object from index i1 to index i2 in the object list
+ * @param i1 \90®\97\9d\82µ\82½\82¢\94z\97ñ\82Ì\8en\93_
+ * @param i2 \90®\97\9d\82µ\82½\82¢\94z\97ñ\82Ì\8fI\93_
+ * @return \82È\82µ
+ */
+static void compact_objects_aux(floor_type *floor_ptr, OBJECT_IDX i1, OBJECT_IDX i2)
+{
+ if (i1 == i2)
+ return;
+
+ object_type *o_ptr;
+ for (OBJECT_IDX i = 1; i < floor_ptr->o_max; i++) {
+ o_ptr = &floor_ptr->o_list[i];
+ if (!o_ptr->k_idx)
+ continue;
+
+ if (o_ptr->next_o_idx == i1)
+ o_ptr->next_o_idx = i2;
+ }
+
+ o_ptr = &floor_ptr->o_list[i1];
+
+ if (object_is_held_monster(o_ptr)) {
+ monster_type *m_ptr;
+ m_ptr = &floor_ptr->m_list[o_ptr->held_m_idx];
+ if (m_ptr->hold_o_idx == i1)
+ m_ptr->hold_o_idx = i2;
+ } else {
+ POSITION y = o_ptr->iy;
+ POSITION x = o_ptr->ix;
+ grid_type *g_ptr;
+ g_ptr = &floor_ptr->grid_array[y][x];
+ if (g_ptr->o_idx == i1)
+ g_ptr->o_idx = i2;
+ }
+
+ floor_ptr->o_list[i2] = floor_ptr->o_list[i1];
+ object_wipe(o_ptr);
+}
+
+/*!
+ * @brief \83O\83\8d\81[\83o\83\8b\83I\83u\83W\83F\83N\83g\94z\97ñ\82©\82ç\97D\90æ\93x\82Ì\92á\82¢\82à\82Ì\82ð\8dí\8f\9c\82µ\81A\83f\81[\83^\82ð\88³\8fk\82·\82é\81B /
+ * Compact and Reorder the object list.
+ * @param player_ptr \83v\83\8c\81[\83\84\81[\82Ö\82Ì\8eQ\8fÆ\83|\83C\83\93\83^
+ * @param size \8dÅ\92á\82Å\82à\8c¸\82ç\82µ\82½\82¢\83I\83u\83W\83F\83N\83g\90\94\82Ì\90\85\8f\80
+ * @return \82È\82µ
+ * @details
+ * \81i\8aë\8c¯\82È\82Ì\82Å\8eg\97p\82É\82Í\92\8d\88Ó\82·\82é\82±\82Æ\81j
+ * This function can be very dangerous, use with caution!\n
+ *\n
+ * When actually "compacting" objects, we base the saving throw on a\n
+ * combination of object level, distance from player, and current\n
+ * "desperation".\n
+ *\n
+ * After "compacting" (if needed), we "reorder" the objects into a more\n
+ * compact order, and we reset the allocation info, and the "live" array.\n
+ */
+void compact_objects(player_type *player_ptr, int size)
+{
+ object_type *o_ptr;
+ if (size) {
+ msg_print(_("\83A\83C\83e\83\80\8fî\95ñ\82ð\88³\8fk\82µ\82Ä\82¢\82Ü\82·...", "Compacting objects..."));
+ player_ptr->redraw |= PR_MAP;
+ player_ptr->window |= PW_OVERHEAD | PW_DUNGEON;
+ }
+
+ floor_type *floor_ptr = player_ptr->current_floor_ptr;
+ for (int num = 0, cnt = 1; num < size; cnt++) {
+ int cur_lev = 5 * cnt;
+ int cur_dis = 5 * (20 - cnt);
+ for (OBJECT_IDX i = 1; i < floor_ptr->o_max; i++) {
+ o_ptr = &floor_ptr->o_list[i];
+
+ if (!object_is_valid(o_ptr) || (k_info[o_ptr->k_idx].level > cur_lev))
+ continue;
+
+ POSITION y, x;
+ if (object_is_held_monster(o_ptr)) {
+ monster_type *m_ptr;
+ m_ptr = &floor_ptr->m_list[o_ptr->held_m_idx];
+ y = m_ptr->fy;
+ x = m_ptr->fx;
+
+ if (randint0(100) < 90)
+ continue;
+ } else {
+ y = o_ptr->iy;
+ x = o_ptr->ix;
+ }
+
+ if ((cur_dis > 0) && (distance(player_ptr->y, player_ptr->x, y, x) < cur_dis))
+ continue;
+
+ int chance = 90;
+ if ((object_is_fixed_artifact(o_ptr) || o_ptr->art_name) && (cnt < 1000))
+ chance = 100;
+
+ if (randint0(100) < chance)
+ continue;
+
+ delete_object_idx(player_ptr, i);
+ num++;
+ }
+ }
+
+ for (OBJECT_IDX i = floor_ptr->o_max - 1; i >= 1; i--) {
+ o_ptr = &floor_ptr->o_list[i];
+ if (o_ptr->k_idx)
+ continue;
+
+ compact_objects_aux(floor_ptr, floor_ptr->o_max - 1, i);
+ floor_ptr->o_max--;
+ }
+}
--- /dev/null
+#pragma once
+
+#include "system/angband.h"
+
+void compact_objects(player_type *owner_ptr, int size);
#include "cmd-io/cmd-dump.h"
#include "core/disturbance.h"
#include "core/hp-mp-regenerator.h"
+#include "core/object-compressor.h"
#include "core/player-processor.h"
#include "core/player-redraw-types.h"
#include "core/player-update-types.h"
#include "floor/floor-leaver.h"
#include "floor/floor-save-util.h"
#include "floor/floor-save.h"
-#include "floor/floor.h"
#include "game-option/map-screen-options.h"
#include "game-option/play-record-options.h"
#include "io/cursor.h"
place_bold(player_ptr, y, x, GB_FLOOR);
}
-/*!
- * @brief グローバルオブジェクト配列に対し指定範囲のオブジェクトを整理してIDの若い順に寄せる /
- * Move an object from index i1 to index i2 in the object list
- * @param i1 整理したい配列の始点
- * @param i2 整理したい配列の終点
- * @return なし
- */
-static void compact_objects_aux(floor_type *floor_ptr, OBJECT_IDX i1, OBJECT_IDX i2)
-{
- if (i1 == i2)
- return;
-
- object_type *o_ptr;
- for (OBJECT_IDX i = 1; i < floor_ptr->o_max; i++) {
- o_ptr = &floor_ptr->o_list[i];
- if (!o_ptr->k_idx)
- continue;
-
- if (o_ptr->next_o_idx == i1)
- o_ptr->next_o_idx = i2;
- }
-
- o_ptr = &floor_ptr->o_list[i1];
-
- if (object_is_held_monster(o_ptr)) {
- monster_type *m_ptr;
- m_ptr = &floor_ptr->m_list[o_ptr->held_m_idx];
- if (m_ptr->hold_o_idx == i1)
- m_ptr->hold_o_idx = i2;
- } else {
- POSITION y = o_ptr->iy;
- POSITION x = o_ptr->ix;
- grid_type *g_ptr;
- g_ptr = &floor_ptr->grid_array[y][x];
- if (g_ptr->o_idx == i1)
- g_ptr->o_idx = i2;
- }
-
- floor_ptr->o_list[i2] = floor_ptr->o_list[i1];
- object_wipe(o_ptr);
-}
-
-/*!
- * @brief グローバルオブジェクト配列から優先度の低いものを削除し、データを圧縮する。 /
- * Compact and Reorder the object list.
- * @param player_ptr プレーヤーへの参照ポインタ
- * @param size 最低でも減らしたいオブジェクト数の水準
- * @return なし
- * @details
- * (危険なので使用には注意すること)
- * This function can be very dangerous, use with caution!\n
- *\n
- * When actually "compacting" objects, we base the saving throw on a\n
- * combination of object level, distance from player, and current\n
- * "desperation".\n
- *\n
- * After "compacting" (if needed), we "reorder" the objects into a more\n
- * compact order, and we reset the allocation info, and the "live" array.\n
- */
-void compact_objects(player_type *player_ptr, int size)
-{
- object_type *o_ptr;
- if (size) {
- msg_print(_("アイテム情報を圧縮しています...", "Compacting objects..."));
- player_ptr->redraw |= PR_MAP;
- player_ptr->window |= PW_OVERHEAD | PW_DUNGEON;
- }
-
- floor_type *floor_ptr = player_ptr->current_floor_ptr;
- for (int num = 0, cnt = 1; num < size; cnt++) {
- int cur_lev = 5 * cnt;
- int cur_dis = 5 * (20 - cnt);
- for (OBJECT_IDX i = 1; i < floor_ptr->o_max; i++) {
- o_ptr = &floor_ptr->o_list[i];
-
- if (!object_is_valid(o_ptr) || (k_info[o_ptr->k_idx].level > cur_lev))
- continue;
-
- POSITION y, x;
- if (object_is_held_monster(o_ptr)) {
- monster_type *m_ptr;
- m_ptr = &floor_ptr->m_list[o_ptr->held_m_idx];
- y = m_ptr->fy;
- x = m_ptr->fx;
-
- if (randint0(100) < 90)
- continue;
- } else {
- y = o_ptr->iy;
- x = o_ptr->ix;
- }
-
- if ((cur_dis > 0) && (distance(player_ptr->y, player_ptr->x, y, x) < cur_dis))
- continue;
-
- int chance = 90;
- if ((object_is_fixed_artifact(o_ptr) || o_ptr->art_name) && (cnt < 1000))
- chance = 100;
-
- if (randint0(100) < chance)
- continue;
-
- delete_object_idx(player_ptr, i);
- num++;
- }
- }
-
- for (OBJECT_IDX i = floor_ptr->o_max - 1; i >= 1; i--) {
- o_ptr = &floor_ptr->o_list[i];
- if (o_ptr->k_idx)
- continue;
-
- compact_objects_aux(floor_ptr, floor_ptr->o_max - 1, i);
- floor_ptr->o_max--;
- }
-}
-
/*
* Standard "find me a location" function
*
void forget_flow(floor_type *floor_ptr);
void wipe_o_list(floor_type *floor_ptr);
void set_floor(player_type *player_ptr, POSITION x, POSITION y);
-void compact_objects(player_type *owner_ptr, int size);
void scatter(player_type *player_ptr, POSITION *yp, POSITION *xp, POSITION y, POSITION x, POSITION d, BIT_FLAGS mode);
#include "save/floor-writer.h"
+#include "core/object-compressor.h"
#include "core/player-update-types.h"
#include "floor/floor-events.h"
#include "floor/floor-save-util.h"
#include "floor/floor-save.h"
-#include "floor/floor.h"
#include "grid/grid.h"
#include "io/files-util.h"
#include "io/uid-checker.h"
*/
#include "save/save.h"
+#include "core/object-compressor.h"
#include "dungeon/quest.h"
#include "floor/floor-town.h"
-#include "floor/floor.h"
#include "floor/wild.h"
#include "game-option/text-display-options.h"
#include "inventory/inventory-slot-types.h"