Browse Source

Add more logging for weird crash on game start

Ivan Savenko 1 năm trước cách đây
mục cha
commit
c9b6b17422
1 tập tin đã thay đổi với 9 bổ sung0 xóa
  1. 9 0
      server/CGameHandler.cpp

+ 9 - 0
server/CGameHandler.cpp

@@ -682,6 +682,15 @@ void CGameHandler::onNewTurn()
 		}
 	}
 
+	for (auto & player : gs->players)
+	{
+		if (player.second.status != EPlayerStatus::INGAME)
+			continue;
+
+		if (player.second.heroes.empty() && player.second.towns.empty())
+			throw std::runtime_error("Invalid player in player state! Player " + std::to_string(player.first.getNum()) + ", map name: " + gs->map->name.toString() + ", map description: " + gs->map->description.toString());
+	}
+
 	if (newWeek && !firstTurn)
 	{
 		n.specialWeek = NewTurn::NORMAL;