summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-11-30 11:29:52 +0000
committerrubidium <rubidium@openttd.org>2009-11-30 11:29:52 +0000
commit5a41a646c2f62bbd3480f5714232f9e2e48ae75c (patch)
tree3d9752635989778475d604972cc7abb06df8d7a3 /src
parent9ecfcdff78d68da1ccfc97236a64079d1c4c0eac (diff)
downloadopenttd-5a41a646c2f62bbd3480f5714232f9e2e48ae75c.tar.xz
(svn r18351) -Fix [FS#3333]: endianness issue with saving the zoom level
Diffstat (limited to 'src')
-rw-r--r--src/saveload/misc_sl.cpp3
-rw-r--r--src/saveload/saveload_internal.h1
-rw-r--r--src/viewport.cpp1
-rw-r--r--src/zoom_func.h2
-rw-r--r--src/zoom_type.h2
5 files changed, 5 insertions, 4 deletions
diff --git a/src/saveload/misc_sl.cpp b/src/saveload/misc_sl.cpp
index 052c63360..b6a4c5b9b 100644
--- a/src/saveload/misc_sl.cpp
+++ b/src/saveload/misc_sl.cpp
@@ -29,6 +29,7 @@ extern TileIndex _cur_tileloop_tile;
/* Keep track of current game position */
int _saved_scrollpos_x;
int _saved_scrollpos_y;
+ZoomLevelByte _saved_scrollpos_zoom;
void SaveViewportBeforeSaveGame()
{
@@ -51,7 +52,7 @@ void ResetViewportAfterLoadGame()
w->viewport->dest_scrollpos_y = _saved_scrollpos_y;
ViewPort *vp = w->viewport;
- vp->zoom = min(_saved_scrollpos_zoom, ZOOM_LVL_MAX);
+ vp->zoom = min<ZoomLevel>(_saved_scrollpos_zoom, ZOOM_LVL_MAX);
vp->virtual_width = ScaleByZoom(vp->width, vp->zoom);
vp->virtual_height = ScaleByZoom(vp->height, vp->zoom);
diff --git a/src/saveload/saveload_internal.h b/src/saveload/saveload_internal.h
index 6e7a6e1d7..03912c673 100644
--- a/src/saveload/saveload_internal.h
+++ b/src/saveload/saveload_internal.h
@@ -45,6 +45,7 @@ void CopyTempEngineData();
extern int32 _saved_scrollpos_x;
extern int32 _saved_scrollpos_y;
+extern ZoomLevelByte _saved_scrollpos_zoom;
extern SavegameType _savegame_type;
extern uint32 _ttdp_version;
diff --git a/src/viewport.cpp b/src/viewport.cpp
index 4f8c1c1e8..1ad38c837 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -53,7 +53,6 @@
PlaceProc *_place_proc;
Point _tile_fract_coords;
-ZoomLevel _saved_scrollpos_zoom;
struct StringSpriteToDraw {
StringID string;
diff --git a/src/zoom_func.h b/src/zoom_func.h
index 180e15f6c..aa4bf3d69 100644
--- a/src/zoom_func.h
+++ b/src/zoom_func.h
@@ -14,8 +14,6 @@
#include "zoom_type.h"
-extern ZoomLevel _saved_scrollpos_zoom;
-
/**
* Scale by zoom level, usually shift left (when zoom > ZOOM_LVL_NORMAL)
* When shifting right, value is rounded up
diff --git a/src/zoom_type.h b/src/zoom_type.h
index a474a913b..e2698ae48 100644
--- a/src/zoom_type.h
+++ b/src/zoom_type.h
@@ -44,4 +44,6 @@ enum ZoomLevel {
};
DECLARE_POSTFIX_INCREMENT(ZoomLevel)
+typedef SimpleTinyEnumT<ZoomLevel, byte> ZoomLevelByte;
+
#endif /* ZOOM_TYPE_H */