Permalink
Browse files

Removed some shop dead code.

If we add it back, I'd like it to be thought with a fresh way.
  • Loading branch information...
1 parent cc9818f commit 61759136b3289280ee1246ccf1fac89da5ac6620 Yohann Ferreira committed Mar 26, 2013
Showing with 1 addition and 147 deletions.
  1. +1 −106 src/modes/shop/shop_root.cpp
  2. +0 −41 src/modes/shop/shop_root.h
@@ -44,69 +44,6 @@ namespace hoa_shop
namespace private_shop
{
-// The maximum number of category icons + text that can be displayed in a single row
-const uint8 MAX_CATEGORY_ROW_SIZE = 3;
-
-// *****************************************************************************
-// ***** CategoryDrawData class methods
-// *****************************************************************************
-
-void CategoryDrawData::ComputeCoordinates(uint8 number_categories)
-{
- if(number_categories > GLOBAL_OBJECT_TOTAL) {
- IF_PRINT_WARNING(SHOP_DEBUG) << "invalid argument value: " << number_categories << std::endl;
- return;
- }
-
- // ---------- (1): Determine the number of entries in each category row
- if(number_categories <= MAX_CATEGORY_ROW_SIZE) {
- first_row_num = number_categories;
- second_row_num = 0;
- } else {
- first_row_num = MAX_CATEGORY_ROW_SIZE;
- second_row_num = number_categories - first_row_num;
- }
-
- // ---------- (2): Determine the y position in each category row
- if(second_row_num != 0) { // then there are two rows of categories to draw
- first_row_y = 420.0f;
- second_row_y = 320.0f;
- } else {
- first_row_y = 370.0f;
- second_row_y = first_row_y;
- }
-
- // ---------- (3): Determine the x position of each category row
- switch(first_row_num) {
- case 1:
- first_row_x = 512.0f; // Horizontal center of screen
- break;
- case 2:
- first_row_x = 437.0f; // The delta between icons when drawn is 150.0f, so move the draw cursor by half that amount
- break;
- case 3:
- first_row_x = 362.0f;
- break;
- case 4:
- first_row_x = 287.0f;
- break;
- }
- switch(second_row_num) {
- case 1:
- second_row_x = 512.0f;
- break;
- case 2:
- second_row_x = 437.0f;
- break;
- case 3:
- second_row_x = 362.0f;
- break;
- case 4:
- second_row_x = 287.0f;
- break;
- }
-} // void CategoryDrawData::ComputeCoordinates(uint8 number_categories)
-
// *****************************************************************************
// ***** RootInterface class methods
// *****************************************************************************
@@ -131,8 +68,6 @@ RootInterface::RootInterface()
_greeting_text.SetDisplayText(UTranslate("\"Welcome! Take a look around.\"")); // Default greeting, should usually be overwritten
}
-
-
void RootInterface::Reinitialize()
{
// ---------- (1): Create the price level graphics
@@ -216,32 +151,13 @@ void RootInterface::Reinitialize()
num_buy_stars--;
offset += 40.0f;
}
- /* FIXME: Readd this
- // ---------- (2): Construct category name text and graphics and determine category draw coordinates
- // Determine the number of names and icons of categories to load
- uint32 number_categories = ShopMode::CurrentInstance()->Media()->GetSaleCategoryNames()->size();
- if (number_categories > 1) // If multiple categories are available, remove one because we don't want to show the "all" category
- number_categories--;
-
- TextStyle name_style("text22");
- for (uint32 i = 0; i < number_categories; i++) {
- _category_names.push_back(TextImage(ShopMode::CurrentInstance()->Media()->GetSaleCategoryNames()->at(i), name_style));
- _category_icons.push_back(ShopMode::CurrentInstance()->Media()->GetSaleCategoryIcons()->at(i));
- }
-
- _category_draw_data.ComputeCoordinates(_category_icons.size());
- */
} // void RootInterface::Initialize()
-
-
void RootInterface::Update()
{
_greeting_text.Update();
}
-
-
void RootInterface::Draw()
{
VideoManager->SetDrawFlags(VIDEO_X_CENTER, VIDEO_Y_TOP, 0);
@@ -260,37 +176,16 @@ void RootInterface::Draw()
_buy_price_rating.Draw();
VideoManager->MoveRelative(280.0f, 0.0f);
_sell_price_rating.Draw();
- /* FIXME: Readd this
- // Middle window: below the pricing text/image draw the category icons and text in one or two rows
- VideoManager->Move(_category_draw_data.first_row_x, _category_draw_data.first_row_y);
- for (uint8 i = 0; i < _category_draw_data.first_row_num; i++) {
- _category_icons[i].Draw();
- VideoManager->MoveRelative(0.0f, -60.0f);
- _category_names[i].Draw();
- VideoManager->MoveRelative(150.0f, 60.0f);
- }
-
- VideoManager->Move(_category_draw_data.second_row_x, _category_draw_data.second_row_y);
- for (uint8 i = 0; i < _category_draw_data.second_row_num; i++) {
- _category_icons[i + MAX_CATEGORY_ROW_SIZE].Draw();
- VideoManager->MoveRelative(0.0f, -60.0f);
- _category_names[i +MAX_CATEGORY_ROW_SIZE].Draw();
- VideoManager->MoveRelative(150.0f, 60.0f);
- }
- */
+
// Bottom window: draw the greeting text
_greeting_text.Draw();
}
-
-
void RootInterface::SetShopName(const hoa_utils::ustring& name)
{
_shop_name.SetText(name);
}
-
-
void RootInterface::SetGreetingText(const hoa_utils::ustring& greeting)
{
_greeting_text.SetDisplayText(greeting);
View
@@ -28,34 +28,6 @@ namespace hoa_shop
namespace private_shop
{
-/** ****************************************************************************
-*** \brief Assists the RootInterface in proper draw orientation of object category icons and text
-***
-*** Shops have anywhere between one and eight different categories of objects that they may deal in.
-*** One job of the root interface is to display the icon and name of all categories which the shop
-*** deals in. This information is displayed in rows of four. To keep the interface looking nice and consistent
-*** with all the different possible combinations of category numbers, the y draw position for the rows is altered
-*** depending on whether one or two rows are to be drawn. The x draw position of the category icons and text is
-*** also variable depending on the number of categories to be drawn in that row.
-*** ***************************************************************************/
-class CategoryDrawData
-{
-public:
- /** \brief Determines the appropriate values to set for each class member
- *** \param number_categories The total number of object categories to draw. Valid range: 1-8
- **/
- void ComputeCoordinates(uint8 number_categories);
-
- /** \brief The number of object categories in the first and second rows
- *** \note The first row may have 1-4 categories and the second row may have 0-4 categories
- **/
- uint8 first_row_num, second_row_num;
-
- //! \brief Starting draw positions for the first and second rows of object categories
- float first_row_x, first_row_y, second_row_x, second_row_y;
-}; // class CategoryDrawData
-
-
/** ****************************************************************************
*** \brief The highest level shopping interface which displays information about the shop
***
@@ -124,21 +96,8 @@ class RootInterface : public ShopInterface
//! \brief A composite image for the star rating of the buy and sell price levels
hoa_video::CompositeImage _buy_price_rating, _sell_price_rating;
- /** \brief Container for the text object representing each object category's name
- *** Categories which the shop does not deal in will have their text rendered in grayscale
- **/
- std::vector<hoa_video::TextImage> _category_names;
-
- /** \brief Container for icon images that represent each object category
- *** Categories which the shop does not deal in will have their icon rendered in grayscale
- **/
- std::vector<hoa_video::StillImage> _category_icons;
-
//! \brief A textbox displaying a short greeting or message from the shop keeper
hoa_gui::TextBox _greeting_text;
-
- //! \brief A container holding the correct draw coordinates and information for object categories
- CategoryDrawData _category_draw_data;
}; // class RootInterface : public ShopInterface
} // namespace private_shop

0 comments on commit 6175913

Please sign in to comment.