1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-17 11:56:46 +02:00

Do not select random towns as starting faction for player

This commit is contained in:
Ivan Savenko 2023-11-17 15:57:39 +02:00
parent 843e97349a
commit f9e6d1467f
2 changed files with 2 additions and 2 deletions

View File

@ -1272,7 +1272,7 @@ std::set<FactionID> CTownHandler::getDefaultAllowed() const
std::set<FactionID> CTownHandler::getAllowedFactions(bool withTown) const std::set<FactionID> CTownHandler::getAllowedFactions(bool withTown) const
{ {
if (!withTown) if (withTown)
return getDefaultAllowed(); return getDefaultAllowed();
std::set<FactionID> result; std::set<FactionID> result;

View File

@ -32,7 +32,7 @@ FactionID PlayerSettings::getCastleValidated() const
{ {
if (!castle.isValid()) if (!castle.isValid())
return FactionID(0); return FactionID(0);
if (castle.getNum() < VLC->townh->size()) if (castle.getNum() < VLC->townh->size() && VLC->townh->objects[castle.getNum()]->town != nullptr)
return castle; return castle;
return FactionID(0); return FactionID(0);