Changeset - r13815:8cc0cdaaf624
[Not reviewed]
master
0 5 0
rubidium - 15 years ago 2009-11-30 11:29:52
rubidium@openttd.org
(svn r18351) -Fix [FS#3333]: endianness issue with saving the zoom level
5 files changed with 5 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/saveload/misc_sl.cpp
Show inline comments
 
@@ -26,12 +26,13 @@
 

	
 
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()
 
{
 
	const Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
 

	
 
	if (w != NULL) {
 
@@ -48,13 +49,13 @@ void ResetViewportAfterLoadGame()
 
	w->viewport->scrollpos_x = _saved_scrollpos_x;
 
	w->viewport->scrollpos_y = _saved_scrollpos_y;
 
	w->viewport->dest_scrollpos_x = _saved_scrollpos_x;
 
	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);
 

	
 
	DoZoomInOutWindow(ZOOM_NONE, w); // update button status
 
	MarkWholeScreenDirty();
 
}
src/saveload/saveload_internal.h
Show inline comments
 
@@ -42,12 +42,13 @@ void ConnectMultiheadedTrains();
 

	
 
Engine *GetTempDataEngine(EngineID index);
 
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;
 

	
 
CompanyManagerFace ConvertFromOldCompanyManagerFace(uint32 face);
 

	
src/viewport.cpp
Show inline comments
 
@@ -50,13 +50,12 @@
 

	
 
#include "table/sprites.h"
 
#include "table/strings.h"
 

	
 
PlaceProc *_place_proc;
 
Point _tile_fract_coords;
 
ZoomLevel _saved_scrollpos_zoom;
 

	
 
struct StringSpriteToDraw {
 
	StringID string;
 
	Colours colour;
 
	int32 x;
 
	int32 y;
src/zoom_func.h
Show inline comments
 
@@ -11,14 +11,12 @@
 

	
 
#ifndef ZOOM_FUNC_H
 
#define ZOOM_FUNC_H
 

	
 
#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
 
 * @param value value to shift
 
 * @param zoom  zoom level to shift to
 
 * @return shifted value
src/zoom_type.h
Show inline comments
 
@@ -41,7 +41,9 @@ enum ZoomLevel {
 

	
 
	ZOOM_LVL_MIN      = ZOOM_LVL_NORMAL,
 
	ZOOM_LVL_MAX      = ZOOM_LVL_OUT_8X,
 
};
 
DECLARE_POSTFIX_INCREMENT(ZoomLevel)
 

	
 
typedef SimpleTinyEnumT<ZoomLevel, byte> ZoomLevelByte;
 

	
 
#endif /* ZOOM_TYPE_H */
0 comments (0 inline, 0 general)