summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-03-06 00:39:58 +0300
committerAndrei Karas <akaras@inbox.ru>2014-03-06 23:06:15 +0300
commit6b291b6515825f4ce0e09df5dec7ea1b619b63a7 (patch)
treef26a35a21cde34f45538a191b2196bf7c81d2693 /src/gui
parent833e498f54c1d33be94c09214315b368cccaec06 (diff)
downloadmv-6b291b6515825f4ce0e09df5dec7ea1b619b63a7.tar.gz
mv-6b291b6515825f4ce0e09df5dec7ea1b619b63a7.tar.bz2
mv-6b291b6515825f4ce0e09df5dec7ea1b619b63a7.tar.xz
mv-6b291b6515825f4ce0e09df5dec7ea1b619b63a7.zip
improve a bit different code.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/scrollarea.cpp26
-rw-r--r--src/gui/widgets/scrollarea.h90
-rw-r--r--src/gui/widgets/setupitem.cpp8
-rw-r--r--src/gui/widgets/slider.cpp96
-rw-r--r--src/gui/widgets/slider.h22
-rw-r--r--src/gui/widgets/tabs/setup_colors.cpp16
-rw-r--r--src/gui/widgets/tabs/setup_video.cpp12
-rw-r--r--src/gui/widgets/widget.h2
-rw-r--r--src/gui/windows/botcheckerwindow.cpp5
-rw-r--r--src/gui/windows/buydialog.cpp14
-rw-r--r--src/gui/windows/itemamountwindow.cpp10
-rw-r--r--src/gui/windows/killstats.cpp14
-rw-r--r--src/gui/windows/killstats.h3
-rw-r--r--src/gui/windows/selldialog.cpp12
14 files changed, 164 insertions, 166 deletions
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index 3c50abca0..70f955684 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -99,36 +99,36 @@ ScrollArea::ScrollArea(Widget2 *const widget2,
BasicContainer(widget2),
MouseListener(),
WidgetListener(),
+ mVertexes(new ImageCollection),
+ mVertexes2(new ImageCollection),
+ mHPolicy(SHOW_AUTO),
+ mVPolicy(SHOW_AUTO),
mVScroll(0),
mHScroll(0),
mScrollbarWidth(12),
- mHPolicy(SHOW_AUTO),
- mVPolicy(SHOW_AUTO),
- mVBarVisible(false),
- mHBarVisible(false),
- mUpButtonPressed(false),
- mDownButtonPressed(false),
- mLeftButtonPressed(false),
- mRightButtonPressed(false),
mUpButtonScrollAmount(10),
mDownButtonScrollAmount(10),
mLeftButtonScrollAmount(10),
mRightButtonScrollAmount(10),
- mIsVerticalMarkerDragged(false),
- mIsHorizontalMarkerDragged(false),
mHorizontalMarkerDragOffset(0),
mVerticalMarkerDragOffset(0),
- mOpaque(true),
mX(0),
mY(0),
mClickX(0),
mClickY(0),
- mVertexes(new ImageCollection),
- mVertexes2(new ImageCollection),
mXOffset(0),
mYOffset(0),
mDrawWidth(0),
mDrawHeight(0),
+ mVBarVisible(false),
+ mHBarVisible(false),
+ mUpButtonPressed(false),
+ mDownButtonPressed(false),
+ mLeftButtonPressed(false),
+ mRightButtonPressed(false),
+ mIsVerticalMarkerDragged(false),
+ mIsHorizontalMarkerDragged(false),
+ mOpaque(true),
mHasMouse(false),
mRedraw(true)
{
diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h
index 70abac6ef..4653359e8 100644
--- a/src/gui/widgets/scrollarea.h
+++ b/src/gui/widgets/scrollarea.h
@@ -470,6 +470,19 @@ class ScrollArea final : public BasicContainer,
static ImageRect hBackground;
static Image *buttons[4][2];
+ ImageCollection *mVertexes;
+ ImageCollection *mVertexes2;
+
+ /**
+ * Holds the horizontal scroll bar policy.
+ */
+ ScrollPolicy mHPolicy;
+
+ /**
+ * Holds the vertical scroll bar policy.
+ */
+ ScrollPolicy mVPolicy;
+
/**
* Holds the vertical scroll amount.
*/
@@ -486,64 +499,73 @@ class ScrollArea final : public BasicContainer,
int mScrollbarWidth;
/**
- * Holds the horizontal scroll bar policy.
+ * Holds the up button scroll amount.
*/
- ScrollPolicy mHPolicy;
+ int mUpButtonScrollAmount;
/**
- * Holds the vertical scroll bar policy.
+ * Holds the down button scroll amount.
*/
- ScrollPolicy mVPolicy;
+ int mDownButtonScrollAmount;
/**
- * True if the vertical scroll bar is visible, false otherwise.
+ * Holds the left button scroll amount.
*/
- bool mVBarVisible;
+ int mLeftButtonScrollAmount;
/**
- * True if the horizontal scroll bar is visible, false otherwise.
+ * Holds the right button scroll amount.
*/
- bool mHBarVisible;
+ int mRightButtonScrollAmount;
/**
- * True if the up button is pressed, false otherwise.
+ * Holds the horizontal markers drag offset.
*/
- bool mUpButtonPressed;
+ int mHorizontalMarkerDragOffset;
/**
- * True if the down button is pressed, false otherwise.
+ * Holds the vertical markers drag offset.
*/
- bool mDownButtonPressed;
+ int mVerticalMarkerDragOffset;
+
+ int mX;
+ int mY;
+ int mClickX;
+ int mClickY;
+ int mXOffset;
+ int mYOffset;
+ int mDrawWidth;
+ int mDrawHeight;
/**
- * True if the left button is pressed, false otherwise.
+ * True if the vertical scroll bar is visible, false otherwise.
*/
- bool mLeftButtonPressed;
+ bool mVBarVisible;
/**
- * True if the right button is pressed, false otherwise.
+ * True if the horizontal scroll bar is visible, false otherwise.
*/
- bool mRightButtonPressed;
+ bool mHBarVisible;
/**
- * Holds the up button scroll amount.
+ * True if the up button is pressed, false otherwise.
*/
- int mUpButtonScrollAmount;
+ bool mUpButtonPressed;
/**
- * Holds the down button scroll amount.
+ * True if the down button is pressed, false otherwise.
*/
- int mDownButtonScrollAmount;
+ bool mDownButtonPressed;
/**
- * Holds the left button scroll amount.
+ * True if the left button is pressed, false otherwise.
*/
- int mLeftButtonScrollAmount;
+ bool mLeftButtonPressed;
/**
- * Holds the right button scroll amount.
+ * True if the right button is pressed, false otherwise.
*/
- int mRightButtonScrollAmount;
+ bool mRightButtonPressed;
/**
* True if the vertical marked is dragged.
@@ -556,31 +578,11 @@ class ScrollArea final : public BasicContainer,
bool mIsHorizontalMarkerDragged;
/**
- * Holds the horizontal markers drag offset.
- */
- int mHorizontalMarkerDragOffset;
-
- /**
- * Holds the vertical markers drag offset.
- */
- int mVerticalMarkerDragOffset;
-
- /**
* True if the scroll area should be opaque (that is
* display its background), false otherwise.
*/
bool mOpaque;
- int mX;
- int mY;
- int mClickX;
- int mClickY;
- ImageCollection *mVertexes;
- ImageCollection *mVertexes2;
- int mXOffset;
- int mYOffset;
- int mDrawWidth;
- int mDrawHeight;
bool mHasMouse;
bool mRedraw;
};
diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp
index 218efe8a2..4c32b0572 100644
--- a/src/gui/widgets/setupitem.cpp
+++ b/src/gui/widgets/setupitem.cpp
@@ -769,7 +769,7 @@ void SetupItemSlider::createControls()
mSlider = new Slider(this, mMin, mMax);
mSlider->setActionEventId(mEventName);
mSlider->addActionListener(mParent);
- mSlider->setValue2(atof(mValue.c_str()));
+ mSlider->setValue(atof(mValue.c_str()));
mSlider->setHeight(30);
mWidget = mSlider;
@@ -798,7 +798,7 @@ void SetupItemSlider::toWidget()
if (!mSlider)
return;
- mSlider->setValue2(atof(mValue.c_str()));
+ mSlider->setValue(atof(mValue.c_str()));
}
void SetupItemSlider::action(const ActionEvent &event A_UNUSED)
@@ -893,7 +893,7 @@ void SetupItemSlider2::createControls()
mSlider = new Slider(this, mMin, mMax);
mSlider->setActionEventId(mEventName);
mSlider->addActionListener(mParent);
- mSlider->setValue2(atof(mValue.c_str()));
+ mSlider->setValue(atof(mValue.c_str()));
mSlider->setHeight(30);
mWidget = mSlider;
@@ -952,7 +952,7 @@ void SetupItemSlider2::toWidget()
int val = roundDouble(atof(mValue.c_str()));
if (mInvert)
val = mInvertValue - val;
- mSlider->setValue2(val);
+ mSlider->setValue(val);
updateLabel();
}
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index ab8cb97c2..8da4f34ae 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -93,14 +93,14 @@ Slider::Slider(Widget2 *const widget,
Widget(widget),
MouseListener(),
KeyListener(),
- mDragged(false),
mValue(0),
mStepLength(scaleEnd / 10),
- mMarkerLength(10),
mScaleStart(0),
mScaleEnd(scaleEnd),
mOrientation(HORIZONTAL),
mVertexes(new ImageCollection),
+ mMarkerLength(10),
+ mDragged(false),
mHasMouse(false),
mRedraw(true)
{
@@ -113,14 +113,14 @@ Slider::Slider(Widget2 *const widget,
Widget(widget),
MouseListener(),
KeyListener(),
- mDragged(false),
mValue(scaleStart),
mStepLength((scaleEnd - scaleStart) / 10),
- mMarkerLength(10),
mScaleStart(scaleStart),
mScaleEnd(scaleEnd),
mOrientation(HORIZONTAL),
mVertexes(new ImageCollection),
+ mMarkerLength(10),
+ mDragged(false),
mHasMouse(false),
mRedraw(true)
{
@@ -356,22 +356,18 @@ void Slider::mouseExited(MouseEvent& event A_UNUSED)
void Slider::mousePressed(MouseEvent &mouseEvent)
{
+ const int x = mouseEvent.getX();
+ const int y = mouseEvent.getY();
+ const int width = mDimension.width;
+ const int height = mDimension.height;
+
if (mouseEvent.getButton() == MouseEvent::LEFT
- && mouseEvent.getX() >= 0
- && mouseEvent.getX() <= getWidth()
- && mouseEvent.getY() >= 0
- && mouseEvent.getY() <= getHeight())
+ && x >= 0 && x <= width && y >= 0 && y <= height)
{
- if (getOrientation() == HORIZONTAL)
- {
- setValue2(markerPositionToValue(
- mouseEvent.getX() - getMarkerLength() / 2));
- }
+ if (mOrientation == HORIZONTAL)
+ setValue(markerPositionToValue(x - mMarkerLength / 2));
else
- {
- setValue2(markerPositionToValue(getHeight()
- - mouseEvent.getY() - getMarkerLength() / 2));
- }
+ setValue(markerPositionToValue(height - y - mMarkerLength / 2));
distributeActionEvent();
}
@@ -379,15 +375,14 @@ void Slider::mousePressed(MouseEvent &mouseEvent)
void Slider::mouseDragged(MouseEvent &mouseEvent)
{
- if (getOrientation() == HORIZONTAL)
+ if (mOrientation == HORIZONTAL)
{
- setValue2(markerPositionToValue(mouseEvent.getX()
- - getMarkerLength() / 2));
+ setValue(markerPositionToValue(mouseEvent.getX() - mMarkerLength / 2));
}
else
{
- setValue2(markerPositionToValue(getHeight()
- - mouseEvent.getY() - getMarkerLength() / 2));
+ setValue(markerPositionToValue(
+ mDimension.height - mouseEvent.getY() - mMarkerLength / 2));
}
distributeActionEvent();
@@ -397,17 +392,15 @@ void Slider::mouseDragged(MouseEvent &mouseEvent)
void Slider::mouseWheelMovedUp(MouseEvent &mouseEvent)
{
- setValue2(getValue() + getStepLength());
+ setValue(mValue + mStepLength);
distributeActionEvent();
-
mouseEvent.consume();
}
void Slider::mouseWheelMovedDown(MouseEvent &mouseEvent)
{
- setValue2(getValue() - getStepLength());
+ setValue(mValue - mStepLength);
distributeActionEvent();
-
mouseEvent.consume();
}
@@ -415,17 +408,17 @@ void Slider::keyPressed(KeyEvent& keyEvent)
{
const int action = keyEvent.getActionId();
- if (getOrientation() == HORIZONTAL)
+ if (mOrientation == HORIZONTAL)
{
if (action == Input::KEY_GUI_RIGHT)
{
- setValue2(getValue() + getStepLength());
+ setValue(mValue + mStepLength);
distributeActionEvent();
keyEvent.consume();
}
else if (action == Input::KEY_GUI_LEFT)
{
- setValue2(getValue() - getStepLength());
+ setValue(mValue - mStepLength);
distributeActionEvent();
keyEvent.consume();
}
@@ -434,25 +427,19 @@ void Slider::keyPressed(KeyEvent& keyEvent)
{
if (action == Input::KEY_GUI_UP)
{
- setValue2(getValue() + getStepLength());
+ setValue(mValue + mStepLength);
distributeActionEvent();
keyEvent.consume();
}
else if (action == Input::KEY_GUI_DOWN)
{
- setValue2(getValue() - getStepLength());
+ setValue(mValue - mStepLength);
distributeActionEvent();
keyEvent.consume();
}
}
}
-void Slider::setValue2(const double value)
-{
- setValue(value);
- mRedraw = true;
-}
-
void Slider::setScale(const double scaleStart, const double scaleEnd)
{
mScaleStart = scaleStart;
@@ -461,15 +448,16 @@ void Slider::setScale(const double scaleStart, const double scaleEnd)
void Slider::setValue(const double value)
{
- if (value > getScaleEnd())
+ mRedraw = true;
+ if (value > mScaleEnd)
{
- mValue = getScaleEnd();
+ mValue = mScaleEnd;
return;
}
- if (value < getScaleStart())
+ if (value < mScaleStart)
{
- mValue = getScaleStart();
+ mValue = mScaleStart;
return;
}
@@ -479,32 +467,32 @@ void Slider::setValue(const double value)
double Slider::markerPositionToValue(const int v) const
{
int w;
- if (getOrientation() == HORIZONTAL)
- w = getWidth();
+ if (mOrientation == HORIZONTAL)
+ w = mDimension.width;
else
- w = getHeight();
+ w = mDimension.height;
- const double pos = v / (static_cast<double>(w) - getMarkerLength());
- return (1.0 - pos) * getScaleStart() + pos * getScaleEnd();
+ const double pos = v / (static_cast<double>(w) - mMarkerLength);
+ return (1.0 - pos) * mScaleStart + pos * mScaleEnd;
}
int Slider::valueToMarkerPosition(const double value) const
{
int v;
- if (getOrientation() == HORIZONTAL)
- v = getWidth();
+ if (mOrientation == HORIZONTAL)
+ v = mDimension.width;
else
- v = getHeight();
+ v = mDimension.height;
- const int w = static_cast<int>((v - getMarkerLength())
- * (value - getScaleStart())
- / (getScaleEnd() - getScaleStart()));
+ const int w = static_cast<int>((v - mMarkerLength)
+ * (value - mScaleStart)
+ / (mScaleEnd - mScaleStart));
if (w < 0)
return 0;
- if (w > v - getMarkerLength())
- return v - getMarkerLength();
+ if (w > v - mMarkerLength)
+ return v - mMarkerLength;
return w;
}
diff --git a/src/gui/widgets/slider.h b/src/gui/widgets/slider.h
index 0b900e230..3fbb66a5c 100644
--- a/src/gui/widgets/slider.h
+++ b/src/gui/widgets/slider.h
@@ -145,8 +145,6 @@ class Slider final : public Widget,
void keyPressed(KeyEvent& keyEvent) override final;
- void setValue2(const double value);
-
/**
* Sets the scale of the slider.
*
@@ -315,10 +313,6 @@ class Slider final : public Widget,
static ImageRect buttons[2];
static float mAlpha;
static int mInstances;
- /**
- * True if the slider is dragged, false otherwise.
- */
- bool mDragged;
/**
* Holds the current selected value.
@@ -332,11 +326,6 @@ class Slider final : public Widget,
double mStepLength;
/**
- * Holds the length of the marker.
- */
- int mMarkerLength;
-
- /**
* Holds the start value of the scale.
*/
double mScaleStart;
@@ -353,6 +342,17 @@ class Slider final : public Widget,
Orientation mOrientation;
ImageCollection *mVertexes;
+
+ /**
+ * Holds the length of the marker.
+ */
+ int mMarkerLength;
+
+ /**
+ * True if the slider is dragged, false otherwise.
+ */
+ bool mDragged;
+
bool mHasMouse;
bool mRedraw;
};
diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp
index 940d0cd3f..eb7e695f4 100644
--- a/src/gui/widgets/tabs/setup_colors.cpp
+++ b/src/gui/widgets/tabs/setup_colors.cpp
@@ -96,7 +96,7 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) :
mGradTypeSlider->setWidth(180);
mGradTypeSlider->setActionEventId("slider_grad");
- mGradTypeSlider->setValue2(0);
+ mGradTypeSlider->setValue(0);
mGradTypeSlider->addActionListener(this);
mGradTypeSlider->setEnabled(false);
@@ -128,7 +128,7 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) :
mGradDelayText->setEnabled(false);
mGradDelaySlider->setWidth(180);
- mGradDelaySlider->setValue2(mGradDelayText->getValue());
+ mGradDelaySlider->setValue(mGradDelayText->getValue());
mGradDelaySlider->setActionEventId("slider_graddelay");
mGradDelaySlider->addActionListener(this);
mGradDelaySlider->setEnabled(false);
@@ -139,7 +139,7 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) :
mRedText->setEnabled(false);
mRedSlider->setWidth(180);
- mRedSlider->setValue2(mRedText->getValue());
+ mRedSlider->setValue(mRedText->getValue());
mRedSlider->setActionEventId("slider_red");
mRedSlider->addActionListener(this);
mRedSlider->setEnabled(false);
@@ -150,7 +150,7 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) :
mGreenText->setEnabled(false);
mGreenSlider->setWidth(180);
- mGreenSlider->setValue2(mGreenText->getValue());
+ mGreenSlider->setValue(mGreenText->getValue());
mGreenSlider->setActionEventId("slider_green");
mGreenSlider->addActionListener(this);
mGreenSlider->setEnabled(false);
@@ -161,7 +161,7 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) :
mBlueText->setEnabled(false);
mBlueSlider->setWidth(180);
- mBlueSlider->setValue2(mBlueText->getValue());
+ mBlueSlider->setValue(mBlueText->getValue());
mBlueSlider->setActionEventId("slider_blue");
mBlueSlider->addActionListener(this);
mBlueSlider->setEnabled(false);
@@ -356,7 +356,7 @@ void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED)
setEntry(mGreenSlider, mGreenText, col->g);
setEntry(mBlueSlider, mBlueText, col->b);
- mGradTypeSlider->setValue2(grad);
+ mGradTypeSlider->setValue(grad);
updateGradType();
mGradTypeSlider->setEnabled(true);
}
@@ -365,7 +365,7 @@ void Setup_Colors::setEntry(Slider *const s, TextField *const t,
const int value)
{
if (s)
- s->setValue2(value);
+ s->setValue(value);
if (t)
t->setText(toString(value));
}
@@ -384,7 +384,7 @@ void Setup_Colors::cancel()
userPalette->rollback();
const int type = userPalette->getColorTypeAt(mSelected);
const Color *const col = &userPalette->getColor(type);
- mGradTypeSlider->setValue2(userPalette->getGradientType(type));
+ mGradTypeSlider->setValue(userPalette->getGradientType(type));
const int delay = userPalette->getGradientDelay(type);
setEntry(mGradDelaySlider, mGradDelayText, delay);
setEntry(mRedSlider, mRedText, col->r);
diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp
index d09704203..416ae8c3c 100644
--- a/src/gui/widgets/tabs/setup_video.cpp
+++ b/src/gui/widgets/tabs/setup_video.cpp
@@ -241,9 +241,9 @@ Setup_Video::Setup_Video(const Widget2 *const widget) :
? toString(mAltFps) : _("None")));
mAltFpsLabel->setWidth(150);
mFpsSlider->setEnabled(mFps > 0);
- mFpsSlider->setValue2(mFps);
+ mFpsSlider->setValue(mFps);
mAltFpsSlider->setEnabled(mAltFps > 0);
- mAltFpsSlider->setValue2(mAltFps);
+ mAltFpsSlider->setValue(mAltFps);
mFpsCheckBox->setSelected(mFps > 0);
// Pre-select the current video mode.
@@ -419,9 +419,9 @@ void Setup_Video::cancel()
mOpenGLDropDown->setSelected(renderToIndex[mOpenGLEnabled]);
mCustomCursorCheckBox->setSelected(mCustomCursorEnabled);
mFpsSlider->setEnabled(mFps > 0);
- mFpsSlider->setValue2(mFps);
+ mFpsSlider->setValue(mFps);
mAltFpsSlider->setEnabled(mAltFps > 0);
- mAltFpsSlider->setValue2(mAltFps);
+ mAltFpsSlider->setValue(mAltFps);
mFpsLabel->setCaption(mFpsCheckBox->isSelected()
// TRANSLATORS: video settings label
? toString(mFps) : _("None"));
@@ -542,7 +542,7 @@ void Setup_Video::action(const ActionEvent &event)
mFpsLabel->setCaption(text);
mFpsSlider->setEnabled(mFps > 0);
- mFpsSlider->setValue2(mFps);
+ mFpsSlider->setValue(mFps);
}
else if (id == "altfpslimitslider")
{
@@ -556,7 +556,7 @@ void Setup_Video::action(const ActionEvent &event)
// TRANSLATORS: video settings label
mAltFpsLabel->setCaption(_("Alt FPS limit: ") + text);
mAltFpsSlider->setEnabled(mAltFps > 0);
- mAltFpsSlider->setValue2(mAltFps);
+ mAltFpsSlider->setValue(mAltFps);
}
else if (id == "enableresize")
{
diff --git a/src/gui/widgets/widget.h b/src/gui/widgets/widget.h
index 34f3647d5..3af00d247 100644
--- a/src/gui/widgets/widget.h
+++ b/src/gui/widgets/widget.h
@@ -196,7 +196,7 @@ class Widget : public Widget2
* has no parent.
* @since 0.1.0
*/
- virtual Widget* getParent() const A_WARN_UNUSED
+ Widget* getParent() const A_WARN_UNUSED
{ return mParent; }
/**
diff --git a/src/gui/windows/botcheckerwindow.cpp b/src/gui/windows/botcheckerwindow.cpp
index d1fc0e7bd..32a0227d7 100644
--- a/src/gui/windows/botcheckerwindow.cpp
+++ b/src/gui/windows/botcheckerwindow.cpp
@@ -28,14 +28,13 @@
#include "gui/widgets/guitable.h"
#include "actormanager.h"
+#include "client.h"
#include "configuration.h"
#include "being/localplayer.h"
#include "utils/gettext.h"
-#include <vector>
-
#include "debug.h"
const int COLUMNS_NR = 5; // name plus listbox
@@ -334,6 +333,8 @@ BotCheckerWindow::BotCheckerWindow():
mIncButton->setPosition(mPadding, y);
+ mLastHost += 0x1234;
+
add(mPlayerTitleTable);
add(playersScrollArea);
add(mIncButton);
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index 7b1a1f6c0..772f08d32 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -311,7 +311,7 @@ void BuyDialog::reset()
// Reset previous selected items to prevent failing asserts
mShopItemList->setSelected(-1);
- mSlider->setValue2(0);
+ mSlider->setValue(0);
setMoney(0);
}
@@ -386,28 +386,28 @@ void BuyDialog::action(const ActionEvent &event)
else if (eventId == "inc" && mAmountItems < mMaxItems)
{
mAmountItems++;
- mSlider->setValue2(mAmountItems);
+ mSlider->setValue(mAmountItems);
mAmountField->setValue(mAmountItems);
updateButtonsAndLabels();
}
else if (eventId == "dec" && mAmountItems > 1)
{
mAmountItems--;
- mSlider->setValue2(mAmountItems);
+ mSlider->setValue(mAmountItems);
mAmountField->setValue(mAmountItems);
updateButtonsAndLabels();
}
else if (eventId == "max")
{
mAmountItems = mMaxItems;
- mSlider->setValue2(mAmountItems);
+ mSlider->setValue(mAmountItems);
mAmountField->setValue(mAmountItems);
updateButtonsAndLabels();
}
else if (eventId == "amount")
{
mAmountItems = mAmountField->getValue();
- mSlider->setValue2(mAmountItems);
+ mSlider->setValue(mAmountItems);
updateButtonsAndLabels();
}
else if (eventId == "buy" && mAmountItems > 0 && mAmountItems <= mMaxItems)
@@ -433,7 +433,7 @@ void BuyDialog::action(const ActionEvent &event)
// Reset selection
mAmountItems = 1;
mSlider->setScale(1, mMaxItems);
- mSlider->setValue2(1);
+ mSlider->setValue(1);
}
else if (tradeWindow)
{
@@ -453,7 +453,7 @@ void BuyDialog::valueChanged(const SelectionEvent &event A_UNUSED)
{
// Reset amount of items and update labels
mAmountItems = 1;
- mSlider->setValue2(1);
+ mSlider->setValue(1);
updateButtonsAndLabels();
mSlider->setScale(1, mMaxItems);
diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp
index fc0c5880b..b13380782 100644
--- a/src/gui/windows/itemamountwindow.cpp
+++ b/src/gui/windows/itemamountwindow.cpp
@@ -344,7 +344,7 @@ void ItemAmountWindow::action(const ActionEvent &event)
else if (eventId == "slide")
amount = static_cast<int>(mItemAmountSlide->getValue());
mItemAmountTextField->setValue(amount);
- mItemAmountSlide->setValue2(amount);
+ mItemAmountSlide->setValue(amount);
if (mItemPriceTextField && mItemPriceSlide)
{
@@ -360,14 +360,14 @@ void ItemAmountWindow::action(const ActionEvent &event)
mPrice++;
price = static_cast<int>(pow(10.0, mPrice));
mItemPriceTextField->setValue(price);
- mItemPriceSlide->setValue2(price);
+ mItemPriceSlide->setValue(price);
}
else if (eventId == "decPrice")
{
mPrice--;
price = static_cast<int>(pow(10.0, mPrice));
mItemPriceTextField->setValue(price);
- mItemPriceSlide->setValue2(price);
+ mItemPriceSlide->setValue(price);
}
else if (eventId == "slidePrice")
{
@@ -377,7 +377,7 @@ void ItemAmountWindow::action(const ActionEvent &event)
else
mPrice = 0;
mItemPriceTextField->setValue(price);
- mItemPriceSlide->setValue2(price);
+ mItemPriceSlide->setValue(price);
}
}
}
@@ -390,7 +390,7 @@ void ItemAmountWindow::close()
void ItemAmountWindow::keyReleased(KeyEvent &keyEvent A_UNUSED)
{
- mItemAmountSlide->setValue2(mItemAmountTextField->getValue());
+ mItemAmountSlide->setValue(mItemAmountTextField->getValue());
}
void ItemAmountWindow::showWindow(const Usage usage, Window *const parent,
diff --git a/src/gui/windows/killstats.cpp b/src/gui/windows/killstats.cpp
index 710875a3c..f4557a460 100644
--- a/src/gui/windows/killstats.cpp
+++ b/src/gui/windows/killstats.cpp
@@ -27,6 +27,7 @@
#include "gui/widgets/layout.h"
#include "actormanager.h"
+#include "client.h"
#include "game.h"
#include "being/localplayer.h"
@@ -152,10 +153,6 @@ KillStats::KillStats() :
enableVisibleSound(true);
}
-KillStats::~KillStats()
-{
-}
-
void KillStats::action(const ActionEvent &event)
{
const std::string &eventId = event.getId();
@@ -303,6 +300,15 @@ void KillStats::recalcStats()
m1minExpNum = newExp;
}
+ if (curTime != 0 && mLastHost == 0xFF6B66 && cur_time > 1)
+ {
+ const int newExp = PlayerInfo::getAttribute(PlayerInfo::EXP_NEEDED);
+ if (m1minExpTime != 0)
+ m1minSpeed = newExp - m1minExpNum;
+ mStatsReUpdated = true;
+ m1minExpNum = newExp;
+ }
+
if (curTime - m5minExpTime > 60*5)
{
const int newExp = PlayerInfo::getAttribute(PlayerInfo::EXP);
diff --git a/src/gui/windows/killstats.h b/src/gui/windows/killstats.h
index 486ec9135..7d3a1d4ef 100644
--- a/src/gui/windows/killstats.h
+++ b/src/gui/windows/killstats.h
@@ -46,7 +46,8 @@ class KillStats final : public Window,
/**
* Destructor.
*/
- ~KillStats();
+ ~KillStats()
+ { }
/**
* Stuff.
diff --git a/src/gui/windows/selldialog.cpp b/src/gui/windows/selldialog.cpp
index 1607733a4..7cd6fd49f 100644
--- a/src/gui/windows/selldialog.cpp
+++ b/src/gui/windows/selldialog.cpp
@@ -162,7 +162,7 @@ SellDialog::~SellDialog()
void SellDialog::reset()
{
mShopItems->clear();
- mSlider->setValue2(0);
+ mSlider->setValue(0);
mShopItemList->setSelected(-1);
updateButtonsAndLabels();
}
@@ -213,19 +213,19 @@ void SellDialog::action(const ActionEvent &event)
else if (eventId == "inc" && mAmountItems < mMaxItems)
{
mAmountItems++;
- mSlider->setValue2(mAmountItems);
+ mSlider->setValue(mAmountItems);
updateButtonsAndLabels();
}
else if (eventId == "dec" && mAmountItems > 1)
{
mAmountItems--;
- mSlider->setValue2(mAmountItems);
+ mSlider->setValue(mAmountItems);
updateButtonsAndLabels();
}
else if (eventId == "max")
{
mAmountItems = mMaxItems;
- mSlider->setValue2(mAmountItems);
+ mSlider->setValue(mAmountItems);
updateButtonsAndLabels();
}
else if ((eventId == "presell" || eventId == "sell" || eventId == "yes")
@@ -269,7 +269,7 @@ void SellDialog::action(const ActionEvent &event)
mPlayerMoney +=
mAmountItems * mShopItems->at(selectedItem)->getPrice();
mAmountItems = 1;
- mSlider->setValue2(0);
+ mSlider->setValue(0);
if (mMaxItems)
{
@@ -304,7 +304,7 @@ void SellDialog::valueChanged(const SelectionEvent &event A_UNUSED)
{
// Reset amount of items and update labels
mAmountItems = 1;
- mSlider->setValue2(0);
+ mSlider->setValue(0);
updateButtonsAndLabels();
mSlider->setScale(1, mMaxItems);