summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/object_cmd.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp
index 29163cab3..f39700df2 100644
--- a/src/object_cmd.cpp
+++ b/src/object_cmd.cpp
@@ -636,7 +636,7 @@ void GenerateObjects()
/* add lighthouses */
uint maxx = MapMaxX();
uint maxy = MapMaxY();
- for (int loop_count = 0; loop_count < 1000 && lighthouses_to_build != 0; loop_count++) {
+ for (int loop_count = 0; loop_count < 1000 && lighthouses_to_build != 0 && Object::CanAllocateItem(); loop_count++) {
uint r = Random();
/* Scatter the lighthouses more evenly around the perimeter */