Fixed crash in AI controller ... again .. fixed the bugfix for the bugfix *sigh*

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7373 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2011-01-11 23:32:30 +00:00
parent a1ba3effc4
commit c7b52a99eb

View File

@ -54,11 +54,12 @@ AIBaseController::AIBaseController(Kart *kart,
// best way, potentially depending on race position etc.
int r = rand();
int indx = (int)(
(r / (float)(RAND_MAX)+1.0f) * next.size()
r / ((float)(RAND_MAX)+1.0f) * next.size()
);
// In case of rounding errors
if(indx>(int)next.size()) indx--;
m_successor_index.push_back(indx);
assert(indx <(int)next.size() && indx>=0);
m_next_node_index.push_back(next[indx]);
}