MCPcopy Create free account
hub / github.com/EasyRPG/Player / ResetGameObjects

Method ResetGameObjects

src/player.cpp:912–967  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

910}
911
912void Player::ResetGameObjects() {
913 // The init order is important
914 Main_Data::Cleanup();
915
916 Main_Data::game_switches = std::make_unique<Game_Switches>();
917 Main_Data::game_switches->SetLowerLimit(lcf::Data::switches.size());
918
919 auto min_var = lcf::Data::system.easyrpg_variable_min_value;
920 if (min_var == 0) {
921 if ((Player::game_config.patch_maniac.Get() & 1) == 1) {
922 min_var = std::numeric_limits<Game_Variables::Var_t>::min();
923 } else {
924 min_var = Player::IsRPG2k3() ? Game_Variables::min_2k3 : Game_Variables::min_2k;
925 }
926 }
927 auto max_var = lcf::Data::system.easyrpg_variable_max_value;
928 if (max_var == 0) {
929 if ((Player::game_config.patch_maniac.Get() & 1) == 1) {
930 max_var = std::numeric_limits<Game_Variables::Var_t>::max();
931 } else {
932 max_var = Player::IsRPG2k3() ? Game_Variables::max_2k3 : Game_Variables::max_2k;
933 }
934 }
935 Main_Data::game_variables = std::make_unique<Game_Variables>(min_var, max_var);
936 Main_Data::game_variables->SetLowerLimit(lcf::Data::variables.size());
937
938 Main_Data::game_strings = std::make_unique<Game_Strings>();
939
940 // Prevent a crash when Game_Map wants to reset the screen content
941 // because Setup() modified pictures array
942 Main_Data::game_screen = std::make_unique<Game_Screen>();
943 Main_Data::game_pictures = std::make_unique<Game_Pictures>();
944 Main_Data::game_windows = std::make_unique<Game_Windows>();
945
946 Main_Data::game_actors = std::make_unique<Game_Actors>();
947
948 Game_Map::Init();
949
950 Main_Data::game_system = std::make_unique<Game_System>();
951 Main_Data::game_targets = std::make_unique<Game_Targets>();
952 Main_Data::game_enemyparty = std::make_unique<Game_EnemyParty>();
953 Main_Data::game_party = std::make_unique<Game_Party>();
954 Main_Data::game_player = std::make_unique<Game_Player>();
955 Main_Data::game_quit = std::make_unique<Game_Quit>();
956 Main_Data::game_switches_global = std::make_unique<Game_Switches>();
957 Main_Data::game_variables_global = std::make_unique<Game_Variables>(min_var, max_var);
958 Main_Data::game_dynrpg = std::make_unique<Game_DynRpg>();
959 Main_Data::game_ineluki = std::make_unique<Game_Ineluki>();
960 Main_Data::game_destiny = std::make_unique<Game_Destiny>();
961
962 Game_Clock::ResetFrame(Game_Clock::now());
963
964 Main_Data::game_system->ReloadSystemGraphic();
965
966 Input::ResetMask();
967}
968
969static bool DefaultLmuStartFileExists(const FilesystemView& fs) {

Callers

nothing calls this directly

Calls 6

minFunction · 0.85
maxFunction · 0.85
ReloadSystemGraphicMethod · 0.80
SetLowerLimitMethod · 0.45
sizeMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected