Fix a possible crash in ResourceLayer
This commit is contained in:
@@ -203,6 +203,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public bool CanSpawnResourceAt(ResourceType newResourceType, CPos cell)
|
public bool CanSpawnResourceAt(ResourceType newResourceType, CPos cell)
|
||||||
{
|
{
|
||||||
|
if (!world.Map.Contains(cell))
|
||||||
|
return false;
|
||||||
|
|
||||||
var currentResourceType = GetResource(cell);
|
var currentResourceType = GetResource(cell);
|
||||||
return (currentResourceType == newResourceType && !IsFull(cell))
|
return (currentResourceType == newResourceType && !IsFull(cell))
|
||||||
|| (currentResourceType == null && AllowResourceAt(newResourceType, cell));
|
|| (currentResourceType == null && AllowResourceAt(newResourceType, cell));
|
||||||
|
|||||||
Reference in New Issue
Block a user