Merge branch 'master' into chatter-fixes-and-improvements

This commit is contained in:
Владислав Сухов 2024-05-08 04:19:37 +00:00
commit 332a962ad4
6 changed files with 15 additions and 12 deletions

@ -1 +1 @@
Subproject commit 3e2bd997a6048a0c2d9318e65a63b30a35c67dfa
Subproject commit b13855d46f848daa43eee990081b97f3e83d87fd

View file

@ -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

View file

@ -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 {

View file

@ -188,7 +188,7 @@ public:
m_path[0] = 0;
}
void init (size_t length) {
void init (int32_t length) {
m_path = cr::makeUnique <int32_t[]> (length);
}
};

View file

@ -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 <int> () != 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);

View file

@ -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;