From 396794badefdce200a1d4c6ea6e6e676094bbabe Mon Sep 17 00:00:00 2001 From: DragonAura Date: Mon, 17 Apr 2023 15:10:33 +0800 Subject: [PATCH] fix(CAPI): :bug: fix array out of range --- CAPI/cpp/API/src/main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CAPI/cpp/API/src/main.cpp b/CAPI/cpp/API/src/main.cpp index cf4c756..ee0ecb6 100644 --- a/CAPI/cpp/API/src/main.cpp +++ b/CAPI/cpp/API/src/main.cpp @@ -72,11 +72,15 @@ int THUAI6Main(int argc, char** argv, CreateAIFunc AIBuilder) try { THUAI6::PlayerType playerType; + THUAI6::StudentType stuType = THUAI6::StudentType::NullStudentType; if (pID == 4) playerType = THUAI6::PlayerType::TrickerPlayer; else + { playerType = THUAI6::PlayerType::StudentPlayer; - Logic logic(playerType, pID, trickerType, studentType[pID]); + stuType = studentType[pID]; + } + Logic logic(playerType, pID, trickerType, stuType); logic.Main(AIBuilder, sIP, sPort, file, print, warnOnly); } catch (const std::exception& e)