Align field assignments in S6Importer.cpp

This commit is contained in:
Michał Janiszewski 2017-04-24 22:38:16 +02:00
parent ad7ecc0d85
commit ee7ad17a30
1 changed files with 84 additions and 84 deletions

View File

@ -1,4 +1,4 @@
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers #pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
/***************************************************************************** /*****************************************************************************
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2. * OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
* *
@ -24,8 +24,8 @@
#include "../network/network.h" #include "../network/network.h"
#include "../object/ObjectRepository.h" #include "../object/ObjectRepository.h"
#include "../ParkImporter.h" #include "../ParkImporter.h"
#include "../rct12/SawyerEncoding.h"
#include "../rct12/SawyerChunkReader.h" #include "../rct12/SawyerChunkReader.h"
#include "../rct12/SawyerEncoding.h"
extern "C" extern "C"
{ {
@ -177,10 +177,10 @@ public:
gS6Info = _s6.info; gS6Info = _s6.info;
gDateMonthsElapsed = _s6.elapsed_months; gDateMonthsElapsed = _s6.elapsed_months;
gDateMonthTicks = _s6.current_day; gDateMonthTicks = _s6.current_day;
gScenarioTicks = _s6.scenario_ticks; gScenarioTicks = _s6.scenario_ticks;
gScenarioSrand0 = _s6.scenario_srand_0; gScenarioSrand0 = _s6.scenario_srand_0;
gScenarioSrand1 = _s6.scenario_srand_1; gScenarioSrand1 = _s6.scenario_srand_1;
memcpy(gMapElements, _s6.map_elements, sizeof(_s6.map_elements)); memcpy(gMapElements, _s6.map_elements, sizeof(_s6.map_elements));
@ -192,22 +192,22 @@ public:
for (sint32 i = 0; i < NUM_SPRITE_LISTS; i++) for (sint32 i = 0; i < NUM_SPRITE_LISTS; i++)
{ {
gSpriteListHead[i] = _s6.sprite_lists_head[i]; gSpriteListHead[i] = _s6.sprite_lists_head[i];
gSpriteListCount[i] = _s6.sprite_lists_count[i]; gSpriteListCount[i] = _s6.sprite_lists_count[i];
} }
gParkName = _s6.park_name; gParkName = _s6.park_name;
// pad_013573D6 // pad_013573D6
gParkNameArgs = _s6.park_name_args; gParkNameArgs = _s6.park_name_args;
gInitialCash = _s6.initial_cash; gInitialCash = _s6.initial_cash;
gBankLoan = _s6.current_loan; gBankLoan = _s6.current_loan;
gParkFlags = _s6.park_flags; gParkFlags = _s6.park_flags;
gParkEntranceFee = _s6.park_entrance_fee; gParkEntranceFee = _s6.park_entrance_fee;
// rct1_park_entrance_x // rct1_park_entrance_x
// rct1_park_entrance_y // rct1_park_entrance_y
// pad_013573EE // pad_013573EE
// rct1_park_entrance_z // rct1_park_entrance_z
memcpy(gPeepSpawns, _s6.peep_spawns, sizeof(_s6.peep_spawns)); memcpy(gPeepSpawns, _s6.peep_spawns, sizeof(_s6.peep_spawns));
gGuestChangeModifier = _s6.guest_count_change_modifier; gGuestChangeModifier = _s6.guest_count_change_modifier;
gResearchFundingLevel = _s6.current_research_level; gResearchFundingLevel = _s6.current_research_level;
// pad_01357400 // pad_01357400
memcpy(gResearchedRideTypes, _s6.researched_ride_types, sizeof(_s6.researched_ride_types)); memcpy(gResearchedRideTypes, _s6.researched_ride_types, sizeof(_s6.researched_ride_types));
@ -215,7 +215,7 @@ public:
memcpy(gResearchedTrackTypesA, _s6.researched_track_types_a, sizeof(_s6.researched_track_types_a)); memcpy(gResearchedTrackTypesA, _s6.researched_track_types_a, sizeof(_s6.researched_track_types_a));
memcpy(gResearchedTrackTypesB, _s6.researched_track_types_b, sizeof(_s6.researched_track_types_b)); memcpy(gResearchedTrackTypesB, _s6.researched_track_types_b, sizeof(_s6.researched_track_types_b));
gNumGuestsInPark = _s6.guests_in_park; gNumGuestsInPark = _s6.guests_in_park;
gNumGuestsHeadingForPark = _s6.guests_heading_for_park; gNumGuestsHeadingForPark = _s6.guests_heading_for_park;
memcpy(gExpenditureTable, _s6.expenditure_table, sizeof(_s6.expenditure_table)); memcpy(gExpenditureTable, _s6.expenditure_table, sizeof(_s6.expenditure_table));
@ -233,37 +233,37 @@ public:
memcpy(gParkRatingHistory, _s6.park_rating_history, sizeof(_s6.park_rating_history)); memcpy(gParkRatingHistory, _s6.park_rating_history, sizeof(_s6.park_rating_history));
memcpy(gGuestsInParkHistory, _s6.guests_in_park_history, sizeof(_s6.guests_in_park_history)); memcpy(gGuestsInParkHistory, _s6.guests_in_park_history, sizeof(_s6.guests_in_park_history));
gResearchPriorities = _s6.active_research_types; gResearchPriorities = _s6.active_research_types;
gResearchProgressStage = _s6.research_progress_stage; gResearchProgressStage = _s6.research_progress_stage;
gResearchLastItemSubject = _s6.last_researched_item_subject; gResearchLastItemSubject = _s6.last_researched_item_subject;
// pad_01357CF8 // pad_01357CF8
gResearchNextItem = _s6.next_research_item; gResearchNextItem = _s6.next_research_item;
gResearchProgress = _s6.research_progress; gResearchProgress = _s6.research_progress;
gResearchNextCategory = _s6.next_research_category; gResearchNextCategory = _s6.next_research_category;
gResearchExpectedDay = _s6.next_research_expected_day; gResearchExpectedDay = _s6.next_research_expected_day;
gResearchExpectedMonth = _s6.next_research_expected_month; gResearchExpectedMonth = _s6.next_research_expected_month;
gGuestInitialHappiness = _s6.guest_initial_happiness; gGuestInitialHappiness = _s6.guest_initial_happiness;
gParkSize = _s6.park_size; gParkSize = _s6.park_size;
_guestGenerationProbability = _s6.guest_generation_probability; _guestGenerationProbability = _s6.guest_generation_probability;
gTotalRideValue = _s6.total_ride_value; gTotalRideValue = _s6.total_ride_value;
gMaxBankLoan = _s6.maximum_loan; gMaxBankLoan = _s6.maximum_loan;
gGuestInitialCash = _s6.guest_initial_cash; gGuestInitialCash = _s6.guest_initial_cash;
gGuestInitialHunger = _s6.guest_initial_hunger; gGuestInitialHunger = _s6.guest_initial_hunger;
gGuestInitialThirst = _s6.guest_initial_thirst; gGuestInitialThirst = _s6.guest_initial_thirst;
gScenarioObjectiveType = _s6.objective_type; gScenarioObjectiveType = _s6.objective_type;
gScenarioObjectiveYear = _s6.objective_year; gScenarioObjectiveYear = _s6.objective_year;
// pad_013580FA // pad_013580FA
gScenarioObjectiveCurrency = _s6.objective_currency; gScenarioObjectiveCurrency = _s6.objective_currency;
gScenarioObjectiveNumGuests = _s6.objective_guests; gScenarioObjectiveNumGuests = _s6.objective_guests;
memcpy(gMarketingCampaignDaysLeft, _s6.campaign_weeks_left, sizeof(_s6.campaign_weeks_left)); memcpy(gMarketingCampaignDaysLeft, _s6.campaign_weeks_left, sizeof(_s6.campaign_weeks_left));
memcpy(gMarketingCampaignRideIndex, _s6.campaign_ride_index, sizeof(_s6.campaign_ride_index)); memcpy(gMarketingCampaignRideIndex, _s6.campaign_ride_index, sizeof(_s6.campaign_ride_index));
memcpy(gCashHistory, _s6.balance_history, sizeof(_s6.balance_history)); memcpy(gCashHistory, _s6.balance_history, sizeof(_s6.balance_history));
gCurrentExpenditure = _s6.current_expenditure; gCurrentExpenditure = _s6.current_expenditure;
gCurrentProfit = _s6.current_profit; gCurrentProfit = _s6.current_profit;
gWeeklyProfitAverageDividend = _s6.weekly_profit_average_dividend; gWeeklyProfitAverageDividend = _s6.weekly_profit_average_dividend;
gWeeklyProfitAverageDivisor = _s6.weekly_profit_average_divisor; gWeeklyProfitAverageDivisor = _s6.weekly_profit_average_divisor;
// pad_0135833A // pad_0135833A
memcpy(gWeeklyProfitHistory, _s6.weekly_profit_history, sizeof(_s6.weekly_profit_history)); memcpy(gWeeklyProfitHistory, _s6.weekly_profit_history, sizeof(_s6.weekly_profit_history));
@ -273,26 +273,26 @@ public:
memcpy(gParkValueHistory, _s6.park_value_history, sizeof(_s6.park_value_history)); memcpy(gParkValueHistory, _s6.park_value_history, sizeof(_s6.park_value_history));
gScenarioCompletedCompanyValue = _s6.completed_company_value; gScenarioCompletedCompanyValue = _s6.completed_company_value;
gTotalAdmissions = _s6.total_admissions; gTotalAdmissions = _s6.total_admissions;
gTotalIncomeFromAdmissions = _s6.income_from_admissions; gTotalIncomeFromAdmissions = _s6.income_from_admissions;
gCompanyValue = _s6.company_value; gCompanyValue = _s6.company_value;
memcpy(gPeepWarningThrottle, _s6.peep_warning_throttle, sizeof(_s6.peep_warning_throttle)); memcpy(gPeepWarningThrottle, _s6.peep_warning_throttle, sizeof(_s6.peep_warning_throttle));
// Awards // Awards
for (sint32 i = 0; i < RCT12_MAX_AWARDS; i++) for (sint32 i = 0; i < RCT12_MAX_AWARDS; i++)
{ {
rct12_award * src = &_s6.awards[i]; rct12_award * src = &_s6.awards[i];
Award * dst = &gCurrentAwards[i]; Award * dst = &gCurrentAwards[i];
dst->Time = src->time; dst->Time = src->time;
dst->Type = src->type; dst->Type = src->type;
} }
gLandPrice = _s6.land_price; gLandPrice = _s6.land_price;
gConstructionRightsPrice = _s6.construction_rights_price; gConstructionRightsPrice = _s6.construction_rights_price;
// unk_01358774 // unk_01358774
// pad_01358776 // pad_01358776
// _s6.cd_key // _s6.cd_key
_gameVersion = _s6.game_version_number; _gameVersion = _s6.game_version_number;
gScenarioCompanyValueRecord = _s6.completed_company_value_record; gScenarioCompanyValueRecord = _s6.completed_company_value_record;
// _s6.loan_hash; // _s6.loan_hash;
gRideCount = _s6.ride_count; gRideCount = _s6.ride_count;
@ -302,15 +302,15 @@ public:
memcpy(gScenarioCompletedBy, _s6.scenario_completed_name, sizeof(_s6.scenario_completed_name)); memcpy(gScenarioCompletedBy, _s6.scenario_completed_name, sizeof(_s6.scenario_completed_name));
gCashEncrypted = _s6.cash; gCashEncrypted = _s6.cash;
// pad_013587FC // pad_013587FC
gParkRatingCasualtyPenalty = _s6.park_rating_casualty_penalty; gParkRatingCasualtyPenalty = _s6.park_rating_casualty_penalty;
gMapSizeUnits = _s6.map_size_units; gMapSizeUnits = _s6.map_size_units;
gMapSizeMinus2 = _s6.map_size_minus_2; gMapSizeMinus2 = _s6.map_size_minus_2;
gMapSize = _s6.map_size; gMapSize = _s6.map_size;
gMapSizeMaxXY = _s6.map_max_xy; gMapSizeMaxXY = _s6.map_max_xy;
gSamePriceThroughoutParkA = _s6.same_price_throughout; gSamePriceThroughoutParkA = _s6.same_price_throughout;
_suggestedGuestMaximum = _s6.suggested_max_guests; _suggestedGuestMaximum = _s6.suggested_max_guests;
gScenarioParkRatingWarningDays = _s6.park_rating_warning_days; gScenarioParkRatingWarningDays = _s6.park_rating_warning_days;
gLastEntranceStyle = _s6.last_entrance_style; gLastEntranceStyle = _s6.last_entrance_style;
// rct1_water_colour // rct1_water_colour
// pad_01358842 // pad_01358842
memcpy(gResearchItems, _s6.research_items, sizeof(_s6.research_items)); memcpy(gResearchItems, _s6.research_items, sizeof(_s6.research_items));
@ -323,9 +323,9 @@ public:
// Preserve compatibility with vanilla RCT2's save format. // Preserve compatibility with vanilla RCT2's save format.
for (uint8 i = 0; i < RCT12_MAX_PARK_ENTRANCES; i++) for (uint8 i = 0; i < RCT12_MAX_PARK_ENTRANCES; i++)
{ {
gParkEntrances[i].x = _s6.park_entrance_x[i]; gParkEntrances[i].x = _s6.park_entrance_x[i];
gParkEntrances[i].y = _s6.park_entrance_y[i]; gParkEntrances[i].y = _s6.park_entrance_y[i];
gParkEntrances[i].z = _s6.park_entrance_z[i]; gParkEntrances[i].z = _s6.park_entrance_z[i];
gParkEntrances[i].direction = _s6.park_entrance_direction[i]; gParkEntrances[i].direction = _s6.park_entrance_direction[i];
} }
scenario_set_filename(_s6.scenario_filename); scenario_set_filename(_s6.scenario_filename);
@ -334,10 +334,10 @@ public:
memcpy(gUserStrings, _s6.custom_strings, sizeof(_s6.custom_strings)); memcpy(gUserStrings, _s6.custom_strings, sizeof(_s6.custom_strings));
gCurrentTicks = _s6.game_ticks_1; gCurrentTicks = _s6.game_ticks_1;
memcpy(gRideList, _s6.rides, sizeof(_s6.rides)); memcpy(gRideList, _s6.rides, sizeof(_s6.rides));
gSavedAge = _s6.saved_age; gSavedAge = _s6.saved_age;
gSavedViewX = _s6.saved_view_x; gSavedViewX = _s6.saved_view_x;
gSavedViewY = _s6.saved_view_y; gSavedViewY = _s6.saved_view_y;
gSavedViewZoom = _s6.saved_view_zoom; gSavedViewZoom = _s6.saved_view_zoom;
gSavedViewRotation = _s6.saved_view_rotation; gSavedViewRotation = _s6.saved_view_rotation;
memcpy(gAnimatedObjects, _s6.map_animations, sizeof(_s6.map_animations)); memcpy(gAnimatedObjects, _s6.map_animations, sizeof(_s6.map_animations));
gNumMapAnimations = _s6.num_map_animations; gNumMapAnimations = _s6.num_map_animations;
@ -345,41 +345,41 @@ public:
gRideRatingsCalcData = _s6.ride_ratings_calc_data; gRideRatingsCalcData = _s6.ride_ratings_calc_data;
memcpy(gRideMeasurements, _s6.ride_measurements, sizeof(_s6.ride_measurements)); memcpy(gRideMeasurements, _s6.ride_measurements, sizeof(_s6.ride_measurements));
gNextGuestNumber = _s6.next_guest_index; gNextGuestNumber = _s6.next_guest_index;
gGrassSceneryTileLoopPosition = _s6.grass_and_scenery_tilepos; gGrassSceneryTileLoopPosition = _s6.grass_and_scenery_tilepos;
memcpy(gStaffPatrolAreas, _s6.patrol_areas, sizeof(_s6.patrol_areas)); memcpy(gStaffPatrolAreas, _s6.patrol_areas, sizeof(_s6.patrol_areas));
memcpy(gStaffModes, _s6.staff_modes, sizeof(_s6.staff_modes)); memcpy(gStaffModes, _s6.staff_modes, sizeof(_s6.staff_modes));
// unk_13CA73E // unk_13CA73E
// pad_13CA73F // pad_13CA73F
gUnk13CA740 = _s6.byte_13CA740; gUnk13CA740 = _s6.byte_13CA740;
gClimate = _s6.climate; gClimate = _s6.climate;
// pad_13CA741; // pad_13CA741;
// byte_13CA742 // byte_13CA742
// pad_013CA747 // pad_013CA747
gClimateUpdateTimer = _s6.climate_update_timer; gClimateUpdateTimer = _s6.climate_update_timer;
gClimateCurrentWeather = _s6.current_weather; gClimateCurrentWeather = _s6.current_weather;
gClimateNextWeather = _s6.next_weather; gClimateNextWeather = _s6.next_weather;
gClimateCurrentTemperature = _s6.temperature; gClimateCurrentTemperature = _s6.temperature;
gClimateNextTemperature = _s6.next_temperature; gClimateNextTemperature = _s6.next_temperature;
gClimateCurrentWeatherEffect = _s6.current_weather_effect; gClimateCurrentWeatherEffect = _s6.current_weather_effect;
gClimateNextWeatherEffect = _s6.next_weather_effect; gClimateNextWeatherEffect = _s6.next_weather_effect;
gClimateCurrentWeatherGloom = _s6.current_weather_gloom; gClimateCurrentWeatherGloom = _s6.current_weather_gloom;
gClimateNextWeatherGloom = _s6.next_weather_gloom; gClimateNextWeatherGloom = _s6.next_weather_gloom;
gClimateCurrentRainLevel = _s6.current_rain_level; gClimateCurrentRainLevel = _s6.current_rain_level;
gClimateNextRainLevel = _s6.next_rain_level; gClimateNextRainLevel = _s6.next_rain_level;
// News items // News items
for (size_t i = 0; i < RCT12_MAX_NEWS_ITEMS; i++) for (size_t i = 0; i < RCT12_MAX_NEWS_ITEMS; i++)
{ {
const rct12_news_item * src = &_s6.news_items[i]; const rct12_news_item * src = &_s6.news_items[i];
NewsItem * dst = &gNewsItems[i]; NewsItem * dst = &gNewsItems[i];
dst->Type = src->Type; dst->Type = src->Type;
dst->Flags = src->Flags; dst->Flags = src->Flags;
dst->Assoc = src->Assoc; dst->Assoc = src->Assoc;
dst->Ticks = src->Ticks; dst->Ticks = src->Ticks;
dst->MonthYear = src->MonthYear; dst->MonthYear = src->MonthYear;
dst->Day = src->Day; dst->Day = src->Day;
memcpy(dst->Text, src->Text, sizeof(src->Text)); memcpy(dst->Text, src->Text, sizeof(src->Text));
} }
@ -415,7 +415,7 @@ extern "C"
{ {
bool game_load_sv6_path(const char * path) bool game_load_sv6_path(const char * path)
{ {
bool result = false; bool result = false;
auto s6Importer = new S6Importer(); auto s6Importer = new S6Importer();
try try
{ {
@ -428,22 +428,22 @@ extern "C"
} }
catch (const ObjectLoadException &) catch (const ObjectLoadException &)
{ {
gErrorType = ERROR_TYPE_FILE_LOAD; gErrorType = ERROR_TYPE_FILE_LOAD;
gErrorStringId = STR_GAME_SAVE_FAILED; gErrorStringId = STR_GAME_SAVE_FAILED;
} }
catch (const IOException &) catch (const IOException &)
{ {
gErrorType = ERROR_TYPE_FILE_LOAD; gErrorType = ERROR_TYPE_FILE_LOAD;
gErrorStringId = STR_GAME_SAVE_FAILED; gErrorStringId = STR_GAME_SAVE_FAILED;
} }
catch (const Exception &) catch (const Exception &)
{ {
gErrorType = ERROR_TYPE_FILE_LOAD; gErrorType = ERROR_TYPE_FILE_LOAD;
gErrorStringId = STR_FILE_CONTAINS_INVALID_DATA; gErrorStringId = STR_FILE_CONTAINS_INVALID_DATA;
} }
delete s6Importer; delete s6Importer;
gScreenAge = 0; gScreenAge = 0;
gLastAutoSaveUpdate = AUTOSAVE_PAUSE; gLastAutoSaveUpdate = AUTOSAVE_PAUSE;
return result; return result;
} }
@ -455,7 +455,7 @@ extern "C"
*/ */
sint32 scenario_load(const char * path) sint32 scenario_load(const char * path)
{ {
bool result = false; bool result = false;
auto s6Importer = new S6Importer(); auto s6Importer = new S6Importer();
try try
{ {
@ -468,22 +468,22 @@ extern "C"
} }
catch (const ObjectLoadException &) catch (const ObjectLoadException &)
{ {
gErrorType = ERROR_TYPE_FILE_LOAD; gErrorType = ERROR_TYPE_FILE_LOAD;
gErrorStringId = STR_GAME_SAVE_FAILED; gErrorStringId = STR_GAME_SAVE_FAILED;
} }
catch (const IOException &) catch (const IOException &)
{ {
gErrorType = ERROR_TYPE_FILE_LOAD; gErrorType = ERROR_TYPE_FILE_LOAD;
gErrorStringId = STR_GAME_SAVE_FAILED; gErrorStringId = STR_GAME_SAVE_FAILED;
} }
catch (const Exception &) catch (const Exception &)
{ {
gErrorType = ERROR_TYPE_FILE_LOAD; gErrorType = ERROR_TYPE_FILE_LOAD;
gErrorStringId = STR_FILE_CONTAINS_INVALID_DATA; gErrorStringId = STR_FILE_CONTAINS_INVALID_DATA;
} }
delete s6Importer; delete s6Importer;
gScreenAge = 0; gScreenAge = 0;
gLastAutoSaveUpdate = AUTOSAVE_PAUSE; gLastAutoSaveUpdate = AUTOSAVE_PAUSE;
return result; return result;
} }