Merge branch 'master' into jgrpp

# Conflicts:
#	src/bridge_map.h
#	src/crashlog.cpp
#	src/industry.h
#	src/linkgraph/linkgraph_type.h
#	src/order_type.h
#	src/saveload/afterload.cpp
#	src/settings.cpp
#	src/settings_type.h
#	src/smallmap_gui.cpp
#	src/spritecache.cpp
#	src/stdafx.h
#	src/table/settings.h.preamble
#	src/train.h
#	src/vehicle.cpp
#	src/viewport.cpp
#	src/viewport_func.h
#	src/widgets/station_widget.h
#	src/zoom_func.h
#	src/zoom_type.h
This commit is contained in:
Jonathan G Rennison
2019-07-08 16:19:07 +01:00
136 changed files with 706 additions and 501 deletions

View File

@@ -2038,7 +2038,7 @@ bool AfterLoadGame()
if (IsBuoyTile(t) || IsDriveThroughStopTile(t) || IsTileType(t, MP_WATER)) {
Owner o = GetTileOwner(t);
if (o < MAX_COMPANIES && !Company::IsValidID(o)) {
Backup<CompanyByte> cur_company(_current_company, o, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, o, FILE_LINE);
ChangeTileOwner(t, o, INVALID_OWNER);
cur_company.Restore();
}
@@ -2339,7 +2339,7 @@ bool AfterLoadGame()
_settings_game.economy.town_layout = TL_BETTER_ROADS;
} else {
_settings_game.economy.allow_town_roads = true;
_settings_game.economy.town_layout = _settings_game.economy.town_layout - 1;
_settings_game.economy.town_layout = static_cast<TownLayout>(_settings_game.economy.town_layout - 1);
}
/* Initialize layout of all towns. Older versions were using different
@@ -2358,7 +2358,7 @@ bool AfterLoadGame()
case 5: layout = 1; break;
case 0: layout = 2; break;
}
t->layout = layout - 1;
t->layout = static_cast<TownLayout>(layout - 1);
}
}
@@ -3083,7 +3083,7 @@ bool AfterLoadGame()
if (IsSavegameVersionBefore(SLV_165)) {
/* Adjust zoom level to account for new levels */
_saved_scrollpos_zoom = _saved_scrollpos_zoom + ZOOM_LVL_SHIFT;
_saved_scrollpos_zoom = static_cast<ZoomLevel>(_saved_scrollpos_zoom + ZOOM_LVL_SHIFT);
_saved_scrollpos_x *= ZOOM_LVL_BASE;
_saved_scrollpos_y *= ZOOM_LVL_BASE;
}

View File

@@ -31,7 +31,7 @@ extern byte _trees_tick_ctr;
/* Keep track of current game position */
int _saved_scrollpos_x;
int _saved_scrollpos_y;
ZoomLevelByte _saved_scrollpos_zoom;
ZoomLevel _saved_scrollpos_zoom;
void SaveViewportBeforeSaveGame()
{

View File

@@ -315,7 +315,7 @@ bool LoadOldSaveGame(const char *file)
return false;
}
_pause_mode = 2;
_pause_mode = PM_PAUSED_SAVELOAD;
return true;
}

View File

@@ -1276,7 +1276,8 @@ bool LoadOldVehicle(LoadgameState *ls, int num)
};
if (v->spritenum / 2 >= lengthof(spriteset_rail)) return false;
v->spritenum = spriteset_rail[v->spritenum / 2]; // adjust railway sprite set offset
Train::From(v)->railtype = type == 0x25 ? 1 : 0; // monorail / rail
/* Should be the original values for monorail / rail, can't use RailType constants */
Train::From(v)->railtype = static_cast<RailType>(type == 0x25 ? 1 : 0);
break;
}

View File

@@ -3169,36 +3169,3 @@ void FileToSaveLoad::SetTitle(const char *title)
{
strecpy(this->title, title, lastof(this->title));
}
#if 0
/**
* Function to get the type of the savegame by looking at the file header.
* NOTICE: Not used right now, but could be used if extensions of savegames are garbled
* @param file Savegame to be checked
* @return SL_OLD_LOAD or SL_LOAD of the file
*/
int GetSavegameType(char *file)
{
const SaveLoadFormat *fmt;
uint32 hdr;
FILE *f;
int mode = SL_OLD_LOAD;
f = fopen(file, "rb");
if (fread(&hdr, sizeof(hdr), 1, f) != 1) {
DEBUG(sl, 0, "Savegame is obsolete or invalid format");
mode = SL_LOAD; // don't try to get filename, just show name as it is written
} else {
/* see if we have any loader for this type. */
for (fmt = _saveload_formats; fmt != endof(_saveload_formats); fmt++) {
if (fmt->tag == hdr) {
mode = SL_LOAD; // new type of savegame
break;
}
}
}
fclose(f);
return mode;
}
#endif

View File

@@ -53,7 +53,7 @@ void AfterLoadTemplateVehiclesUpdateImage();
extern int32 _saved_scrollpos_x;
extern int32 _saved_scrollpos_y;
extern ZoomLevelByte _saved_scrollpos_zoom;
extern ZoomLevel _saved_scrollpos_zoom;
extern SavegameType _savegame_type;
extern uint32 _ttdp_version;

View File

@@ -120,7 +120,7 @@ void AfterLoadTemplateVehiclesUpdateImage()
FOR_ALL_TEMPLATES(tv) {
if (tv->Prev() == nullptr) {
Backup<CompanyByte> cur_company(_current_company, tv->owner, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, tv->owner, FILE_LINE);
StringID err;
Train* t = VirtualTrainFromTemplateVehicle(tv, err);
if (t != nullptr) {

View File

@@ -36,7 +36,7 @@ struct OldWaypoint {
uint8 localidx;
uint32 grfid;
const StationSpec *spec;
OwnerByte owner;
Owner owner;
size_t new_index;
};