Cleanup.
This commit is contained in:
parent
e4b975c289
commit
359d2f86b0
2 changed files with 13 additions and 16 deletions
|
|
@ -47,7 +47,7 @@ private:
|
||||||
StringArray m_args;
|
StringArray m_args;
|
||||||
Array <BotCmd> m_cmds;
|
Array <BotCmd> m_cmds;
|
||||||
Array <BotMenu> m_menus;
|
Array <BotMenu> m_menus;
|
||||||
IntArray m_campPoints;
|
IntArray m_campIterator;
|
||||||
|
|
||||||
edict_t *m_ent;
|
edict_t *m_ent;
|
||||||
Bot *m_djump;
|
Bot *m_djump;
|
||||||
|
|
@ -56,7 +56,6 @@ private:
|
||||||
bool m_rapidOutput;
|
bool m_rapidOutput;
|
||||||
bool m_isMenuFillCommand;
|
bool m_isMenuFillCommand;
|
||||||
|
|
||||||
int m_campPointsIndex;
|
|
||||||
int m_menuServerFillTeam;
|
int m_menuServerFillTeam;
|
||||||
int m_interMenuData[4] = { 0, };
|
int m_interMenuData[4] = { 0, };
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -895,43 +895,42 @@ int BotControl::cmdNodeIterateCamp () {
|
||||||
return BotCommandResult::BadFormat;
|
return BotCommandResult::BadFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((op == "next" || op == "end") && m_campPointsIndex == kInvalidNodeIndex) {
|
if ((op == "next" || op == "end") && m_campIterator.empty ()) {
|
||||||
msg ("Before calling for 'next' / 'end' camp point, you should hit 'begin'.");
|
msg ("Before calling for 'next' / 'end' camp point, you should hit 'begin'.");
|
||||||
return BotCommandResult::Handled;
|
return BotCommandResult::Handled;
|
||||||
}
|
}
|
||||||
else if (op == "begin" && m_campPointsIndex != kInvalidNodeIndex) {
|
else if (op == "begin" && !m_campIterator.empty ()) {
|
||||||
msg ("Before calling for 'begin' camp point, you should hit 'end'.");
|
msg ("Before calling for 'begin' camp point, you should hit 'end'.");
|
||||||
return BotCommandResult::Handled;
|
return BotCommandResult::Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (op == "end") {
|
if (op == "end") {
|
||||||
m_campPointsIndex = kInvalidNodeIndex;
|
m_campIterator.clear ();
|
||||||
m_campPoints.clear ();
|
|
||||||
}
|
}
|
||||||
else if (op == "next") {
|
else if (op == "next") {
|
||||||
if (m_campPointsIndex < static_cast <int> (m_campPoints.length ())) {
|
if (!m_campIterator.empty ()) {
|
||||||
Vector origin = graph[m_campPoints[m_campPointsIndex]].origin;
|
Vector origin = graph[m_campIterator.first ()].origin;
|
||||||
|
|
||||||
if (graph[m_campPoints[m_campPointsIndex]].flags & NodeFlag::Crouch) {
|
if (graph[m_campIterator.first ()].flags & NodeFlag::Crouch) {
|
||||||
origin.z += 23.0f;
|
origin.z += 23.0f;
|
||||||
}
|
}
|
||||||
engfuncs.pfnSetOrigin (m_ent, origin);
|
engfuncs.pfnSetOrigin (m_ent, origin);
|
||||||
|
|
||||||
|
// go to next
|
||||||
|
m_campIterator.shift ();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_campPoints.clear ();
|
m_campIterator.clear ();
|
||||||
m_campPointsIndex = kInvalidNodeIndex;
|
|
||||||
|
|
||||||
msg ("Finished iterating camp spots.");
|
msg ("Finished iterating camp spots.");
|
||||||
}
|
}
|
||||||
++m_campPointsIndex;
|
|
||||||
}
|
}
|
||||||
else if (op == "begin") {
|
else if (op == "begin") {
|
||||||
for (int i = 0; i < graph.length (); ++i) {
|
for (int i = 0; i < graph.length (); ++i) {
|
||||||
if (graph[i].flags & NodeFlag::Camp) {
|
if (graph[i].flags & NodeFlag::Camp) {
|
||||||
m_campPoints.push (i);
|
m_campIterator.push (i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_campPointsIndex = 0;
|
msg ("Ready for iteration. Type 'next' to go to first camp node.");
|
||||||
}
|
}
|
||||||
return BotCommandResult::Handled;
|
return BotCommandResult::Handled;
|
||||||
}
|
}
|
||||||
|
|
@ -1937,7 +1936,6 @@ BotControl::BotControl () {
|
||||||
m_isMenuFillCommand = false;
|
m_isMenuFillCommand = false;
|
||||||
m_rapidOutput = false;
|
m_rapidOutput = false;
|
||||||
m_menuServerFillTeam = 5;
|
m_menuServerFillTeam = 5;
|
||||||
m_campPointsIndex = kInvalidNodeIndex;
|
|
||||||
|
|
||||||
m_cmds.emplace ("add/addbot/add_ct/addbot_ct/add_t/addbot_t/addhs/addhs_t/addhs_ct", "add [difficulty[personality[team[model[name]]]]]", "Adding specific bot into the game.", &BotControl::cmdAddBot);
|
m_cmds.emplace ("add/addbot/add_ct/addbot_ct/add_t/addbot_t/addhs/addhs_t/addhs_ct", "add [difficulty[personality[team[model[name]]]]]", "Adding specific bot into the game.", &BotControl::cmdAddBot);
|
||||||
m_cmds.emplace ("kick/kickone/kick_ct/kick_t/kickbot_ct/kickbot_t", "kick [team]", "Kicks off the random bot from the game.", &BotControl::cmdKickBot);
|
m_cmds.emplace ("kick/kickone/kick_ct/kick_t/kickbot_ct/kickbot_t", "kick [team]", "Kicks off the random bot from the game.", &BotControl::cmdKickBot);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue