From 9cd5243d04f782d7dcf64b935018fe22e6e73dfd Mon Sep 17 00:00:00 2001 From: smatz Date: Tue, 8 Feb 2011 18:39:29 +0000 Subject: (svn r22026) -Fix: don't crash when we generate too many objects while generating map --- src/object_cmd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/object_cmd.cpp') 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 */ -- cgit v1.2.3-70-g09d2