2525#include " PokemonSV_AutoStory_Segment_07.h"
2626#include " PokemonSV_AutoStory_Segment_08.h"
2727#include " PokemonSV_AutoStory_Segment_09.h"
28- // #include "PokemonSV_AutoStory_Segment_10.h"
28+ #include " PokemonSV_AutoStory_Segment_10.h"
2929// #include "PokemonSV_AutoStory_Segment_11.h"
3030// #include "PokemonSV_AutoStory_Segment_12.h"
3131// #include "PokemonSV_AutoStory_Segment_13.h"
@@ -45,6 +45,8 @@ namespace PokemonSV{
4545
4646using namespace Pokemon ;
4747
48+ static constexpr size_t INDEX_OF_LAST_TUTORIAL_SEGMENT = 9 ;
49+
4850
4951std::vector<std::unique_ptr<AutoStory_Segment>> make_autoStory_segment_list (){
5052 std::vector<std::unique_ptr<AutoStory_Segment>> segment_list;
@@ -58,7 +60,7 @@ std::vector<std::unique_ptr<AutoStory_Segment>> make_autoStory_segment_list(){
5860 segment_list.emplace_back (std::make_unique<AutoStory_Segment_07>());
5961 segment_list.emplace_back (std::make_unique<AutoStory_Segment_08>());
6062 segment_list.emplace_back (std::make_unique<AutoStory_Segment_09>());
61- // segment_list.emplace_back(std::make_unique<AutoStory_Segment_10>());
63+ segment_list.emplace_back (std::make_unique<AutoStory_Segment_10>());
6264 // segment_list.emplace_back(std::make_unique<AutoStory_Segment_11>());
6365 // segment_list.emplace_back(std::make_unique<AutoStory_Segment_12>());
6466 // segment_list.emplace_back(std::make_unique<AutoStory_Segment_13>());
@@ -91,7 +93,7 @@ StringSelectDatabase make_tutorial_segments_database(){
9193 StringSelectDatabase ret;
9294 const StringSelectDatabase& all_segments = ALL_SEGMENTS_SELECT_DATABASE ();
9395 size_t start = 0 ;
94- size_t end = all_segments. case_list (). size (); // 10. size() is the placeholder value. will be 10 when rest of segments merged.
96+ size_t end = INDEX_OF_LAST_TUTORIAL_SEGMENT + 1 ;
9597 for (size_t i = start; i < end; i++){
9698 const auto & segment = all_segments[i];
9799 ret.add_entry (segment);
@@ -107,7 +109,7 @@ const StringSelectDatabase& TUTORIAL_SEGMENTS_SELECT_DATABASE(){
107109StringSelectDatabase make_mainstory_segments_database (){
108110 StringSelectDatabase ret;
109111 const StringSelectDatabase& all_segments = ALL_SEGMENTS_SELECT_DATABASE ();
110- size_t start = 0 ; // 10. 0 is the placeholder value. will be 10 when rest of segments merged.
112+ size_t start = INDEX_OF_LAST_TUTORIAL_SEGMENT + 1 ;
111113 size_t end = all_segments.case_list ().size ();
112114 for (size_t i = start; i < end; i++){
113115 const auto & segment = all_segments[i];
@@ -171,20 +173,20 @@ AutoStory::AutoStory()
171173 " <b>End Point:</b><br>Program will stop after completing this segment." ,
172174 TUTORIAL_SEGMENTS_SELECT_DATABASE (),
173175 LockMode::UNLOCK_WHILE_RUNNING,
174- "0" // " 9"
176+ "9"
175177 )
176- // , STARTPOINT_MAINSTORY(
177- // "<b>Start Point:</b><br>Program will start with this segment.",
178- // MAINSTORY_SEGMENTS_SELECT_DATABASE(),
179- // LockMode::UNLOCK_WHILE_RUNNING,
180- // "10"
181- // )
182- // , ENDPOINT_MAINSTORY(
183- // "<b>End Point:</b><br>Program will stop after completing this segment.",
184- // MAINSTORY_SEGMENTS_SELECT_DATABASE(),
185- // LockMode::UNLOCK_WHILE_RUNNING,
186- // "10"
187- // )
178+ , STARTPOINT_MAINSTORY(
179+ " <b>Start Point:</b><br>Program will start with this segment." ,
180+ MAINSTORY_SEGMENTS_SELECT_DATABASE (),
181+ LockMode::UNLOCK_WHILE_RUNNING,
182+ "10"
183+ )
184+ , ENDPOINT_MAINSTORY(
185+ " <b>End Point:</b><br>Program will stop after completing this segment." ,
186+ MAINSTORY_SEGMENTS_SELECT_DATABASE (),
187+ LockMode::UNLOCK_WHILE_RUNNING,
188+ "10"
189+ )
188190 , MAINSTORY_NOTE{
189191 " Ensure you have a level 100 Gardevoir with the moves in the following order: Moonblast, Dazzling Gleam, Psychic, Mystical Fire.<br>"
190192 " Refer to the documentation on github for more details."
@@ -322,10 +324,10 @@ AutoStory::AutoStory()
322324 PA_ADD_OPTION (STORY_SECTION);
323325 PA_ADD_OPTION (STARTPOINT_TUTORIAL);
324326 PA_ADD_OPTION (MAINSTORY_NOTE);
325- // PA_ADD_OPTION(STARTPOINT_MAINSTORY);
327+ PA_ADD_OPTION (STARTPOINT_MAINSTORY);
326328 PA_ADD_OPTION (START_DESCRIPTION);
327329 PA_ADD_OPTION (ENDPOINT_TUTORIAL);
328- // PA_ADD_OPTION(ENDPOINT_MAINSTORY);
330+ PA_ADD_OPTION (ENDPOINT_MAINSTORY);
329331 PA_ADD_OPTION (END_DESCRIPTION);
330332 PA_ADD_OPTION (STARTERCHOICE);
331333 PA_ADD_OPTION (GO_HOME_WHEN_DONE);
@@ -362,8 +364,8 @@ AutoStory::AutoStory()
362364 STORY_SECTION.add_listener (*this );
363365 STARTPOINT_TUTORIAL.add_listener (*this );
364366 ENDPOINT_TUTORIAL.add_listener (*this );
365- // STARTPOINT_MAINSTORY.add_listener(*this);
366- // ENDPOINT_MAINSTORY.add_listener(*this);
367+ STARTPOINT_MAINSTORY.add_listener (*this );
368+ ENDPOINT_MAINSTORY.add_listener (*this );
367369 ENABLE_TEST_CHECKPOINTS.add_listener (*this );
368370 ENABLE_TEST_REALIGN.add_listener (*this );
369371 ENABLE_TEST_OVERWORLD_MOVE.add_listener (*this );
@@ -380,14 +382,14 @@ void AutoStory::value_changed(void* object){
380382 STARTPOINT_TUTORIAL.set_visibility (ConfigOptionState::ENABLED);
381383 ENDPOINT_TUTORIAL.set_visibility (ConfigOptionState::ENABLED);
382384
383- // STARTPOINT_MAINSTORY.set_visibility(ConfigOptionState::HIDDEN);
384- // ENDPOINT_MAINSTORY.set_visibility(ConfigOptionState::HIDDEN);
385+ STARTPOINT_MAINSTORY.set_visibility (ConfigOptionState::HIDDEN);
386+ ENDPOINT_MAINSTORY.set_visibility (ConfigOptionState::HIDDEN);
385387 }else if (STORY_SECTION == StorySection::MAIN_STORY){
386388 STARTPOINT_TUTORIAL.set_visibility (ConfigOptionState::HIDDEN);
387389 ENDPOINT_TUTORIAL.set_visibility (ConfigOptionState::HIDDEN);
388390
389- // STARTPOINT_MAINSTORY.set_visibility(ConfigOptionState::ENABLED);
390- // ENDPOINT_MAINSTORY.set_visibility(ConfigOptionState::ENABLED);
391+ STARTPOINT_MAINSTORY.set_visibility (ConfigOptionState::ENABLED);
392+ ENDPOINT_MAINSTORY.set_visibility (ConfigOptionState::ENABLED);
391393 }
392394
393395 MAINSTORY_NOTE.set_visibility (STORY_SECTION == StorySection::TUTORIAL ? ConfigOptionState::HIDDEN : ConfigOptionState::ENABLED);
@@ -478,9 +480,9 @@ void AutoStory::test_checkpoints(
478480 checkpoint_list.push_back ([&](){checkpoint_18 (env, context, notif_status_update);});
479481 checkpoint_list.push_back ([&](){checkpoint_19 (env, context, notif_status_update);});
480482 checkpoint_list.push_back ([&](){checkpoint_20 (env, context, notif_status_update);});
481- // checkpoint_list.push_back([&](){checkpoint_21(env, context, notif_status_update);});
482- // checkpoint_list.push_back([&](){checkpoint_22(env, context, notif_status_update);});
483- // checkpoint_list.push_back([&](){checkpoint_23(env, context, notif_status_update);});
483+ checkpoint_list.push_back ([&](){checkpoint_21 (env, context, notif_status_update);});
484+ checkpoint_list.push_back ([&](){checkpoint_22 (env, context, notif_status_update);});
485+ checkpoint_list.push_back ([&](){checkpoint_23 (env, context, notif_status_update);});
484486 // checkpoint_list.push_back([&](){checkpoint_24(env, context, notif_status_update);});
485487 // checkpoint_list.push_back([&](){checkpoint_25(env, context, notif_status_update);});
486488 // checkpoint_list.push_back([&](){checkpoint_26(env, context, notif_status_update);});
@@ -527,7 +529,7 @@ std::string AutoStory::start_segment_description(){
527529 if (STORY_SECTION == StorySection::TUTORIAL){
528530 segment_index = STARTPOINT_TUTORIAL.index ();
529531 }else if (STORY_SECTION == StorySection::MAIN_STORY){
530- // segment_index = STARTPOINT_MAINSTORY.index() + 10 ;
532+ segment_index = STARTPOINT_MAINSTORY.index () + (INDEX_OF_LAST_TUTORIAL_SEGMENT + 1 ) ;
531533 }
532534 return ALL_AUTO_STORY_SEGMENT_LIST ()[segment_index]->start_text ();
533535}
@@ -537,7 +539,7 @@ std::string AutoStory::end_segment_description(){
537539 if (STORY_SECTION == StorySection::TUTORIAL){
538540 segment_index = ENDPOINT_TUTORIAL.index ();
539541 }else if (STORY_SECTION == StorySection::MAIN_STORY){
540- // segment_index = ENDPOINT_MAINSTORY.index() + 10 ;
542+ segment_index = ENDPOINT_MAINSTORY.index () + (INDEX_OF_LAST_TUTORIAL_SEGMENT + 1 ) ;
541543 }
542544 return ALL_AUTO_STORY_SEGMENT_LIST ()[segment_index]->end_text ();
543545}
@@ -552,6 +554,15 @@ void AutoStory::run_autostory(SingleSwitchProgramEnvironment& env, BotBaseContex
552554
553555 size_t start = STARTPOINT_TUTORIAL.index ();
554556 size_t end = ENDPOINT_TUTORIAL.index ();
557+
558+ if (STORY_SECTION == StorySection::TUTORIAL){
559+ start = STARTPOINT_TUTORIAL.index ();
560+ end = ENDPOINT_TUTORIAL.index ();
561+ }else if (STORY_SECTION == StorySection::MAIN_STORY){
562+ start = (INDEX_OF_LAST_TUTORIAL_SEGMENT + 1 ) + STARTPOINT_MAINSTORY.index ();
563+ end = (INDEX_OF_LAST_TUTORIAL_SEGMENT + 1 ) + ENDPOINT_MAINSTORY.index ();
564+ }
565+
555566 for (size_t segment_index = start; segment_index <= end; segment_index++){
556567 ALL_AUTO_STORY_SEGMENT_LIST ()[segment_index]->run_segment (env, context, options);
557568 }
0 commit comments