summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-04-07 13:49:18 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-04-07 13:49:18 +0000
commit112fbe319f1e9070e9b6b62a7ec12d625a19be51 (patch)
tree62572ba750a8fb8d37d2f63a69f282d8590f4c31 /src/gui
parent682be63061b2134cd3bc8b272fd3180e82437bb9 (diff)
downloadmana-112fbe319f1e9070e9b6b62a7ec12d625a19be51.tar.gz
mana-112fbe319f1e9070e9b6b62a7ec12d625a19be51.tar.bz2
mana-112fbe319f1e9070e9b6b62a7ec12d625a19be51.tar.xz
mana-112fbe319f1e9070e9b6b62a7ec12d625a19be51.zip
* Fixed crash on exit when trying to delete listbox that wasn't created.
* Disabled Ok button in Buy and Sell dialog when amount is 0 * Corrected the three known map bugs
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/buy.cpp9
-rw-r--r--src/gui/char_select.cpp3
-rw-r--r--src/gui/minimap.cpp15
-rw-r--r--src/gui/sell.cpp9
-rw-r--r--src/gui/setup.cpp20
-rw-r--r--src/gui/setup.h8
6 files changed, 42 insertions, 22 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index e75bdbb1..2da38c36 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -42,6 +42,7 @@ BuyDialog::BuyDialog():
moneyLabel = new gcn::Label("350 G");
okButton = new Button("OK");
cancelButton = new Button("Cancel");
+ okButton->setEnabled(false);
setContentSize(260, 175);
scrollArea->setDimension(gcn::Rectangle(5, 5, 250, 110));
@@ -121,11 +122,17 @@ void BuyDialog::action(const std::string& eventId)
if (eventId == "slider" || eventId == "item") {
if (selectedItem > -1) {
int maxItems = money / shopInventory[selectedItem].price;
+ int numItems = (int)(slider->getValue() * maxItems);
std::stringstream ss;
- ss << (int)(slider->getValue() * maxItems);
+ ss << numItems;
quantityLabel->setCaption(ss.str());
quantityLabel->adjustSize();
+
+ okButton->setEnabled(numItems > 0);
+ }
+ else {
+ okButton->setEnabled(false);
}
}
else if (eventId == "ok") {
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index c2ad9eee..629a0d63 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -180,7 +180,8 @@ void CharSelectDialog::setPlayerInfo(PLAYER_INFO *pi)
}
}
-void CharSelectDialog::serverCharDelete() {
+void CharSelectDialog::serverCharDelete()
+{
// Request character deletion
WFIFOW(0) = net_w_value(0x0068);
WFIFOL(2) = net_l_value(char_info->id);
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index c43f5218..899ec78c 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -39,7 +39,8 @@ Minimap::Minimap()
sourceRect.x = sourceRect.y = 0;
sourceRect.w = MINIMAP_W;
sourceRect.h = MINIMAP_H;
- if ( mapBackground )
+
+ if (mapBackground)
{
SDL_FillRect(mapBackground, &sourceRect, mapColor);
SDL_SetAlpha(mapBackground, SDL_SRCALPHA, 120);
@@ -59,18 +60,18 @@ void Minimap::draw(gcn::Graphics *graphics)
getWidth(), getHeight(),
(screen->format->BytesPerPixel * 8), 0, 0, 0, 0);
Uint32 mapColor = SDL_MapRGB(screen->format, 52, 149, 210);
- SDL_Rect sourceRect;
- sourceRect.x = sourceRect.y = 0;
- sourceRect.w = getWidth();
- sourceRect.h = getHeight();
if (mapBackground)
{
+ SDL_Rect sourceRect;
+ sourceRect.x = sourceRect.y = 0;
+ sourceRect.w = getWidth();
+ sourceRect.h = getHeight();
SDL_FillRect(mapBackground, &sourceRect, mapColor);
SDL_SetAlpha(mapBackground, SDL_SRCALPHA, 120);
}
}
-
+
if (mapBackground)
{
SDL_Rect screenRect;
@@ -81,7 +82,7 @@ void Minimap::draw(gcn::Graphics *graphics)
SDL_BlitSurface(mapBackground, NULL, screen, &screenRect);
}
-
+
graphics->setColor(gcn::Color(0, 0, 0));
graphics->drawRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight()));
graphics->setColor(gcn::Color(209, 52, 61));
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index 4ab41cd2..d4bd1d8a 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -42,6 +42,7 @@ SellDialog::SellDialog():
quantityLabel = new gcn::Label("0");
okButton = new Button("OK");
cancelButton = new Button("Cancel");
+ okButton->setEnabled(false);
setContentSize(260, 175);
scrollArea->setDimension(gcn::Rectangle(5, 5, 250, 110));
@@ -114,11 +115,17 @@ void SellDialog::action(const std::string& eventId)
if (eventId == "slider" || eventId == "item") {
if (selectedItem > -1) {
int maxItems = shopInventory[selectedItem].quantity;
+ int numItems = (int)(slider->getValue() * maxItems);
std::stringstream ss;
- ss << (int)(slider->getValue() * maxItems);
+ ss << numItems;
quantityLabel->setCaption(ss.str());
quantityLabel->adjustSize();
+
+ okButton->setEnabled(numItems > 0);
+ }
+ else {
+ okButton->setEnabled(false);
}
}
else if (eventId == "ok") {
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index cfe155f8..b0a35380 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -40,7 +40,8 @@
#include <string.h>
#include <memory.h>
-/*SDL_Rect **modes;
+/*
+SDL_Rect **modes;
ModeListModel::ModeListModel()
{
@@ -92,7 +93,8 @@ int ModeListModel::getNumberOfElements()
std::string ModeListModel::getElementAt(int i)
{
return mode[i];
-}*/
+}
+*/
Setup::Setup():
Window("Setup")
@@ -121,9 +123,11 @@ Setup::Setup():
// Set dimensions/positions
setContentSize(240, 216);
- /*scrollArea->setDimension(gcn::Rectangle(10, 40, 90, 50));
+ /*
+ scrollArea->setDimension(gcn::Rectangle(10, 40, 90, 50));
modeList->setDimension(gcn::Rectangle(0, 0, 60, 50));
- displayLabel->setDimension(gcn::Rectangle(10, 10, 100,16));*/
+ displayLabel->setDimension(gcn::Rectangle(10, 10, 100,16));
+ */
cancelButton->setPosition(
240 - 5 - cancelButton->getWidth(),
216 - 5 - cancelButton->getHeight());
@@ -168,13 +172,13 @@ Setup::Setup():
Setup::~Setup()
{
- delete modeListModel;
- delete modeList;
- delete scrollArea;
+ //delete modeListModel;
+ //delete modeList;
+ //delete scrollArea;
delete fsCheckBox;
delete soundCheckBox;
delete soundLabel;
- delete displayLabel;
+ //delete displayLabel;
delete applyButton;
delete cancelButton;
delete alphaLabel;
diff --git a/src/gui/setup.h b/src/gui/setup.h
index 7a38bfd5..0fe3df1b 100644
--- a/src/gui/setup.h
+++ b/src/gui/setup.h
@@ -67,14 +67,14 @@ class ModeListModel : public gcn::ListModel {
class Setup : public Window, public gcn::ActionListener {
private:
// Dialog parts
- ModeListModel *modeListModel;
- gcn::Label *displayLabel;
+ //ModeListModel *modeListModel;
+ //gcn::Label *displayLabel;
gcn::CheckBox *fsCheckBox;
gcn::Label *soundLabel;
gcn::CheckBox *soundCheckBox;
gcn::RadioButton *disabledRadio;
- gcn::ScrollArea *scrollArea;
- gcn::ListBox *modeList;
+ //gcn::ScrollArea *scrollArea;
+ //gcn::ListBox *modeList;
gcn::Button *applyButton;
gcn::Button *cancelButton;
gcn::Label *alphaLabel;