Fixed issue occurring when a city region location could not decipher into a fictional name.

This commit is contained in:
Cekis
2017-01-20 18:04:03 +00:00
parent 3e00907257
commit 3e5f083533
+6 -2
View File
@@ -648,8 +648,11 @@ public class locations extends script.base_script
{
return null;
}
location locGoodLocation = new location();
string_id strFictionalName = utils.unpackString(rgnCity.getName());
if(strFictionalName == null){
LOG("mission_spam", "Can't unpack city name (" + rgnCity.getName() + ") to get fictional name.");
return null;
}
String strAsciiId = strFictionalName.getAsciiId();
LOG("mission_spam", "strAsciiId is " + strAsciiId);
int regionType = regions.getDeliverMissionRegionType(strAsciiId);
@@ -658,10 +661,11 @@ public class locations extends script.base_script
LOG("mission_spam", "strPlanet is " + strPlanet);
if (rgnGoodLocations == null)
{
LOG("mission_spam", "No regions were foind of type " + regionType);
LOG("mission_spam", "No regions were found of type " + regionType);
return null;
}
region rgnSpawnRegion = rgnGoodLocations[rand(0, rgnGoodLocations.length - 1)];
location locGoodLocation = new location();
locGoodLocation = getRegionCenter(rgnSpawnRegion);
return locGoodLocation;
}