# HG changeset patch # User truelight # Date 1093021450 0 # Node ID 883535ac2790f0e1f2d08285d65679cc0f10ebe5 # Parent 37f4a5aec25d5be01ccd30f4f5f40533c3d52e79 (svn r96) -Fix: [AI] An industry can have no town, which caused crashes diff -r 37f4a5aec25d -r 883535ac2790 ai_new.c --- a/ai_new.c Fri Aug 20 16:30:43 2004 +0000 +++ b/ai_new.c Fri Aug 20 17:04:10 2004 +0000 @@ -234,7 +234,7 @@ int count = 0; int j = 0; - if (i->town->ratings[_current_player] < 0 && CHANCE16(1,4)) return false; + if (i->town != NULL && i->town->ratings[_current_player] < 0 && CHANCE16(1,4)) return false; // No limits on delevering stations! // Or for industry that does not give anything yet @@ -487,8 +487,7 @@ FOR_ALL_VEHICLES(v) { if (v->owner == _current_player) { sched = v->schedule_ptr; - if (sched == NULL) continue; - while ((ord=*sched++) != 0) { + while (sched != NULL && (ord=*sched++) != 0) { if ((ord & OT_MASK) == OT_GOTO_STATION && DEREF_STATION(ord >> 8) == st) { // This vehicle has this city in his list count++;