|
@@ -1083,26 +1083,26 @@ static void DoAutosave()
|
|
|
DEBUG(sl, 2, "Autosaving to '%s'", buf);
|
|
|
if (SaveOrLoad(buf, SL_SAVE, AUTOSAVE_DIR) != SL_OK) {
|
|
|
ShowErrorMessage(INVALID_STRING_ID, STR_AUTOSAVE_FAILED, 0, 0);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
static void ScrollMainViewport(int x, int y)
|
|
|
{
|
|
|
if (_game_mode != GM_MENU) {
|
|
|
Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
|
|
|
assert(w);
|
|
|
|
|
|
WP(w, vp_d).dest_scrollpos_x += ScaleByZoom(x, w->viewport->zoom);
|
|
|
WP(w, vp_d).dest_scrollpos_y += ScaleByZoom(y, w->viewport->zoom);
|
|
|
w->viewport->dest_scrollpos_x += ScaleByZoom(x, w->viewport->zoom);
|
|
|
w->viewport->dest_scrollpos_y += ScaleByZoom(y, w->viewport->zoom);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Describes all the different arrow key combinations the game allows
|
|
|
* when it is in scrolling mode.
|
|
|
* The real arrow keys are bitwise numbered as
|
|
|
* 1 = left
|
|
|
* 2 = up
|
|
|
* 4 = right
|
|
|
* 8 = down
|
|
|
*/
|
|
@@ -1194,26 +1194,26 @@ void GameLoop()
|
|
|
if (!_pause_game || _cheats.build_in_pause.value) MoveAllTextEffects();
|
|
|
|
|
|
InputLoop();
|
|
|
|
|
|
MusicLoop();
|
|
|
}
|
|
|
|
|
|
void BeforeSaveGame()
|
|
|
{
|
|
|
const Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
|
|
|
|
|
|
if (w != NULL) {
|
|
|
_saved_scrollpos_x = WP(w, const vp_d).scrollpos_x;
|
|
|
_saved_scrollpos_y = WP(w, const vp_d).scrollpos_y;
|
|
|
_saved_scrollpos_x = w->viewport->scrollpos_x;
|
|
|
_saved_scrollpos_y = w->viewport->scrollpos_y;
|
|
|
_saved_scrollpos_zoom = w->viewport->zoom;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
static void ConvertTownOwner()
|
|
|
{
|
|
|
for (TileIndex tile = 0; tile != MapSize(); tile++) {
|
|
|
switch (GetTileType(tile)) {
|
|
|
case MP_ROAD:
|
|
|
if (GB(_m[tile].m5, 4, 2) == ROAD_TILE_CROSSING && HasBit(_m[tile].m4, 7)) {
|
|
|
_m[tile].m4 = OWNER_TOWN;
|
|
|
}
|
|
@@ -1307,28 +1307,28 @@ static inline RailType UpdateRailType(Ra
|
|
|
* Moving this out of there is both cleaner and less bug-prone.
|
|
|
*
|
|
|
* @return true if everything went according to plan, otherwise false.
|
|
|
*/
|
|
|
static bool InitializeWindowsAndCaches()
|
|
|
{
|
|
|
/* Initialize windows */
|
|
|
ResetWindowSystem();
|
|
|
SetupColorsAndInitialWindow();
|
|
|
|
|
|
Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
|
|
|
|
|
|
WP(w, vp_d).scrollpos_x = _saved_scrollpos_x;
|
|
|
WP(w, vp_d).scrollpos_y = _saved_scrollpos_y;
|
|
|
WP(w, vp_d).dest_scrollpos_x = _saved_scrollpos_x;
|
|
|
WP(w, vp_d).dest_scrollpos_y = _saved_scrollpos_y;
|
|
|
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->virtual_width = ScaleByZoom(vp->width, vp->zoom);
|
|
|
vp->virtual_height = ScaleByZoom(vp->height, vp->zoom);
|
|
|
|
|
|
DoZoomInOutWindow(ZOOM_NONE, w); // update button status
|
|
|
MarkWholeScreenDirty();
|
|
|
|
|
|
/* Update coordinates of the signs. */
|
|
|
UpdateAllStationVirtCoord();
|
|
|
UpdateAllSignVirtCoords();
|