From 54516190b0215588befcd6d33c48ccc1fb7db1f0 Mon Sep 17 00:00:00 2001 From: jeefo Date: Sat, 30 Nov 2019 23:18:37 +0300 Subject: [PATCH] Cosmetic changes for messages before translation. --- source/basecode.cpp | 2 +- source/control.cpp | 26 +++++++++++------------ source/graph.cpp | 52 ++++++++++++++++++++++----------------------- source/manager.cpp | 10 ++++----- source/navigate.cpp | 28 +++++++++++------------- 5 files changed, 56 insertions(+), 62 deletions(-) diff --git a/source/basecode.cpp b/source/basecode.cpp index fff6607..bf36102 100644 --- a/source/basecode.cpp +++ b/source/basecode.cpp @@ -3559,7 +3559,7 @@ void Bot::camp_ () { for (int i = 0; i < graph.length (); ++i) { // skip invisible waypoints or current waypoint - if (!graph.isVisible (m_currentNodeIndex, i) || (i == m_currentNodeIndex)) { + if (!graph.isVisible (m_currentNodeIndex, i) || i == m_currentNodeIndex) { continue; } const Vector &dotB = (graph[i].origin - pev->origin).normalize2d (); diff --git a/source/control.cpp b/source/control.cpp index 1374f28..7d02476 100644 --- a/source/control.cpp +++ b/source/control.cpp @@ -124,7 +124,7 @@ int BotControl::cmdVote () { for (const auto &bot : bots) { bot->m_voteMap = mapID; } - msg ("All dead bots will vote for map #%d", mapID); + msg ("All dead bots will vote for map #%d.", mapID); return BotCommandResult::Handled; } @@ -292,9 +292,7 @@ int BotControl::cmdCvars () { } if (isSave) { - ctrl.msg ("Bots cvars has been written to file."); - - + msg ("Bots cvars has been written to file."); cfg.close (); } return BotCommandResult::Handled; @@ -567,10 +565,10 @@ int BotControl::cmdNodeDelete () { // check for existence if (graph.exists (index)) { graph.erase (index); - msg ("Node #%d has beed deleted.", index); + msg ("Node %d has beed deleted.", index); } else { - msg ("Could not delete node #%d.", index); + msg ("Could not delete node %d.", index); } } return BotCommandResult::Handled; @@ -610,10 +608,10 @@ int BotControl::cmdNodeCache () { // check for existence if (graph.exists (index)) { graph.cachePoint (index); - msg ("Node #%d has been put into the memory.", index); + msg ("Node %d has been put into the memory.", index); } else { - msg ("Could not put node #%d into the memory.", index); + msg ("Could not put node %d into the memory.", index); } } return BotCommandResult::Handled; @@ -640,7 +638,7 @@ int BotControl::cmdNodeClean () { else if (getStr (option) == "empty" || getStr (option) == "nearest") { int removed = graph.clearConnections (graph.getEditorNeareset ()); - msg ("Done. Processed node #%d. %d useless paths was cleared.", graph.getEditorNeareset (), removed); + msg ("Done. Processed node %d. %d useless paths was cleared.", graph.getEditorNeareset (), removed); } else { int index = getInt (option); @@ -649,10 +647,10 @@ int BotControl::cmdNodeClean () { if (graph.exists (index)) { int removed = graph.clearConnections (index); - msg ("Done. Processed node #%d. %d useless paths was cleared.", index, removed); + msg ("Done. Processed node %d. %d useless paths was cleared.", index, removed); } else { - msg ("Could not process node #%d clearance.", index); + msg ("Could not process node %d clearance.", index); } } return BotCommandResult::Handled; @@ -679,7 +677,7 @@ int BotControl::cmdNodeSetRadius () { float value = getStr (radius).float_ (); graph.setRadius (radiusIndex, value); - msg ("Node #%d has been set to radius %.2f.", radiusIndex, value); + msg ("Node %d has been set to radius %.2f.", radiusIndex, value); return BotCommandResult::Handled; } @@ -713,13 +711,13 @@ int BotControl::cmdNodeTeleport () { if (graph.exists (index)) { engfuncs.pfnSetOrigin (graph.getEditor (), graph[index].origin); - msg ("You have been teleported to node #%d.", index); + msg ("You have been teleported to node %d.", index); // turn graph on graph.setEditFlag (GraphEdit::On | GraphEdit::Noclip); } else { - msg ("Could not teleport to node #%d.", index); + msg ("Could not teleport to node %d.", index); } return BotCommandResult::Handled; } diff --git a/source/graph.cpp b/source/graph.cpp index 8ff9879..55275c2 100644 --- a/source/graph.cpp +++ b/source/graph.cpp @@ -94,7 +94,7 @@ int BotGraph::clearConnections (int index) { } if (top.number == kInvalidNodeIndex) { - ctrl.msg ("Cannot find path to the closest connected node to node number %d!\n", index); + ctrl.msg ("Cannot find path to the closest connected node to node number %d.", index); return numFixedLinks; } bool sorting = false; @@ -395,7 +395,7 @@ void BotGraph::addPath (int addIndex, int pathIndex, float distance) { // don't allow paths get connected twice for (const auto &link : path.links) { if (link.index == pathIndex) { - ctrl.msg ("Denied path creation from %d to %d (path already exists)", addIndex, pathIndex); + ctrl.msg ("Denied path creation from %d to %d (path already exists).", addIndex, pathIndex); return; } } @@ -406,7 +406,7 @@ void BotGraph::addPath (int addIndex, int pathIndex, float distance) { link.index = static_cast (pathIndex); link.distance = cr::abs (static_cast (distance)); - ctrl.msg ("Path added from %d to %d", addIndex, pathIndex); + ctrl.msg ("Path added from %d to %d.", addIndex, pathIndex); return; } } @@ -423,7 +423,7 @@ void BotGraph::addPath (int addIndex, int pathIndex, float distance) { } if (slot != kInvalidNodeIndex) { - ctrl.msg ("Path added from %d to %d", addIndex, pathIndex); + ctrl.msg ("Path added from %d to %d.", addIndex, pathIndex); path.links[slot].index = static_cast (pathIndex); path.links[slot].distance = cr::abs (static_cast (distance)); @@ -571,7 +571,7 @@ void BotGraph::add (int type, const Vector &pos) { path = &m_paths[index]; if (!(path->flags & NodeFlag::Camp)) { - ctrl.msg ("This is not Camping Node"); + ctrl.msg ("This is not camping node."); return; } path->end = m_editor->v.v_angle.get2d (); @@ -864,7 +864,7 @@ void BotGraph::toggleFlags (int toggleFlag) { } else if (!(m_paths[index].flags & toggleFlag)) { if (toggleFlag == NodeFlag::Sniper && !(m_paths[index].flags & NodeFlag::Camp)) { - ctrl.msg ("Cannot assign sniper flag to node #%d. This is not camp node.", index); + ctrl.msg ("Cannot assign sniper flag to node %d. This is not camp node.", index); return; } m_paths[index].flags |= toggleFlag; @@ -954,7 +954,7 @@ void BotGraph::pathCreate (char dir) { int nodeFrom = getEditorNeareset (); if (nodeFrom == kInvalidNodeIndex) { - ctrl.msg ("Unable to find nearest node in 50 units"); + ctrl.msg ("Unable to find nearest node in 50 units."); return; } int nodeTo = m_facingAtIndex; @@ -970,7 +970,7 @@ void BotGraph::pathCreate (char dir) { } if (nodeTo == nodeFrom) { - ctrl.msg ("Unable to connect node with itself"); + ctrl.msg ("Unable to connect node with itself."); return; } @@ -1053,7 +1053,7 @@ void BotGraph::cachePoint (int index) { return; } m_cacheNodeIndex = node; - ctrl.msg ("Node #%d has been put into memory.", m_cacheNodeIndex); + ctrl.msg ("Node %d has been put into memory.", m_cacheNodeIndex); } void BotGraph::calculatePathRadius (int index) { @@ -1401,7 +1401,7 @@ template bool BotGraph::saveStorage (const String &ext, const Strin filename.assignf ("%s.%s", game.getMapName (), ext.chars ()); if (data.empty ()) { - logger.error ("Unable to save %s file. Empty data. (filename: '%s')", name.chars (), filename.chars ()); + logger.error ("Unable to save %s file. Empty data. (filename: '%s').", name.chars (), filename.chars ()); return false; } else if (isGraph) { @@ -1416,7 +1416,7 @@ template bool BotGraph::saveStorage (const String &ext, const Strin // no open no fun if (!file) { - logger.error ("Unable to open %s file for writing (filename: '%s')", name.chars (), filename.chars ()); + logger.error ("Unable to open %s file for writing (filename: '%s').", name.chars (), filename.chars ()); file.close (); return false; @@ -1449,7 +1449,7 @@ template bool BotGraph::saveStorage (const String &ext, const Strin game.print ("Successfully saved Bots %s data.", name.chars ()); } else { - logger.error ("Unable to compress %s data (filename: '%s')", name.chars (), filename.chars ()); + logger.error ("Unable to compress %s data (filename: '%s').", name.chars (), filename.chars ()); file.close (); return false; @@ -1521,7 +1521,7 @@ template bool BotGraph::loadStorage (const String &ext, const Strin return true; } else { - game.print ("Can't download '%s'. from '%s' to '%s'... (%d)", filename.chars (), fromDownload, toDownload, http.getLastStatusCode ()); + game.print ("Can't download '%s'. from '%s' to '%s'... (%d).", filename.chars (), fromDownload, toDownload, http.getLastStatusCode ()); } return false; }; @@ -2323,14 +2323,14 @@ bool BotGraph::checkNodes (bool teleportPlayer) { int connections = 0; if (path.number != static_cast (m_paths.index (path))) { - ctrl.msg ("Node %d path differs from index %d!", path.number, m_paths.index (path)); + ctrl.msg ("Node %d path differs from index %d.", path.number, m_paths.index (path)); break; } for (const auto &test : path.links) { if (test.index != kInvalidNodeIndex) { if (test.index > length ()) { - ctrl.msg ("Node %d connected with invalid Node #%d!", path.number, test.index); + ctrl.msg ("Node %d connected with invalid node %d.", path.number, test.index); return false; } ++connections; @@ -2340,14 +2340,14 @@ bool BotGraph::checkNodes (bool teleportPlayer) { if (connections == 0) { if (!isConnected (path.number)) { - ctrl.msg ("Node %d isn't connected with any other Node!", path.number); + ctrl.msg ("Node %d isn't connected with any other node.", path.number); return false; } } if (path.flags & NodeFlag::Camp) { if (path.end.empty ()) { - ctrl.msg ("Node %d Camp-Endposition not set!", path.number); + ctrl.msg ("Node %d camp-endposition not set.", path.number); return false; } } @@ -2367,13 +2367,13 @@ bool BotGraph::checkNodes (bool teleportPlayer) { for (const auto &test : path.links) { if (test.index != kInvalidNodeIndex) { if (!exists (test.index)) { - ctrl.msg ("Node %d - Pathindex %d out of Range!", path.number, test.index); + ctrl.msg ("Node %d path index %d out of range.", path.number, test.index); teleport (path); return false; } else if (test.index == path.number) { - ctrl.msg ("Node %d - Pathindex %d points to itself!", path.number, test.index); + ctrl.msg ("Node %d path index %d points to itself.", path.number, test.index); teleport (path); return false; @@ -2384,20 +2384,20 @@ bool BotGraph::checkNodes (bool teleportPlayer) { if (game.mapIs (MapFlags::HostageRescue)) { if (rescuePoints == 0) { - ctrl.msg ("You didn't set a Rescue Point!"); + ctrl.msg ("You didn't set a rescue point."); return false; } } if (terrPoints == 0) { - ctrl.msg ("You didn't set any Terrorist Important Point!"); + ctrl.msg ("You didn't set any terrorist important point."); return false; } else if (ctPoints == 0) { - ctrl.msg ("You didn't set any CT Important Point!"); + ctrl.msg ("You didn't set any CT important point."); return false; } else if (goalPoints == 0) { - ctrl.msg ("You didn't set any Goal Point!"); + ctrl.msg ("You didn't set any goal point."); return false; } @@ -2432,7 +2432,7 @@ bool BotGraph::checkNodes (bool teleportPlayer) { for (const auto &path : m_paths) { if (!visited[path.number]) { - ctrl.msg ("Path broken from Node #0 to Node #%d!", path.number); + ctrl.msg ("Path broken from node 0 to node %d.", path.number); teleport (path); return false; @@ -2475,7 +2475,7 @@ bool BotGraph::checkNodes (bool teleportPlayer) { for (const auto &path : m_paths) { if (!visited[path.number]) { - ctrl.msg ("Path broken from Node #%d to Node #0!", path.number); + ctrl.msg ("Path broken from node %d to node 0.", path.number); teleport (path); return false; @@ -2663,7 +2663,7 @@ void BotGraph::setSearchIndex (int index) { m_findWPIndex = index; if (exists (m_findWPIndex)) { - ctrl.msg ("Showing Direction to Node #%d", m_findWPIndex); + ctrl.msg ("Showing direction to node %d.", m_findWPIndex); } else { m_findWPIndex = kInvalidNodeIndex; diff --git a/source/manager.cpp b/source/manager.cpp index 3790c59..4356549 100644 --- a/source/manager.cpp +++ b/source/manager.cpp @@ -493,7 +493,7 @@ void BotManager::serverFill (int selection, int personality, int difficulty, int for (int i = 0; i <= toAdd; ++i) { addbot ("", difficulty, personality, selection, -1, true); } - ctrl.msg ("Fill Server with %s bots...", &teams[selection][0]); + ctrl.msg ("Fill server with %s bots...", &teams[selection][0]); } void BotManager::kickEveryone (bool instant, bool zeroQuota) { @@ -539,7 +539,7 @@ void BotManager::killAllBots (int team) { } bot->kill (); } - ctrl.msg ("All Bots died !"); + ctrl.msg ("All bots died..."); } void BotManager::kickBot (int index) { @@ -675,7 +675,7 @@ void BotManager::setWeaponMode (int selection) { } yb_jasonmode.set (selection == 0 ? 1 : 0); - ctrl.msg ("%s weapon mode selected", &modes[selection][0]); + ctrl.msg ("%s weapon mode selected.", &modes[selection][0]); } void BotManager::listBots () { @@ -1282,7 +1282,7 @@ void Bot::kick () { pev->flags &= ~FL_FAKECLIENT; game.serverCommand ("kick \"%s\"", username); - ctrl.msg ("Bot '%s' kicked", username); + ctrl.msg ("Bot '%s' kicked.", username); } void Bot::updateTeamJoin () { @@ -2075,7 +2075,7 @@ void BotConfig::loadLanguageConfig () { if (game.isDedicated () || game.is (GameFlags::Legacy)) { if (game.is (GameFlags::Legacy)) { - logger.message ("Bots multilingual system disabled, due to your Counter-Strike Version!"); + logger.message ("Bots multilingual system disabled, due to your Counter-Strike version!"); } return; // dedicated server will use only english translation } diff --git a/source/navigate.cpp b/source/navigate.cpp index 160d2e6..0e27157 100644 --- a/source/navigate.cpp +++ b/source/navigate.cpp @@ -1158,11 +1158,11 @@ void Bot::findShortestPath (int srcIndex, int destIndex) { // this function finds the shortest path from source index to destination index if (!graph.exists (srcIndex)){ - logger.error ("Pathfinder source path index not valid (%d)", srcIndex); + logger.error ("Pathfinder source path index not valid (%d).", srcIndex); return; } else if (!graph.exists (destIndex)) { - logger.error ("Pathfinder destination path index not valid (%d)", destIndex); + logger.error ("Pathfinder destination path index not valid (%d).", destIndex); return; } clearSearchNodes (); @@ -1366,11 +1366,11 @@ void Bot::findPath (int srcIndex, int destIndex, FindPath pathType /*= FindPath: } if (!graph.exists (srcIndex)) { - logger.error ("Pathfinder source path index not valid (%d)", srcIndex); + logger.error ("Pathfinder source path index not valid (%d).", srcIndex); return; } else if (!graph.exists (destIndex)) { - logger.error ("Pathfinder destination path index not valid (%d)", destIndex); + logger.error ("Pathfinder destination path index not valid (%d).", destIndex); return; } clearSearchNodes (); @@ -2698,19 +2698,17 @@ bool Bot::isDeadlyMove (const Vector &to) { return false; } -#ifdef DEAD_CODE - void Bot::changePitch (float speed) { // this function turns a bot towards its ideal_pitch - float idealPitch = AngleNormalize (pev->idealpitch); - float curent = AngleNormalize (pev->v_angle.x); + float idealPitch = cr::normalizeAngles (pev->idealpitch); + float curent = cr::normalizeAngles (pev->v_angle.x); // turn from the current v_angle pitch to the idealpitch by selecting // the quickest way to turn to face that direction // find the difference in the curent and ideal angle - float normalizePitch = AngleNormalize (idealPitch - curent); + float normalizePitch = cr::normalizeAngles (idealPitch - curent); if (normalizePitch > 0.0f) { if (normalizePitch > speed) { @@ -2723,7 +2721,7 @@ void Bot::changePitch (float speed) { } } - pev->v_angle.x = AngleNormalize (curent + normalizePitch); + pev->v_angle.x = cr::normalizeAngles (curent + normalizePitch); if (pev->v_angle.x > 89.9f) { pev->v_angle.x = 89.9f; @@ -2738,14 +2736,14 @@ void Bot::changePitch (float speed) { void Bot::changeYaw (float speed) { // this function turns a bot towards its ideal_yaw - float idealPitch = AngleNormalize (pev->ideal_yaw); - float curent = AngleNormalize (pev->v_angle.y); + float idealPitch = cr::normalizeAngles (pev->ideal_yaw); + float curent = cr::normalizeAngles (pev->v_angle.y); // turn from the current v_angle yaw to the ideal_yaw by selecting // the quickest way to turn to face that direction // find the difference in the curent and ideal angle - float normalizePitch = AngleNormalize (idealPitch - curent); + float normalizePitch = cr::normalizeAngles (idealPitch - curent); if (normalizePitch > 0.0f) { if (normalizePitch > speed) { @@ -2757,12 +2755,10 @@ void Bot::changeYaw (float speed) { normalizePitch = -speed; } } - pev->v_angle.y = AngleNormalize (curent + normalizePitch); + pev->v_angle.y = cr::normalizeAngles (curent + normalizePitch); pev->angles.y = pev->v_angle.y; } -#endif - int Bot::findCampingDirection () { // find a good node to look at when camping