Skip to content

Commit

Permalink
fix(typo): Fix typos in code comments (endless-sky#9461)
Browse files Browse the repository at this point in the history
  • Loading branch information
tibetiroka authored Oct 18, 2023
1 parent a22cdbd commit fe4b256
Show file tree
Hide file tree
Showing 30 changed files with 35 additions and 36 deletions.
2 changes: 1 addition & 1 deletion source/AI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3040,7 +3040,7 @@ void AI::DoPatrol(Ship &ship, Command &command) const
// Hacky way of differentiating ship behaviour without additional storage,
// while keeping it consistent for each ship. TODO: change when Ship::SetTargetLocation exists.
// This uses the pointer of the ship to choose a pseudo-random angle and instructs it to
// partol the system in a criss-crossing pattern, where each turn is this specific angle.
// patrol the system in a criss-crossing pattern, where each turn is this specific angle.
intptr_t seed = reinterpret_cast<intptr_t>(&ship);
int behaviour = abs(seed % 23);
Angle delta = Angle(360. / (behaviour / 2. + 2.) * (behaviour % 2 ? -1. : 1.));
Expand Down
4 changes: 2 additions & 2 deletions source/CargoHold.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ int CargoHold::Transfer(const string &commodity, int amount, CargoHold &to)

// Remove up to the specified tons of cargo from this cargo hold, adding
// them to the given cargo hold if possible. If not possible, add the
// remainder back to this cargo hold, even if there is not space for it.
// remainder back to this cargo hold, even if there is no space for it.
// Do not invalidate existing iterators by modifying the container.
int removed = Remove(commodity, amount);
int added = to.Add(commodity, removed);
Expand All @@ -397,7 +397,7 @@ int CargoHold::Transfer(const Outfit *outfit, int amount, CargoHold &to)

// Remove up to the specified number of items from this cargo hold, adding
// them to the given cargo hold if possible. If not possible, add the
// remainder back to this cargo hold, even if there is not space for it.
// remainder back to this cargo hold, even if there is no space for it.
// Do not invalidate existing iterators by modifying the container.
int removed = Remove(outfit, amount);
int added = to.Add(outfit, removed);
Expand Down
2 changes: 1 addition & 1 deletion source/CategoryList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void CategoryList::Load(const DataNode &node)
currentPrecedence = child.Value(1);
Category cat(child.Token(0), currentPrecedence++);

// If a given category name already exists, its prescedence will be updated.
// If a given category name already exists, its precedence will be updated.
auto it = find_if(list.begin(), list.end(),
[&cat](const Category &c) noexcept -> bool { return cat.name == c.name; });
if(it != list.end())
Expand Down
2 changes: 1 addition & 1 deletion source/CategoryList.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class DataNode;

// A CategoryList is a list of names that are associated to a Category of items (e.g. ships
// or outfits). Categories within the list are sorted by the precedence of each Category.
// Any conflicting precedencies are resolved by sorting the names of the Categories
// Any conflicting precedences are resolved by sorting the names of the Categories
// alphabetically.
class CategoryList {
public:
Expand Down
2 changes: 1 addition & 1 deletion source/ConditionsStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ConditionsStore {
void SetEraseFunction(std::function<bool(const std::string &)> newEraseFun);

public:
// This is intented as a private constructor, only to be called from within
// This is intended as a private constructor, only to be called from within
// ConditionsStore. But we need to keep it public because of how the
// DerivedProviders are emplaced in the providers-map-variable.
DerivedProvider(const std::string &name, bool isPrefixProvider);
Expand Down
2 changes: 1 addition & 1 deletion source/Conversation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ void Conversation::Save(DataWriter &out) const
out.Write(line);
// If the conditions are the same, output them for each
// paragraph. (We currently don't merge paragraphs with
// identical ConditionSets, but some day we might.
// identical ConditionSets, but some day we might.)
if(!it.conditions.IsEmpty())
{
out.BeginChild();
Expand Down
3 changes: 1 addition & 2 deletions source/Conversation.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ class Conversation {
std::vector<Element> elements;
// This distinguishes "choice" nodes from "branch" or text nodes. If
// this value is false, a one-element node is considered text, and a
// node with more than one element is considered is considered a
// "branch".
// node with more than one element is considered a "branch".
bool isChoice;
// Keep track of whether it's possible to merge future nodes onto this.
bool canMergeOnto;
Expand Down
2 changes: 1 addition & 1 deletion source/ConversationPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ template <class T>
// Get the height of this paragraph.
int Height() const;
// Get the "center point" of this paragraph. This is for drawing a
// highlight under paragraphcs that represent choices.
// highlight under paragraphs that represent choices.
Point Center() const;
// Draw this paragraph at the given point, and return the point that the
// next paragraph below this one should be drawn at.
Expand Down
2 changes: 1 addition & 1 deletion source/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1961,7 +1961,7 @@ void Engine::HandleKeyboardInputs()
{
// Translate shift+BACK to a command to a STOP command to stop all movement of the flagship.
// Translation is done here to allow the autopilot (which will execute the STOP-command) to
// act on a single STOP command instead of the shift+BACK modifier).
// act on a single STOP command instead of the shift+BACK modifier.
if(keyHeld.Has(Command::BACK))
{
activeCommands |= Command::STOP;
Expand Down
2 changes: 1 addition & 1 deletion source/Fleet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ void Fleet::Enter(const System &system, list<shared_ptr<Ship>> &ships, const Pla
if(object.GetPlanet() == planet)
stellarObjects.push_back(&object);

// If the souce planet isn't in the source for some reason, bail out.
// If the source planet isn't in the source for some reason, bail out.
if(stellarObjects.empty())
{
// Log this error.
Expand Down
2 changes: 1 addition & 1 deletion source/GameEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ map<string, set<string>> GameEvent::DeferredDefinitions(const list<DataNode> &ch
definitions[key].emplace(name);
}
// Since this (or any other) event may be used to assign a planet to a system, we cannot
// do a robust "planet definition" check. Similarly, all other GameEvent-createable objects
// do a robust "planet definition" check. Similarly, all other GameEvent-creatable objects
// become valid once they appear as a root-level node that has at least one child node.
else
definitions[key].emplace(name);
Expand Down
2 changes: 1 addition & 1 deletion source/ImageBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ namespace {
return false;
}

// Adjust settings to make sure the result will be a RGBA file.
// Adjust settings to make sure the result will be an RGBA file.
int colorType = png_get_color_type(png, info);
int bitDepth = png_get_bit_depth(png, info);

Expand Down
2 changes: 1 addition & 1 deletion source/MapDetailPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ this program. If not, see <https://www.gnu.org/licenses/>.
using namespace std;

namespace {
// Convert the angle between two vectors into a sortable angle, i.e an angle
// Convert the angle between two vectors into a sortable angle, i.e. an angle
// plus a length that is used as a tie-breaker.
pair<double, double> SortAngle(const Point &reference, const Point &point)
{
Expand Down
2 changes: 1 addition & 1 deletion source/MapPlanetCard.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class MapPlanetCard {
explicit MapPlanetCard(const StellarObject &object, unsigned number, bool hasVisited);
// Return if this one was clicked, whether or not we did something about it.
ClickAction Click(int x, int y, int clicks);
// Draw this at the corresponding scoll; if it is not outside bounds, and return if we drew it.
// Draw this at the corresponding scroll; if it is not outside bounds, and return if we drew it.
bool DrawIfFits(const Point &uiPoint);
// If this object is currently being shown.
bool IsShown() const;
Expand Down
2 changes: 1 addition & 1 deletion source/MapShipyardPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ double MapShipyardPanel::SystemValue(const System *system) const
if(!system || !player.HasVisited(*system))
return numeric_limits<double>::quiet_NaN();

// If there is a shipyard with parked ships, the order of precendence is
// If there is a shipyard with parked ships, the order of precedence is
// a selected parked ship, the shipyard, parked ships.

const auto &systemShips = parkedShips.find(system);
Expand Down
2 changes: 1 addition & 1 deletion source/MissionAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ bool MissionAction::CanBeDone(const PlayerInfo &player, const shared_ptr<Ship> &
continue;

// Outfits may always be taken from the flagship. If landed, they may also be taken from
// the collective cargohold of any in-system, non-disabled escorts (player.Cargo()). If
// the collective cargo hold of any in-system, non-disabled escorts (player.Cargo()). If
// boarding, consider only the flagship's cargo hold. If in-flight, show mission status
// by checking the cargo holds of ships that would contribute to player.Cargo if landed.
int available = flagship ? flagship->OutfitCount(it.first) : 0;
Expand Down
2 changes: 1 addition & 1 deletion source/OutfitterPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ this program. If not, see <https://www.gnu.org/licenses/>.
using namespace std;

namespace {
// Label for the decription field of the detail pane.
// Label for the description field of the detail pane.
const string DESCRIPTION = "description";

// Determine the refillable ammunition a particular ship consumes or stores.
Expand Down
2 changes: 1 addition & 1 deletion source/Phrase.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Phrase {
};


// A Part represents a the content contained by a "word", "phrase", or "replace" child node.
// A Part represents the content contained by a "word", "phrase", or "replace" child node.
class Part {
public:
// Sources of text, either literal or via phrase invocation.
Expand Down
4 changes: 2 additions & 2 deletions source/PlayerInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3993,7 +3993,7 @@ void PlayerInfo::SortAvailable()
// Tiebreaker for equal CONVENIENT is SPEED.
case SPEED:
{
// A higher "Speed" means the mission takes less time, ie. fewer
// A higher "Speed" means the mission takes less time, i.e. fewer
// jumps.
const int lJumps = lhs.ExpectedJumps();
const int rJumps = rhs.ExpectedJumps();
Expand All @@ -4010,7 +4010,7 @@ void PlayerInfo::SortAvailable()
else
{
// Negative values indicate indeterminable mission paths.
// eg. through a wormhole, meaning lower values are worse.
// e.g. through a wormhole, meaning lower values are worse.

// A value of 0 indicates the mission destination is the
// source, implying the actual path is complicated; consider
Expand Down
2 changes: 1 addition & 1 deletion source/Plugins.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct Plugin {

// Whether this plugin was enabled, i.e. if it was loaded by the game.
bool enabled = true;
// The current state state of the plugin.
// The current state of the plugin.
bool currentState = true;
};

Expand Down
2 changes: 1 addition & 1 deletion source/Preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ void Preferences::Load()
}

// For people updating from a version after 0.10.1 (where "Flagship flotsam collection" was added),
// but before 0.10.3 (when it was replaaced with "Flotsam Collection").
// but before 0.10.3 (when it was replaced with "Flotsam Collection").
it = settings.find("Flagship flotsam collection");
if(it != settings.end())
{
Expand Down
6 changes: 3 additions & 3 deletions source/Ship.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1821,12 +1821,12 @@ int Ship::Scan(const PlayerInfo &player)

// Total scan time is:
// Proportional to e^(0.5 * (distance / range)^2),
// which gives a guassian relation between scan speed and distance.
// which gives a gaussian relation between scan speed and distance.
// And proportional to: depth^(2 / 3),
// which means 8 times the cargo or outfit space takes 4 times as long to scan.
// Therefore, scan progress each step is proportional to the reciprocals of these values.
// This can be calculated by multiplying the exponents by -1.
// Progress = (e^(-0.5 * (distance / range)^2))*deptch^(-2 / 3).
// Progress = (e^(-0.5 * (distance / range)^2))*depth^(-2 / 3).

// Set a minimum scan range to avoid extreme values.
const double distanceExponent = -distanceSquared / max<double>(1e-3, 2. * scannerRangeSquared);
Expand Down Expand Up @@ -3220,7 +3220,7 @@ bool Ship::CanFire(const Weapon *weapon) const


// Fire the given weapon (i.e. deduct whatever energy, ammo, hull, shields
// or fuel it uses and add whatever heat it generates. Assume that CanFire()
// or fuel it uses and add whatever heat it generates). Assume that CanFire()
// is true.
void Ship::ExpendAmmo(const Weapon &weapon)
{
Expand Down
2 changes: 1 addition & 1 deletion source/Ship.h
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ class Ship : public Body, public std::enable_shared_from_this<Ship> {
// energy, ammo, and fuel to fire it).
bool CanFire(const Weapon *weapon) const;
// Fire the given weapon (i.e. deduct whatever energy, ammo, or fuel it uses
// and add whatever heat it generates. Assume that CanFire() is true.
// and add whatever heat it generates). Assume that CanFire() is true.
void ExpendAmmo(const Weapon &weapon);

// Each ship can have a target system (to travel to), a target planet (to
Expand Down
4 changes: 2 additions & 2 deletions source/ShipInfoDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ ShipInfoDisplay::ShipInfoDisplay(const Ship &ship, const PlayerInfo &player, boo


// Call this every time the ship changes.
// Panels that have scrolling abilities are not limited by space, allowing more detailled attributes.
// Panels that have scrolling abilities are not limited by space, allowing more detailed attributes.
void ShipInfoDisplay::Update(const Ship &ship, const PlayerInfo &player, bool descriptionCollapsed, bool scrollingPanel)
{
UpdateDescription(ship.Description(), ship.Attributes().Licenses(), true);
Expand Down Expand Up @@ -251,7 +251,7 @@ void ShipInfoDisplay::UpdateAttributes(const Ship &ship, const PlayerInfo &playe
attributeValues.push_back(Format::Number(60. * forwardThrust / ship.Drag()));
attributesHeight += 20;

// Movement stats are influenced by inertia redeuction.
// Movement stats are influenced by inertia reduction.
double reduction = 1. + attributes.Get("inertia reduction");
emptyMass /= reduction;
currentMass /= reduction;
Expand Down
2 changes: 1 addition & 1 deletion source/ShipyardPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class System;
using namespace std;

namespace {
// Label for the decription field of the detail pane.
// Label for the description field of the detail pane.
const string DESCRIPTION = "description";

// The name entry dialog should include a "Random" button to choose a random
Expand Down
2 changes: 1 addition & 1 deletion source/Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ namespace {
+ "\", or \"" + lastValidIt->second + '"';
}

// Prepare an keyboard input to one of the UIs.
// Prepare a keyboard input to one of the UIs.
bool KeyInputToEvent(const char *keyName, Uint16 modKeys)
{
// Construct the event to send (from keyboard code and modifiers)
Expand Down
2 changes: 1 addition & 1 deletion source/TextReplacements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void TextReplacements::Revert(TextReplacements &other)



// Add new text replacements to the given map after evaltuating all possible replacements.
// Add new text replacements to the given map after evaluating all possible replacements.
// This text replacement will overwrite the value of any existing keys in the given map
// if the map and this TextReplacements share a key.
void TextReplacements::Substitutions(map<string, string> &subs, const ConditionsStore &conditions) const
Expand Down
2 changes: 1 addition & 1 deletion source/TextReplacements.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class TextReplacements {
// Clear this TextReplacement's substitutions and insert the substitutions of other.
void Revert(TextReplacements &other);

// Add new text replacements to the given map after evaltuating all possible replacements.
// Add new text replacements to the given map after evaluating all possible replacements.
// This TextReplacements will overwrite the value of any existing keys in the given map
// if the map and this TextReplacements share a key.
void Substitutions(std::map<std::string, std::string> &subs, const ConditionsStore &conditions) const;
Expand Down
2 changes: 1 addition & 1 deletion source/Weather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Weather::Weather(const Hazard *hazard, int totalLifetime, int lifetimeRemaining,
{
// Using a deviation of totalLifetime / 4.3 causes the strength of the
// weather to start and end at about 10% the maximum. Store the entire
// denominator of the exponent for the normal curve euqation here since
// denominator of the exponent for the normal curve equation here since
// this doesn't change with the elapsed time.
deviation = totalLifetime / 4.3;
deviation = 2. * deviation * deviation;
Expand Down
2 changes: 1 addition & 1 deletion source/ship/ShipAICache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void ShipAICache::Calibrate(const Ship &ship)
useArtilleryAI = (artilleryDPS > totalDPS * .75
&& (ship.MaxReverseVelocity() || maxTurningRadius < 0.2 * shortestArtillery));

// Don't try to avoid your own splash damage if it means you whould be losing out
// Don't try to avoid your own splash damage if it means you would be losing out
// on a lot of DPS. Helps with ships with very slow turning and not a lot of splash
// weapons being overly afraid of dying.
if(minSafeDistance && !(useArtilleryAI || shortestRange * (splashDPS / totalDPS) > maxTurningRadius))
Expand Down

0 comments on commit fe4b256

Please sign in to comment.