mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Add better crash message for zero-length battlefield list
This commit is contained in:
		| @@ -1099,6 +1099,9 @@ BattleField CGameState::battleGetBattlefieldType(int3 tile, CRandomGenerator & r | ||||
| 	if(map->isCoastalTile(tile)) //coastal tile is always ground | ||||
| 		return BattleField(*VLC->identifiers()->getIdentifier("core", "battlefield.sand_shore")); | ||||
| 	 | ||||
| 	if (t.terType->battleFields.empty()) | ||||
| 		throw std::runtime_error("Failed to find battlefield for terrain " + t.terType->getJsonKey()); | ||||
|  | ||||
| 	return BattleField(*RandomGeneratorUtil::nextItem(t.terType->battleFields, rand)); | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user