From a0065e7a7d5c55f0cf93c758f26afa9a86b16572 Mon Sep 17 00:00:00 2001 From: pauldubois Date: Fri, 11 Apr 2008 10:55:40 +0000 Subject: + allocate and initialize + _fire_prompt_for_item returns -1, not ENDOFPACK + remove _fire_get_noitem_reason() + remove get_current_fire_item() + fix get_next_fire_item + remove _get_fire_order() + remove _fire_item_matches() + verify: no use of ENDOFPACK, use -1 + on_item_fired - implement: tags stuff + bug: wielding sling with stones = empty quiver - bug: wield sling, no quiver, pick up stones: should quiver + bug: wield sling, pick up stones: update # stones + bug: wield sling, stones quivered, drop stones: should update - feature: explicitly dropping all of ammo stack should remove it from quiver - move get_next_fire_item into quiver.cc? - remove: fire_quiver_best - remove: you.quiver - rename: you.quiver_change -> you.redraw_quiver - test no item because of fire_order_begin, =f, etc - find better place for on_weapon_changed - polish Qv: display, the command change - PROBLEM: cast_portal_projectile uses empty quiver slot? (test this) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4191 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/player.cc | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'crawl-ref/source/player.cc') diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index b6582ebfb1..c4e9cf1ce7 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -55,6 +55,7 @@ #include "ouch.h" #include "output.h" #include "place.h" +#include "quiver.h" #include "randart.h" #include "religion.h" #include "skills.h" @@ -5287,30 +5288,41 @@ bool actor::can_pass_through(const coord_def &c) const // player player::player() + : m_quiver(0) { init(); - kills = new KillMaster(); + kills = new KillMaster(); // why isn't this done in init()? } player::player(const player &other) + : m_quiver(0) { init(); + + // why doesn't this do a copy_from? + player_quiver* saved_quiver = m_quiver; *this = other; + m_quiver = saved_quiver; kills = new KillMaster(*(other.kills)); + *m_quiver = *(other.m_quiver); } +// why is this not called "operator="? void player::copy_from(const player &other) { if (this == &other) return; - KillMaster *_kills = kills; + KillMaster *saved_kills = kills; + player_quiver* saved_quiver = m_quiver; *this = other; - kills = _kills; + kills = saved_kills; *kills = *(other.kills); + m_quiver = saved_quiver; + *m_quiver = *(other.m_quiver); } @@ -5478,6 +5490,9 @@ void player::init() non_branch_info[i].branch = -1; non_branch_info[i].assert_validity(); } + + if (m_quiver) delete m_quiver; + m_quiver = new player_quiver; } player_save_info player_save_info::operator=(const player& rhs) -- cgit v1.2.3-54-g00ecf