mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-01-30 23:10:14 -05:00
Fix oversight in Static Hints, add some asserts (#4488)
This commit is contained in:
parent
e5f4c091f8
commit
d6ebed59dc
@ -715,7 +715,7 @@ static void CalculateWotH() {
|
|||||||
//If removing this item and no other item caused the game to become unbeatable, then it is strictly necessary,
|
//If removing this item and no other item caused the game to become unbeatable, then it is strictly necessary,
|
||||||
//so add it unless it is in Links Pocket or an isolated place.
|
//so add it unless it is in Links Pocket or an isolated place.
|
||||||
auto itemLoc = ctx->GetItemLocation(ctx->playthroughLocations[i][j]);
|
auto itemLoc = ctx->GetItemLocation(ctx->playthroughLocations[i][j]);
|
||||||
if (itemLoc->IsHintable() && *itemLoc->GetAreas().begin() > RA_LINKS_POCKET &&
|
if (itemLoc->IsHintable() && itemLoc->GetFirstArea() > RA_LINKS_POCKET &&
|
||||||
!(IsBeatableWithout(ctx->playthroughLocations[i][j], true))) {
|
!(IsBeatableWithout(ctx->playthroughLocations[i][j], true))) {
|
||||||
itemLoc->SetWothCandidate();
|
itemLoc->SetWothCandidate();
|
||||||
}
|
}
|
||||||
|
@ -501,10 +501,7 @@ void CreateWarpSongTexts() {
|
|||||||
auto warpSongEntrances = GetShuffleableEntrances(EntranceType::WarpSong, false);
|
auto warpSongEntrances = GetShuffleableEntrances(EntranceType::WarpSong, false);
|
||||||
for (auto entrance : warpSongEntrances) {
|
for (auto entrance : warpSongEntrances) {
|
||||||
//RANDOTODO make random
|
//RANDOTODO make random
|
||||||
RandomizerArea destination = RA_NONE;
|
RandomizerArea destination = entrance->GetConnectedRegion()->GetFirstArea();
|
||||||
if (!entrance->GetConnectedRegion()->GetAllAreas().empty()){
|
|
||||||
destination = *entrance->GetConnectedRegion()->GetAllAreas().begin();
|
|
||||||
}
|
|
||||||
switch (entrance->GetIndex()) {
|
switch (entrance->GetIndex()) {
|
||||||
case 0x0600: // minuet RANDOTODO make into entrance hints when they are added
|
case 0x0600: // minuet RANDOTODO make into entrance hints when they are added
|
||||||
ctx->AddHint(RH_MINUET_WARP_LOC, Hint(RH_MINUET_WARP_LOC, HINT_TYPE_AREA, "", {RHT_WARP_SONG}, {}, {destination}));
|
ctx->AddHint(RH_MINUET_WARP_LOC, Hint(RH_MINUET_WARP_LOC, HINT_TYPE_AREA, "", {RHT_WARP_SONG}, {}, {destination}));
|
||||||
@ -748,12 +745,14 @@ void CreateStaticHintFromData(RandomizerHint hint, StaticHintInfo staticData){
|
|||||||
std::vector<RandomizerCheck> locations = {};
|
std::vector<RandomizerCheck> locations = {};
|
||||||
if (staticData.targetItems.size() > 0){
|
if (staticData.targetItems.size() > 0){
|
||||||
locations = FindItemsAndMarkHinted(staticData.targetItems, staticData.hintChecks);
|
locations = FindItemsAndMarkHinted(staticData.targetItems, staticData.hintChecks);
|
||||||
}
|
} else {
|
||||||
for(auto check: staticData.targetChecks){
|
for(auto check: staticData.targetChecks){
|
||||||
ctx->GetItemLocation(check)->SetHintAccesible();
|
locations.push_back(check);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
std::vector<RandomizerArea> areas = {};
|
std::vector<RandomizerArea> areas = {};
|
||||||
for (auto loc : locations){
|
for (auto loc : locations){
|
||||||
|
ctx->GetItemLocation(loc)->SetHintAccesible();
|
||||||
areas.push_back(RandomElementFromSet(ctx->GetItemLocation(loc)->GetAreas()));
|
areas.push_back(RandomElementFromSet(ctx->GetItemLocation(loc)->GetAreas()));
|
||||||
}
|
}
|
||||||
//hintKeys are defaulted to in the hint object and do not need to be specified
|
//hintKeys are defaulted to in the hint object and do not need to be specified
|
||||||
|
@ -205,6 +205,15 @@ public:
|
|||||||
return areas;
|
return areas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RandomizerArea GetFirstArea() const{
|
||||||
|
if (areas.empty()){
|
||||||
|
assert(false);
|
||||||
|
return RA_NONE;
|
||||||
|
} else {
|
||||||
|
return *areas.begin();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ReplaceAreas(std::set<RandomizerArea> newAreas) {
|
void ReplaceAreas(std::set<RandomizerArea> newAreas) {
|
||||||
areas = newAreas;
|
areas = newAreas;
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ void Hint::FillGapsInData(){
|
|||||||
for(uint8_t c = 0; c < locations.size(); c++){
|
for(uint8_t c = 0; c < locations.size(); c++){
|
||||||
//if area matters for the hint, it should be specified and not left to this
|
//if area matters for the hint, it should be specified and not left to this
|
||||||
if (fillAreas){
|
if (fillAreas){
|
||||||
areas.push_back(*ctx->GetItemLocation(locations[c])->GetAreas().begin());
|
areas.push_back(ctx->GetItemLocation(locations[c])->GetFirstArea());
|
||||||
}
|
}
|
||||||
if (fillItems){
|
if (fillItems){
|
||||||
items.push_back(ctx->GetItemLocation(locations[c])->GetPlacedRandomizerGet());
|
items.push_back(ctx->GetItemLocation(locations[c])->GetPlacedRandomizerGet());
|
||||||
|
@ -72,6 +72,15 @@ std::set<RandomizerArea> ItemLocation::GetAreas() const {
|
|||||||
return areas;
|
return areas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RandomizerArea ItemLocation::GetFirstArea() const {
|
||||||
|
if (areas.empty()){
|
||||||
|
assert(false);
|
||||||
|
return RA_NONE;
|
||||||
|
} else {
|
||||||
|
return *areas.begin();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ItemLocation::PlaceVanillaItem() {
|
void ItemLocation::PlaceVanillaItem() {
|
||||||
placedItem = StaticData::GetLocation(rc)->GetVanillaItem();
|
placedItem = StaticData::GetLocation(rc)->GetVanillaItem();
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ class ItemLocation {
|
|||||||
RandomizerRegion GetParentRegionKey() const;
|
RandomizerRegion GetParentRegionKey() const;
|
||||||
void SetParentRegion (RandomizerRegion region);
|
void SetParentRegion (RandomizerRegion region);
|
||||||
std::set<RandomizerArea> GetAreas() const;
|
std::set<RandomizerArea> GetAreas() const;
|
||||||
|
RandomizerArea GetFirstArea() const;
|
||||||
void MergeAreas (std::set<RandomizerArea> newAreas);
|
void MergeAreas (std::set<RandomizerArea> newAreas);
|
||||||
void PlaceVanillaItem();
|
void PlaceVanillaItem();
|
||||||
void ApplyPlacedItemEffect() const;
|
void ApplyPlacedItemEffect() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user