diff --git a/ext/linkage b/ext/linkage index 3e2bd99..b13855d 160000 --- a/ext/linkage +++ b/ext/linkage @@ -1 +1 @@ -Subproject commit 3e2bd997a6048a0c2d9318e65a63b30a35c67dfa +Subproject commit b13855d46f848daa43eee990081b97f3e83d87fd diff --git a/inc/constant.h b/inc/constant.h index 753b3cf..cdc2eb6 100644 --- a/inc/constant.h +++ b/inc/constant.h @@ -447,6 +447,7 @@ constexpr auto kGameMaxPlayers = 32; constexpr auto kGameTeamNum = 2; constexpr auto kInvalidNodeIndex = -1; constexpr auto kGrenadeInventoryEmpty = -1; +constexpr auto kInvalidRadioSlot = -1; constexpr auto kConfigExtension = "cfg"; // weapon masks diff --git a/inc/graph.h b/inc/graph.h index 24fa82b..48576f6 100644 --- a/inc/graph.h +++ b/inc/graph.h @@ -268,8 +268,8 @@ public: const IntArray &getNodesInBucket (const Vector &pos); public: - size_t getMaxRouteLength () const { - return m_paths.length () / 2; + int32_t getMaxRouteLength () const { + return length () / 2; } StringRef getAuthor () const { diff --git a/inc/yapb.h b/inc/yapb.h index 7742ad1..23c8b59 100644 --- a/inc/yapb.h +++ b/inc/yapb.h @@ -188,7 +188,7 @@ public: m_path[0] = 0; } - void init (size_t length) { + void init (int32_t length) { m_path = cr::makeUnique (length); } }; diff --git a/src/botlib.cpp b/src/botlib.cpp index f694d93..1f24a96 100644 --- a/src/botlib.cpp +++ b/src/botlib.cpp @@ -947,7 +947,7 @@ void Bot::pushChatterMessage (int message) { } if (!sendMessage) { - m_radioSelect = -1; + m_radioSelect = kInvalidRadioSlot; return; } m_radioSelect = message; @@ -1047,14 +1047,14 @@ void Bot::checkMsgQueue () { // if same message like previous just do a yes/no if (m_radioSelect != Radio::RogerThat && m_radioSelect != Radio::Negative) { if (m_radioSelect == bots.getLastRadio (m_team) && bots.getLastRadioTimestamp (m_team) + delayResponseTime * 0.5f > game.time ()) { - m_radioSelect = -1; + m_radioSelect = kInvalidRadioSlot; } else { if (m_radioSelect != Radio::ReportingIn) { bots.setLastRadio (m_team, m_radioSelect); } else { - bots.setLastRadio (m_team, -1); + bots.setLastRadio (m_team, kInvalidRadioSlot); } for (const auto &bot : bots) { @@ -1066,26 +1066,28 @@ void Bot::checkMsgQueue () { } } - if (m_radioSelect != -1) { + if (m_radioSelect != kInvalidRadioSlot) { if ((m_radioSelect != Radio::ReportingIn && m_forceRadio) || cv_radio_mode.as () != 2 || !conf.hasChatterBank (m_radioSelect) || !game.is (GameFlags::HasBotVoice)) { + auto radioSlot = m_radioSelect; + if (m_radioSelect < Radio::GoGoGo) { issueCommand ("radio1"); } else if (m_radioSelect < Radio::RogerThat) { - m_radioSelect -= Radio::GoGoGo - 1; + radioSlot -= Radio::GoGoGo - 1; issueCommand ("radio2"); } else { - m_radioSelect -= Radio::RogerThat - 1; + radioSlot -= Radio::RogerThat - 1; issueCommand ("radio3"); } // select correct menu item for this radio message - issueCommand ("menuselect %d", m_radioSelect); + issueCommand ("menuselect %d", radioSlot); } else if (m_radioSelect != Radio::ReportingIn) { instantChatter (m_radioSelect); diff --git a/src/message.cpp b/src/message.cpp index 5ca4cfd..c9cf39c 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -227,7 +227,7 @@ void MessageDispatcher::netMsgMoney () { if (amount < 0) { amount = 800; } - else if (amount > INT32_MAX) { + else if (amount >= INT32_MAX) { amount = 16000; } m_bot->m_moneyAmount = amount;