hoa_shop::ShopMode Class Reference

Handles the game execution while the player is shopping. More...

#include <shop.h>

Inheritance diagram for hoa_shop::ShopMode:

Inheritance graph
[legend]
Collaboration diagram for hoa_shop::ShopMode:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void AddObject (uint32 object_id)
 Adds a new object for the shop to sell.
void Draw ()
 Handles the drawing of everything on the shop menu and makes sub-draw function calls as appropriate.
uint32 GetPurchaseCost ()
uint32 GetSalesRevenue ()
uint32 GetTotalRemaining ()
void Reset ()
 Resets appropriate settings. Called whenever the ShopMode object is made the active game mode. This function additionally constructs the inventory menu from the object list. Therefore, if you add an object to the inventory it won't be seen in the list until this function is called.
 ShopMode ()
void Update ()
 Handles user input and updates the shop menu.
 ~ShopMode ()

Private Attributes

std::vector< hoa_global::GlobalObject * > _all_objects
 Contains all of the items.
std::vector< int > _all_objects_quantities
 Contains quantities corresponding to _all_objects.
std::vector< hoa_global::GlobalObject * > _current_inv
 Contains all of the items.
std::map< uint32, uint32_object_map
 Contains the ids of all objects which are sold in the shop The map key is the object id and the value is not used for anything.
uint32 _purchases_cost
 The total cost of all marked purchases.
uint32 _sales_revenue
 The total revenue that will be earned from all marked sales.
hoa_video::StillImage _saved_screen
 An image of the last frame shown on the screen before ShopMode was created.
std::vector< int > _sell_objects_quantities
 Contains quantities corresponding to current inventory.
std::map< std::string, hoa_audio::SoundDescriptor_shop_sounds
 A map of the sounds used in shop mode.
private_shop::SHOP_STATE _state
 Keeps track of what windows are open to determine how to handle user input.
Menu Windows in Shop Mode
private_shop::ShopActionWindow _action_window
 The top window containing the shop actions (buy, sell, etc).
private_shop::ConfirmWindow _confirm_window
 A window to confirm the purchase of an object.
private_shop::ObjectInfoWindow _info_window
 The window that provides a detailed description of the selected object in the list window.
private_shop::ObjectListWindow _list_window
 The window containing the list of wares for sale.
private_shop::ObjectSellListWindow _sell_window
 The window containing the list of wares for sale.

Friends

class private_shop::ConfirmWindow
class private_shop::ObjectInfoWindow
class private_shop::ObjectListWindow
class private_shop::ObjectSellListWindow
class private_shop::ShopActionWindow

Detailed Description

Handles the game execution while the player is shopping.

****************************************************************************

ShopMode allows the player to purchase items, weapons, armor, and other objects. ShopMode consists of a captured screenshot which forms the background image, upon which a series of menu windows are drawn. The background image is of size 1024x768, and a 800x600 arrangement of windows is drawn ontop of the middle of that image.

Definition at line 65 of file shop.h.


Constructor & Destructor Documentation

hoa_shop::ShopMode::ShopMode (  ) 

Definition at line 52 of file shop.cpp.

References _purchases_cost, _sales_revenue, _saved_screen, _state, hoa_video::GameVideo::CaptureScreen(), hoa_shop::private_shop::current_shop, hoa_mode_manager::MODE_MANAGER_SHOP_MODE, hoa_mode_manager::GameMode::mode_type, hoa_shop::SHOP_DEBUG, hoa_shop::private_shop::SHOP_STATE_ACTION, and hoa_video::VideoManager.

Here is the call graph for this function:

hoa_shop::ShopMode::~ShopMode (  ) 

Definition at line 71 of file shop.cpp.

References _all_objects, _saved_screen, hoa_shop::private_shop::current_shop, hoa_video::GameVideo::DeleteImage(), hoa_shop::SHOP_DEBUG, and hoa_video::VideoManager.

Here is the call graph for this function:


Member Function Documentation

void hoa_shop::ShopMode::AddObject ( uint32  object_id  ) 

Adds a new object for the shop to sell.

Parameters:
object_id The id number of the object to add
You should only specify id numbers that correspond to items, weapons, or armor The newly added object won't be seen in the shop menu until the Reset() function is called.

Definition at line 186 of file shop.cpp.

References _object_map, and hoa_shop::SHOP_DEBUG.

void hoa_shop::ShopMode::Draw (  )  [virtual]

Handles the drawing of everything on the shop menu and makes sub-draw function calls as appropriate.

Implements hoa_mode_manager::GameMode.

Definition at line 164 of file shop.cpp.

References _action_window, _confirm_window, _info_window, _list_window, _saved_screen, _sell_window, hoa_shop::private_shop::ConfirmWindow::Draw(), hoa_shop::private_shop::ObjectListWindow::Draw(), hoa_shop::private_shop::ObjectSellListWindow::Draw(), hoa_shop::private_shop::ObjectInfoWindow::Draw(), hoa_shop::private_shop::ShopActionWindow::Draw(), hoa_video::GameVideo::DrawImage(), hoa_video::GameVideo::GetHeight(), hoa_video::GameVideo::GetWidth(), hoa_video::GameVideo::Move(), hoa_video::GameVideo::SetCoordSys(), and hoa_video::VideoManager.

Here is the call graph for this function:

uint32 hoa_shop::ShopMode::GetPurchaseCost (  )  [inline]

Definition at line 88 of file shop.h.

References _purchases_cost.

Referenced by hoa_shop::private_shop::ConfirmWindow::Update(), and hoa_shop::private_shop::ShopActionWindow::UpdateFinanceText().

uint32 hoa_shop::ShopMode::GetSalesRevenue (  )  [inline]

Definition at line 89 of file shop.h.

References _sales_revenue.

Referenced by hoa_shop::private_shop::ConfirmWindow::Update(), and hoa_shop::private_shop::ShopActionWindow::UpdateFinanceText().

uint32 hoa_shop::ShopMode::GetTotalRemaining (  ) 

Definition at line 202 of file shop.cpp.

References _purchases_cost, _sales_revenue, hoa_global::GameGlobal::GetDrunes(), and hoa_global::GlobalManager.

Referenced by hoa_shop::private_shop::ObjectListWindow::Update(), and hoa_shop::private_shop::ShopActionWindow::UpdateFinanceText().

Here is the call graph for this function:

void hoa_shop::ShopMode::Reset (  )  [virtual]

Resets appropriate settings. Called whenever the ShopMode object is made the active game mode. This function additionally constructs the inventory menu from the object list. Therefore, if you add an object to the inventory it won't be seen in the list until this function is called.

Implements hoa_mode_manager::GameMode.

Definition at line 87 of file shop.cpp.

References _action_window, _all_objects, _all_objects_quantities, _list_window, _sell_objects_quantities, _sell_window, _shop_sounds, hoa_global::GameGlobal::GetInventory(), hoa_global::GlobalManager, hoa_shop::private_shop::ObjectSellListWindow::object_list, hoa_shop::private_shop::ObjectListWindow::RefreshList(), hoa_video::GameVideo::SetCoordSys(), hoa_video::GameVideo::SetDrawFlags(), hoa_video::GameVideo::SetFont(), hoa_video::OptionBox::SetSelection(), hoa_video::GameVideo::SetTextColor(), hoa_shop::private_shop::ShopActionWindow::UpdateFinanceText(), hoa_shop::private_shop::ObjectSellListWindow::UpdateSellList(), hoa_video::VIDEO_X_LEFT, hoa_video::VIDEO_Y_BOTTOM, and hoa_video::VideoManager.

Here is the call graph for this function:

void hoa_shop::ShopMode::Update (  )  [virtual]

Handles user input and updates the shop menu.

Implements hoa_mode_manager::GameMode.

Definition at line 140 of file shop.cpp.

References _action_window, _confirm_window, _list_window, _sell_window, _state, hoa_shop::SHOP_DEBUG, hoa_shop::private_shop::SHOP_STATE_ACTION, hoa_shop::private_shop::SHOP_STATE_CONFIRM, hoa_shop::private_shop::SHOP_STATE_LIST, hoa_shop::private_shop::SHOP_STATE_SELL, hoa_shop::private_shop::ConfirmWindow::Update(), hoa_shop::private_shop::ObjectSellListWindow::Update(), hoa_shop::private_shop::ObjectListWindow::Update(), and hoa_shop::private_shop::ShopActionWindow::Update().

Here is the call graph for this function:


Friends And Related Function Documentation

friend class private_shop::ConfirmWindow [friend]

Definition at line 70 of file shop.h.

friend class private_shop::ObjectInfoWindow [friend]

Definition at line 69 of file shop.h.

friend class private_shop::ObjectListWindow [friend]

Definition at line 67 of file shop.h.

friend class private_shop::ObjectSellListWindow [friend]

Definition at line 68 of file shop.h.

friend class private_shop::ShopActionWindow [friend]

Definition at line 66 of file shop.h.


Member Data Documentation

private_shop::ShopActionWindow hoa_shop::ShopMode::_action_window [private]

The top window containing the shop actions (buy, sell, etc).

Definition at line 144 of file shop.h.

Referenced by Draw(), Reset(), hoa_shop::private_shop::ConfirmWindow::Update(), hoa_shop::private_shop::ObjectSellListWindow::Update(), hoa_shop::private_shop::ObjectListWindow::Update(), and Update().

std::vector<hoa_global::GlobalObject*> hoa_shop::ShopMode::_all_objects [private]

Contains all of the items.

Note:
This container is temporary, and will be replaced with multiple containers (for each type of object) at a later time.

Definition at line 125 of file shop.h.

Referenced by hoa_shop::private_shop::ObjectListWindow::RefreshList(), Reset(), hoa_shop::private_shop::ConfirmWindow::Update(), hoa_shop::private_shop::ObjectListWindow::Update(), hoa_shop::private_shop::ShopActionWindow::Update(), and ~ShopMode().

std::vector<int> hoa_shop::ShopMode::_all_objects_quantities [private]

Contains quantities corresponding to _all_objects.

Definition at line 135 of file shop.h.

Referenced by hoa_shop::private_shop::ObjectListWindow::RefreshList(), Reset(), hoa_shop::private_shop::ConfirmWindow::Update(), and hoa_shop::private_shop::ObjectListWindow::Update().

private_shop::ConfirmWindow hoa_shop::ShopMode::_confirm_window [private]

A window to confirm the purchase of an object.

Definition at line 156 of file shop.h.

Referenced by Draw(), hoa_shop::private_shop::ObjectSellListWindow::Update(), hoa_shop::private_shop::ObjectListWindow::Update(), hoa_shop::private_shop::ShopActionWindow::Update(), and Update().

std::vector<hoa_global::GlobalObject*> hoa_shop::ShopMode::_current_inv [private]

Contains all of the items.

Note:
This container is temporary, and will be replaced with multiple containers (for each type of object) at a later time.

Definition at line 131 of file shop.h.

Referenced by hoa_shop::private_shop::ObjectSellListWindow::Clear(), hoa_shop::private_shop::ConfirmWindow::Update(), hoa_shop::private_shop::ObjectSellListWindow::Update(), hoa_shop::private_shop::ShopActionWindow::Update(), and hoa_shop::private_shop::ObjectSellListWindow::UpdateSellList().

private_shop::ObjectInfoWindow hoa_shop::ShopMode::_info_window [private]

The window that provides a detailed description of the selected object in the list window.

Definition at line 153 of file shop.h.

Referenced by Draw(), hoa_shop::private_shop::ConfirmWindow::Update(), hoa_shop::private_shop::ObjectSellListWindow::Update(), hoa_shop::private_shop::ObjectListWindow::Update(), and hoa_shop::private_shop::ShopActionWindow::Update().

private_shop::ObjectListWindow hoa_shop::ShopMode::_list_window [private]

The window containing the list of wares for sale.

Definition at line 147 of file shop.h.

Referenced by Draw(), hoa_shop::private_shop::ObjectListWindow::RefreshList(), Reset(), hoa_shop::private_shop::ConfirmWindow::Update(), hoa_shop::private_shop::ShopActionWindow::Update(), and Update().

std::map<uint32, uint32> hoa_shop::ShopMode::_object_map [private]

Contains the ids of all objects which are sold in the shop The map key is the object id and the value is not used for anything.

Definition at line 116 of file shop.h.

Referenced by AddObject().

uint32 hoa_shop::ShopMode::_purchases_cost [private]

The total cost of all marked purchases.

Definition at line 105 of file shop.h.

Referenced by GetPurchaseCost(), GetTotalRemaining(), ShopMode(), hoa_shop::private_shop::ConfirmWindow::Update(), and hoa_shop::private_shop::ObjectListWindow::Update().

uint32 hoa_shop::ShopMode::_sales_revenue [private]

The total revenue that will be earned from all marked sales.

Definition at line 108 of file shop.h.

Referenced by GetSalesRevenue(), GetTotalRemaining(), ShopMode(), hoa_shop::private_shop::ConfirmWindow::Update(), and hoa_shop::private_shop::ObjectSellListWindow::Update().

hoa_video::StillImage hoa_shop::ShopMode::_saved_screen [private]

An image of the last frame shown on the screen before ShopMode was created.

Definition at line 111 of file shop.h.

Referenced by Draw(), ShopMode(), and ~ShopMode().

std::vector<int> hoa_shop::ShopMode::_sell_objects_quantities [private]

Contains quantities corresponding to current inventory.

Definition at line 139 of file shop.h.

Referenced by Reset(), hoa_shop::private_shop::ConfirmWindow::Update(), hoa_shop::private_shop::ObjectSellListWindow::Update(), and hoa_shop::private_shop::ObjectSellListWindow::UpdateSellList().

private_shop::ObjectSellListWindow hoa_shop::ShopMode::_sell_window [private]

The window containing the list of wares for sale.

Definition at line 150 of file shop.h.

Referenced by Draw(), Reset(), hoa_shop::private_shop::ConfirmWindow::Update(), hoa_shop::private_shop::ShopActionWindow::Update(), and Update().

std::map<std::string, hoa_audio::SoundDescriptor> hoa_shop::ShopMode::_shop_sounds [private]

A map of the sounds used in shop mode.

Definition at line 119 of file shop.h.

Referenced by Reset(), hoa_shop::private_shop::ConfirmWindow::Update(), hoa_shop::private_shop::ObjectSellListWindow::Update(), hoa_shop::private_shop::ObjectListWindow::Update(), and hoa_shop::private_shop::ShopActionWindow::Update().

private_shop::SHOP_STATE hoa_shop::ShopMode::_state [private]

Keeps track of what windows are open to determine how to handle user input.

Definition at line 102 of file shop.h.

Referenced by hoa_shop::private_shop::ConfirmWindow::Draw(), hoa_shop::private_shop::ObjectSellListWindow::Draw(), hoa_shop::private_shop::ObjectListWindow::Draw(), ShopMode(), hoa_shop::private_shop::ConfirmWindow::Update(), hoa_shop::private_shop::ObjectSellListWindow::Update(), hoa_shop::private_shop::ObjectListWindow::Update(), hoa_shop::private_shop::ShopActionWindow::Update(), and Update().


The documentation for this class was generated from the following files:
Generated on Fri Jul 6 23:15:54 2007 for Hero of Allacrost by  doxygen 1.5.1