Correction racine du crash #56 : irand(0,-1) dans GetRandomCharacterByFuction

Avec un seul personnage sur le compte bot, characters.size()/2 - 1 = -1
=> ASSERT max >= min => SIGSEGV des que le module BG BotFill engage un bot.
Le contournement historique etait pbotall=0 ; la borne est desormais sure.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
SylvaniaCore deploy
2026-08-11 23:07:57 +02:00
parent 5560d27be5
commit f697d76a88
+6 -1
View File
@@ -156,7 +156,12 @@ struct PlayerBotBaseInfo
for (int i = 0; i < 5; i++)
#endif
{
int16 select = irand(0, characters.size() / 2 - 1);
// SylvaniaCore: correction racine du crash #56 - avec un seul perso sur le
// compte, characters.size()/2 - 1 = -1 => irand(0,-1) => ASSERT max >= min
int32 maxSelect = int32(characters.size()) / 2 - 1;
if (maxSelect < 0)
maxSelect = 0;
int16 select = int16(irand(0, maxSelect));
for (CharInfoMap::iterator it = characters.begin();
it != characters.end();
it++)