diff options
author | Bardur Arantsson <bardur@scientician.net> | 2015-04-14 06:39:21 +0200 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2015-04-14 06:39:21 +0200 |
commit | e8345c7da1e3b62dec011798a03d25c2f23f9d60 (patch) | |
tree | 2ebac391fc6dc86fd64b6ae4f17ce19adf79f978 | |
parent | 0a66e1537dc7bb5500d7bf2203144ea44b167f45 (diff) |
Add a few "const" qualifiers to object-related functions
-rw-r--r-- | src/object1.cc | 10 | ||||
-rw-r--r-- | src/object1.hpp | 8 | ||||
-rw-r--r-- | src/object2.cc | 12 | ||||
-rw-r--r-- | src/object2.hpp | 10 | ||||
-rw-r--r-- | src/store.cc | 2 |
5 files changed, 21 insertions, 21 deletions
diff --git a/src/object1.cc b/src/object1.cc index 3c269c60..cb1a6604 100644 --- a/src/object1.cc +++ b/src/object1.cc @@ -757,7 +757,7 @@ void reset_visuals(void) /* * Extract "xtra" flags from object. */ -void object_flags_xtra(object_type *o_ptr, u32b *f2, u32b *f3, u32b *esp) +static void object_flags_xtra(object_type const *o_ptr, u32b *f2, u32b *f3, u32b *esp) { switch (o_ptr->xtra1) { @@ -874,7 +874,7 @@ void object_flags_xtra(object_type *o_ptr, u32b *f2, u32b *f3, u32b *esp) * Obtain the "flags" for an item */ bool_ object_flags_no_set = FALSE; -void object_flags(object_type *o_ptr, u32b *f1, u32b *f2, u32b *f3, u32b *f4, u32b *f5, u32b *esp) +void object_flags(object_type const *o_ptr, u32b *f1, u32b *f2, u32b *f3, u32b *f4, u32b *f5, u32b *esp) { object_kind *k_ptr = &k_info[o_ptr->k_idx]; @@ -960,7 +960,7 @@ int object_power(object_type *o_ptr) /* * Obtain the "flags" for an item which are known to the player */ -void object_flags_known(object_type *o_ptr, u32b *f1, u32b *f2, u32b *f3, u32b *f4, u32b *f5, u32b *esp) +void object_flags_known(object_type const *o_ptr, u32b *f1, u32b *f2, u32b *f3, u32b *f4, u32b *f5, u32b *esp) { object_kind *k_ptr = &k_info[o_ptr->k_idx]; @@ -3930,7 +3930,7 @@ static int get_slot(int slot) * Determine which equipment slot (if any) an item likes, ignoring the player's * current body and stuff if ideal == TRUE */ -s16b wield_slot_ideal(object_type *o_ptr, bool_ ideal) +s16b wield_slot_ideal(object_type const *o_ptr, bool_ ideal) { /* Theme has restrictions for winged races. */ if (game_module_idx == MODULE_THEME) @@ -4116,7 +4116,7 @@ s16b wield_slot_ideal(object_type *o_ptr, bool_ ideal) * Determine which equipment slot (if any) an item likes for the player's * current body and stuff */ -s16b wield_slot(object_type *o_ptr) +s16b wield_slot(object_type const *o_ptr) { return wield_slot_ideal(o_ptr, FALSE); } diff --git a/src/object1.hpp b/src/object1.hpp index c605539b..01fc41d0 100644 --- a/src/object1.hpp +++ b/src/object1.hpp @@ -12,14 +12,14 @@ extern void flavor_init(void); extern void reset_visuals(void); extern int object_power(object_type *o_ptr); extern bool_ object_flags_no_set; -extern void object_flags(object_type *o_ptr, u32b *f1, u32b *f2, u32b *f3, u32b *f4, u32b *f5, u32b *esp); -extern void object_flags_known(object_type *o_ptr, u32b *f1, u32b *f2, u32b *f3, u32b *f4, u32b *f5, u32b *esp); +extern void object_flags(object_type const *o_ptr, u32b *f1, u32b *f2, u32b *f3, u32b *f4, u32b *f5, u32b *esp); +extern void object_flags_known(object_type const *o_ptr, u32b *f1, u32b *f2, u32b *f3, u32b *f4, u32b *f5, u32b *esp); extern void object_desc(char *buf, object_type *o_ptr, int pref, int mode); extern void object_desc_store(char *buf, object_type *o_ptr, int pref, int mode); extern bool_ object_out_desc(object_type *o_ptr, FILE *fff, bool_ trim_down, bool_ wait_for_it); extern char index_to_label(int i); -extern s16b wield_slot_ideal(object_type *o_ptr, bool_ ideal); -extern s16b wield_slot(object_type *o_ptr); +extern s16b wield_slot_ideal(object_type const *o_ptr, bool_ ideal); +extern s16b wield_slot(object_type const *o_ptr); extern cptr describe_use(int i); extern bool_ item_tester_okay(object_type *o_ptr); extern void display_inven(void); diff --git a/src/object2.cc b/src/object2.cc index 7093b94e..b8edb7ce 100644 --- a/src/object2.cc +++ b/src/object2.cc @@ -878,7 +878,7 @@ bool object_tried_p(object_type const *o_ptr) * Return the "value" of an "unknown" item * Make a guess at the value of non-aware items */ -static s32b object_value_base(object_type *o_ptr) +static s32b object_value_base(object_type const *o_ptr) { object_kind *k_ptr = &k_info[o_ptr->k_idx]; @@ -942,7 +942,7 @@ static s32b object_value_base(object_type *o_ptr) } /* Return the value of the flags the object has... */ -s32b flag_cost(object_type * o_ptr, int plusses) +s32b flag_cost(object_type const * o_ptr, int plusses) { s32b total = 0; u32b f1, f2, f3, f4, f5, esp; @@ -1178,7 +1178,7 @@ s32b flag_cost(object_type * o_ptr, int plusses) * * Every wearable item with a "pval" bonus is worth extra (see below). */ -s32b object_value_real(object_type *o_ptr) +s32b object_value_real(object_type const *o_ptr) { s32b value; @@ -1492,7 +1492,7 @@ s32b object_value_real(object_type *o_ptr) * Note that discounted items stay discounted forever, even if * the discount is "forgotten" by the player via memory loss. */ -s32b object_value(object_type *o_ptr) +s32b object_value(object_type const *o_ptr) { s32b value; @@ -1548,7 +1548,7 @@ s32b object_value(object_type *o_ptr) * * Chests, and activatable items, never stack (for various reasons). */ -bool_ object_similar(object_type *o_ptr, object_type *j_ptr) +bool_ object_similar(object_type const *o_ptr, object_type const *j_ptr) { int total = o_ptr->number + j_ptr->number; u32b f1, f2, f3, f4, f5, esp, f11, f12, f13, f14, esp1, f15; @@ -5805,7 +5805,7 @@ void inc_stack_size_ex(int item, int delta, optimize_flag opt, describe_flag des /* * Check if we have space for an item in the pack without overflow */ -bool_ inven_carry_okay(object_type *o_ptr) +bool_ inven_carry_okay(object_type const *o_ptr) { int j; diff --git a/src/object2.hpp b/src/object2.hpp index 52165a7e..6cb11040 100644 --- a/src/object2.hpp +++ b/src/object2.hpp @@ -22,7 +22,7 @@ extern void floor_item_charges(int item); extern void floor_item_describe(int item); extern void floor_item_increase(int item, int num); extern void floor_item_optimize(int item); -extern bool_ inven_carry_okay(object_type *o_ptr); +extern bool_ inven_carry_okay(object_type const *o_ptr); extern s16b inven_carry(object_type *o_ptr, bool_ final); extern s16b inven_takeoff(int item, int amt, bool_ force_drop); extern void inven_drop(int item, int amt, int dy, int dx, bool_ silent); @@ -40,9 +40,9 @@ extern void object_aware(object_type *o_ptr); extern bool object_aware_p(object_type const *o_ptr); extern void object_tried(object_type *o_ptr); extern bool object_tried_p(object_type const *o_ptr); -extern s32b object_value(object_type *o_ptr); -extern s32b object_value_real(object_type *o_ptr); -extern bool_ object_similar(object_type *o_ptr, object_type *j_ptr); +extern s32b object_value(object_type const *o_ptr); +extern s32b object_value_real(object_type const *o_ptr); +extern bool_ object_similar(object_type const *o_ptr, object_type const *j_ptr); extern void object_absorb(object_type *o_ptr, object_type *j_ptr); extern s16b lookup_kind(int tval, int sval); extern void object_wipe(object_type *o_ptr); @@ -64,4 +64,4 @@ extern s16b floor_carry(int y, int x, object_type *j_ptr); extern void pack_decay(int item); extern void floor_decay(int item); extern s16b m_bonus(int max, int level); -extern s32b flag_cost(object_type * o_ptr, int plusses); +extern s32b flag_cost(object_type const *o_ptr, int plusses); diff --git a/src/store.cc b/src/store.cc index 195598f1..c550154d 100644 --- a/src/store.cc +++ b/src/store.cc @@ -612,7 +612,7 @@ static bool_ store_check_num(object_type *o_ptr) } -static bool_ is_blessed(object_type *o_ptr) +static bool_ is_blessed(object_type const *o_ptr) { u32b f1, f2, f3, f4, f5, esp; object_flags_known(o_ptr, &f1, &f2, &f3, &f4, &f5, &esp); |