fix default zoom

This commit is contained in:
András Salamon 2006-01-10 13:00:30 +00:00
parent 7865126cfe
commit 4be493a139
2 changed files with 10 additions and 2 deletions

View file

@ -5,7 +5,7 @@ SVN trunk (1.1+svn):
* text cleanup in intro
* replaced Sea Orc with Naga Fighter in Final Spring, Clearwater Port, and
Rise of Wesnoth
* migrated unique units, scenarios, maps, and images to ./data/campaigns folder
* migrated unique units, scenarios, maps, and images to data/campaigns
* campaign server
* changed default port for campaign server to 15003 to separate 1.1 and 1.0
* language and i18n:
@ -26,6 +26,7 @@ SVN trunk (1.1+svn):
allowed)
* fix menu capitalization consistency (#4972)
* reduce scrolling during unit movement
* make default zoom work properly
* WML improvements
* game is not limited to melee and ranged attacks anymore, retaliation will
use any attack of the same range. Official name for current ranges are

View file

@ -493,7 +493,14 @@ int display::hex_width() const
double display::zoom(int amount)
{
int new_zoom = zoom_ + amount;
if (amount != 0 && team_valid() && new_zoom >= MinZoom(map_, map_area()) && new_zoom <= MaxZoom) {
const int min_zoom = MinZoom(map_, map_area());
if (new_zoom < min_zoom) {
new_zoom = min_zoom;
}
if (new_zoom > MaxZoom) {
new_zoom = MaxZoom;
}
if (new_zoom != zoom_ && team_valid()) {
SDL_Rect const &area = map_area();
xpos_ += (xpos_ + area.w / 2) * amount / zoom_;
ypos_ += (ypos_ + area.h / 2) * amount / zoom_;