Minor fixes.

This commit is contained in:
jeefo 2019-08-12 22:51:26 +03:00
commit 858d247893
10 changed files with 37 additions and 57 deletions

View file

@ -644,7 +644,7 @@ void Bot::updatePickups () {
m_defendedBomb = true;
int index = findDefendNode (origin);
Path &path = graph[index];
const Path &path = graph[index];
float bombTimer = mp_c4timer.float_ ();
float timeMidBlowup = bots.getTimeBombPlanted () + (bombTimer * 0.5f + bombTimer * 0.25f) - graph.calculateTravelTime (pev->maxspeed, pev->origin, path.origin);
@ -717,7 +717,7 @@ void Bot::updatePickups () {
m_defendedBomb = true;
int index = findDefendNode (origin);
Path &path = graph[index];
const Path &path = graph[index];
float timeToExplode = bots.getTimeBombPlanted () + mp_c4timer.float_ () - graph.calculateTravelTime (pev->maxspeed, pev->origin, path.origin);
@ -824,7 +824,7 @@ void Bot::getCampDirection (Vector *dest) {
float minDistance = kInfiniteDistance;
int lookAtWaypoint = kInvalidNodeIndex;
Path &path = graph[tempIndex];
const Path &path = graph[tempIndex];
for (auto &link : path.links) {
if (link.index == kInvalidNodeIndex) {
@ -2472,7 +2472,7 @@ void Bot::checkRadioQueue () {
switch (getCurrentTaskId ()) {
case Task::Normal:
if (getTask ()->data != kInvalidNodeIndex && rg.chance (70)) {
Path &path = graph[getTask ()->data];
const Path &path = graph[getTask ()->data];
if (path.flags & NodeFlag::Goal) {
if (game.mapIs (MapFlags::Demolition) && m_team == Team::Terrorist && m_hasC4) {
@ -5003,7 +5003,7 @@ void Bot::showDebugOverlay () {
game.drawLine (game.getLocalEntity (), getEyesPos () - Vector (0.0f, 0.0f, 32.0f), getEyesPos () + pev->v_angle.forward () * 300.0f, 10, 0, Color (255, 0, 0), 250, 5, 1, DrawLine::Arrow);
// now draw line from source to destination
for (size_t i = m_pathWalk.cursor (); i < m_pathWalk.length () && i + 1 < m_pathWalk.length (); ++i) {
for (size_t i = 0; i < m_pathWalk.length () && i + 1 < m_pathWalk.length (); ++i) {
game.drawLine (game.getLocalEntity (), graph[m_pathWalk.at (i)].origin, graph[m_pathWalk.at (i + 1)].origin, 15, 0, Color (255, 100, 55), 200, 5, 1, DrawLine::Arrow);
}
}

View file

@ -1169,7 +1169,7 @@ int BotControl::menuGraphPage2 (int item) {
int noHostagePoints = 0;
for (int i = 0; i < graph.length (); ++i) {
Path &path = graph[i];
const Path &path = graph[i];
if (path.flags & NodeFlag::TerroristOnly) {
++terrPoints;

View file

@ -1604,7 +1604,7 @@ bool BotGraph::loadGraphData () {
addToBucket (path.origin, path.number);
}
if (outOptions & StorageOption::Official) {
if ((outOptions & StorageOption::Official) || memcmp (blob, "official", 8) == 0) {
m_tempStrings.assign ("Using Official Graph File");
}
else {

View file

@ -612,7 +612,7 @@ CR_EXPORT int GetEngineFunctions (enginefuncs_t *functionTable, int *) {
functionTable->pfnMessageBegin = [] (int msgDest, int msgType, const float *origin, edict_t *ed) {
// this function called each time a message is about to sent.
msgs.start (ed, msgDest, msgType);
msgs.start (ed, msgType);
if (game.is (GameFlags::Metamod)) {
RETURN_META (MRES_IGNORED);

View file

@ -128,8 +128,8 @@ void MessageDispatcher::netMsgWeaponList () {
return;
}
// register prop
WeaponProp prop {
// store away this weapon with it's ammo information...
conf.getWeaponProp (m_args[id].long_) = {
m_args[classname].chars_,
m_args[ammo_index_1].long_,
m_args[max_ammo_1].long_,
@ -138,7 +138,6 @@ void MessageDispatcher::netMsgWeaponList () {
m_args[id].long_,
m_args[flags].long_
};
conf.setWeaponProp (cr::move (prop)); // store away this weapon with it's ammo information...
}
void MessageDispatcher::netMsgCurWeapon () {
@ -454,7 +453,7 @@ void MessageDispatcher::registerMessage (const String &name, int32 id) {
m_maps[m_wanted[name]] = id; // add message from engine RegUserMsg
}
void MessageDispatcher::start (edict_t *ent, int32 dest, int32 type) {
void MessageDispatcher::start (edict_t *ent, int32 type) {
reset ();
// search if we need to handle this message
@ -470,13 +469,8 @@ void MessageDispatcher::start (edict_t *ent, int32 dest, int32 type) {
return;
}
// broadcast message ?
if (dest == MSG_ALL || dest == MSG_SPEC || dest == MSG_BROADCAST) {
m_broadcast = true;
}
// message for bot bot?
if (ent && (ent->v.flags & FL_FAKECLIENT) && !(ent->v.flags & FL_DORMANT)) {
if (!game.isNullEntity (ent) && !(ent->v.flags & FL_DORMANT)) {
m_bot = bots[ent];
if (!m_bot) {

View file

@ -2196,8 +2196,8 @@ bool Bot::advanceMovement () {
if (m_pathWalk.hasNext ()) {
auto nextIndex = m_pathWalk.next ();
Path &path = graph[destIndex];
Path &next = graph[nextIndex];
const Path &path = graph[destIndex];
const Path &next = graph[nextIndex];
for (const auto &link : path.links) {
if (link.index == nextIndex && (link.flags & PathFlag::Jump)) {
@ -2804,7 +2804,7 @@ int Bot::findCampingDirection () {
if (currentNode == i || !graph.isVisible (currentNode, i)) {
continue;
}
Path &path = graph[i];
const Path &path = graph[i];
if (count < 3) {
indices[count] = i;