diff --git a/sc2/src/sc2code/planets/pstarmap.c b/sc2/src/sc2code/planets/pstarmap.c index 4d3715677..44aef6d99 100644 --- a/sc2/src/sc2code/planets/pstarmap.c +++ b/sc2/src/sc2code/planets/pstarmap.c @@ -878,6 +878,29 @@ SplitStarName (STAR_SEARCH_STATE *pSS) pSS->PrefixLen = utf8StringCount (pSS->Prefix); } +static int +GetFirstClusterStar (BYTE Postfix) +{ + int i; + int min = -1; + int min_pref = 1000; + STAR_DESCPTR SDPtr; + + for (i = 0, SDPtr = star_array; i < NUM_SOLAR_SYSTEMS; ++i, ++SDPtr) + { + if (SDPtr->Postfix != Postfix) + continue; + + if (SDPtr->Prefix < min_pref) + { + min_pref = SDPtr->Prefix; + min = i; + } + } + + return min; +} + static int FindNextStar (STAR_SEARCH_STATE *pSS, int from, BOOLEAN WithinClust) { @@ -920,8 +943,8 @@ FindNextStar (STAR_SEARCH_STATE *pSS, int from, BOOLEAN WithinClust) if (!pSS->Prefix) { // searching for cluster name only - // only return Alpha stars - if (SDPtr->Prefix == 1) + // return only the first stars in a cluster + if (i == GetFirstClusterStar (SDPtr->Postfix)) break; else continue;