Index: code/botlib/be_aas_route.c =================================================================== --- code/botlib/be_aas_route.c (revision 1865) +++ code/botlib/be_aas_route.c (working copy) @@ -1857,30 +1857,42 @@ int AAS_PredictRoute(struct aas_predictroute_s *ro if (j >= reachareas->numareas) testareanum = reach->areanum; else - testareanum = aasworld.reachabilityareaindex[reachareas->firstarea + j]; - if (stopevent & RSE_ENTERCONTENTS) { - if (aasworld.areasettings[testareanum].contents & stopcontents) + if(reachareas->firstarea + j < aasworld.numreachabilityareas) + testareanum = aasworld.reachabilityareaindex[reachareas->firstarea + j]; + else { - route->stopevent = RSE_ENTERCONTENTS; - route->endarea = testareanum; - route->endcontents = aasworld.areasettings[testareanum].contents; - VectorCopy(reach->end, route->endpos); - route->time += AAS_AreaTravelTime(areanum, origin, reach->start); - route->time += reach->traveltime; - return qtrue; - } //end if - } //end if - if (stopevent & RSE_ENTERAREA) + j = reachareas->numareas; + continue; + } + } + + if(testareanum < aasworld.numareasettings) { - if (testareanum == stopareanum) + if (stopevent & RSE_ENTERCONTENTS) { - route->stopevent = RSE_ENTERAREA; - route->endarea = testareanum; - route->endcontents = aasworld.areasettings[testareanum].contents; - VectorCopy(reach->start, route->endpos); - return qtrue; + if (aasworld.areasettings[testareanum].contents & stopcontents) + { + route->stopevent = RSE_ENTERCONTENTS; + route->endarea = testareanum; + route->endcontents = aasworld.areasettings[testareanum].contents; + VectorCopy(reach->end, route->endpos); + route->time += AAS_AreaTravelTime(areanum, origin, reach->start); + route->time += reach->traveltime; + return qtrue; + } //end if } //end if + if (stopevent & RSE_ENTERAREA) + { + if (testareanum == stopareanum) + { + route->stopevent = RSE_ENTERAREA; + route->endarea = testareanum; + route->endcontents = aasworld.areasettings[testareanum].contents; + VectorCopy(reach->start, route->endpos); + return qtrue; + } // end if + } //end if } //end if } //end for