Resizing the MP lobby no longer crashes randomly.

The problem occured if the number of visible items was larger as the
number of items.
This commit is contained in:
Mark de Wever 2009-12-05 21:05:49 +00:00
parent 3ed60d9445
commit 32f23eda2e
4 changed files with 10 additions and 3 deletions

View file

@ -13,7 +13,9 @@ The release team should empty this file after each release.
***
REPLACE ME WITH CONTENT...
The random crashes when resizing the MP lobby should now be fixed (they also
sometimes occurred at random when in the lobby due to new games/players).
Please report if you still run into these crashes.
***

View file

@ -4,6 +4,7 @@ Version 1.7.9+svn:
* User interface:
* Don't reserve space for scrollbars in message dialogs
* Ctrl-f for fullscreen works again in the MP lobby (bug #14759)
* Resizing the MP lobby no longer crashes randomly
* WML Engine:
* Fix bug #14859: [time_area] created by event are not saved
* Miscellaneous and bugfixes:

View file

@ -9,6 +9,7 @@ Version 1.7.9+svn:
* User interface:
* Don't reserve space for scrollbars in message dialogs.
* Ctrl-f for fullscreen works again in the MP lobby.
* Resizing the MP lobby no longer crashes randomly
* Units
* Decreased the speed of the dwarvish scout line by one.

View file

@ -112,8 +112,9 @@ void tscrollbar_::set_size(const tpoint& origin, const tpoint& size)
void tscrollbar_::set_item_position(const unsigned item_position)
{
// Set the value always execute since we update a part of the state.
item_position_ = item_position + visible_items_ > item_count_ ?
item_count_ - visible_items_ : item_position;
item_position_ = item_position > item_count_ - visible_items_
? item_count_ - visible_items_
: item_position;
item_position_ = (item_position_ + step_size_ - 1) / step_size_;
@ -121,6 +122,8 @@ void tscrollbar_::set_item_position(const unsigned item_position)
positioner_offset_ = static_cast<unsigned>(item_position_ * pixels_per_step_);
update_canvas();
assert(item_position_ <= item_count_ - visible_items_);
}
void tscrollbar_::update_canvas() {