Changeset - r28085:14d6dab2b812
[Not reviewed]
master
0 15 0
Peter Nelson - 6 months ago 2023-11-03 21:21:00
peter1138@openttd.org
Cleanup: Remove some unused functions. (#11429)

These were picked up with cppcheck.
15 files changed with 0 insertions and 157 deletions:
0 comments (0 inline, 0 general)
src/articulated_vehicles.cpp
Show inline comments
 
@@ -226,20 +226,6 @@ CargoTypes GetUnionOfArticulatedRefitMas
 
}
 

	
 
/**
 
 * Ands the refit_masks of all articulated parts.
 
 * @param engine the first part
 
 * @param include_initial_cargo_type if true the default cargo type of the vehicle is included; if false only the refit_mask
 
 * @return bit mask of CargoIDs which are a refit option for every articulated part (with default capacity > 0)
 
 */
 
CargoTypes GetIntersectionOfArticulatedRefitMasks(EngineID engine, bool include_initial_cargo_type)
 
{
 
	CargoTypes union_mask, intersection_mask;
 
	GetArticulatedRefitMasks(engine, include_initial_cargo_type, &union_mask, &intersection_mask);
 
	return intersection_mask;
 
}
 

	
 

	
 
/**
 
 * Tests if all parts of an articulated vehicle are refitted to the same cargo.
 
 * Note: Vehicles not carrying anything are ignored
 
 * @param v the first vehicle in the chain
src/articulated_vehicles.h
Show inline comments
 
@@ -18,7 +18,6 @@ CargoArray GetCapacityOfArticulatedParts
 
void AddArticulatedParts(Vehicle *first);
 
void GetArticulatedRefitMasks(EngineID engine, bool include_initial_cargo_type, CargoTypes *union_mask, CargoTypes *intersection_mask);
 
CargoTypes GetUnionOfArticulatedRefitMasks(EngineID engine, bool include_initial_cargo_type);
 
CargoTypes GetIntersectionOfArticulatedRefitMasks(EngineID engine, bool include_initial_cargo_type);
 
bool IsArticulatedVehicleCarryingDifferentCargoes(const Vehicle *v, CargoID *cargo_type);
 
bool IsArticulatedVehicleRefittable(EngineID engine);
 
bool IsArticulatedEngine(EngineID engine_type);
src/group.h
Show inline comments
 
@@ -110,7 +110,6 @@ Money GetGroupProfitLastYearMinAge(Compa
 

	
 
void SetTrainGroupID(Train *v, GroupID grp);
 
void UpdateTrainGroupID(Train *v);
 
void RemoveVehicleFromGroup(const Vehicle *v);
 
void RemoveAllGroupsForCompany(const CompanyID company);
 
bool GroupIsInGroup(GroupID search, GroupID group);
 

	
src/group_cmd.cpp
Show inline comments
 
@@ -715,19 +715,6 @@ CommandCost CmdSetGroupFlag(DoCommandFla
 
}
 

	
 
/**
 
 * Decrease the num_vehicle variable before delete an front engine from a group
 
 * @note Called in CmdSellRailWagon and DeleteLasWagon,
 
 * @param v     FrontEngine of the train we want to remove.
 
 */
 
void RemoveVehicleFromGroup(const Vehicle *v)
 
{
 
	if (!v->IsPrimaryVehicle()) return;
 

	
 
	if (!IsDefaultGroupID(v->group_id)) GroupStatistics::CountVehicle(v, -1);
 
}
 

	
 

	
 
/**
 
 * Affect the groupID of a train to new_g.
 
 * @note called in CmdAddVehicleGroup and CmdMoveRailVehicle
 
 * @param v     First vehicle of the chain.
src/newgrf_text.cpp
Show inline comments
 
@@ -744,8 +744,6 @@ struct TextRefStack {
 
		this->grffile = grffile;
 
		this->used = true;
 
	}
 

	
 
	void RewindStack() { this->position = 0; }
 
};
 

	
 
/** The stack that is used for TTDP compatible string code parsing */
 
@@ -819,11 +817,6 @@ void StopTextRefStackUsage()
 
	_newgrf_textrefstack.used = false;
 
}
 

	
 
void RewindTextRefStack()
 
{
 
	_newgrf_textrefstack.RewindStack();
 
}
 

	
 
/**
 
 * FormatString for NewGRF specific "magic" string control codes
 
 * @param scc   the string control code that has been read
src/newgrf_text.h
Show inline comments
 
@@ -45,7 +45,6 @@ bool CheckGrfLangID(byte lang_id, byte g
 

	
 
void StartTextRefStackUsage(const struct GRFFile *grffile, byte numEntries, const uint32_t *values = nullptr);
 
void StopTextRefStackUsage();
 
void RewindTextRefStack();
 
bool UsingNewGRFTextStack();
 
struct TextRefStack *CreateTextRefStackBackup();
 
void RestoreTextRefStackBackup(struct TextRefStack *backup);
src/object_gui.cpp
Show inline comments
 
@@ -87,16 +87,6 @@ class BuildObjectWindow : public Window 
 
		return objclass->GetSpec(_selected_object_index)->IsAvailable();
 
	}
 

	
 
	/**
 
	 * Calculate the number of columns of the #WID_BO_SELECT_MATRIX widget.
 
	 * @return Number of columns in the matrix.
 
	 */
 
	uint GetMatrixColumnCount()
 
	{
 
		const NWidgetBase *matrix = this->GetWidget<NWidgetBase>(WID_BO_SELECT_MATRIX);
 
		return 1 + (matrix->current_x - matrix->smallest_x) / matrix->resize_x;
 
	}
 

	
 
public:
 
	BuildObjectWindow(WindowDesc *desc, WindowNumber number) : Window(desc), info_height(1), filter_editbox(EDITBOX_MAX_SIZE * MAX_CHAR_LENGTH, EDITBOX_MAX_SIZE)
 
	{
src/order_base.h
Show inline comments
 
@@ -350,9 +350,6 @@ public:
 
	 */
 
	inline uint GetNumVehicles() const { return this->num_vehicles; }
 

	
 
	bool IsVehicleInSharedOrdersList(const Vehicle *v) const;
 
	int GetPositionInSharedOrderList(const Vehicle *v) const;
 

	
 
	/**
 
	 * Adds the given vehicle to this shared order list.
 
	 * @note This is supposed to be called after the vehicle has been inserted
src/order_cmd.cpp
Show inline comments
 
@@ -572,31 +572,6 @@ void OrderList::RemoveVehicle(Vehicle *v
 
}
 

	
 
/**
 
 * Checks whether a vehicle is part of the shared vehicle chain.
 
 * @param v is the vehicle to search in the shared vehicle chain.
 
 */
 
bool OrderList::IsVehicleInSharedOrdersList(const Vehicle *v) const
 
{
 
	for (const Vehicle *v_shared = this->first_shared; v_shared != nullptr; v_shared = v_shared->NextShared()) {
 
		if (v_shared == v) return true;
 
	}
 

	
 
	return false;
 
}
 

	
 
/**
 
 * Gets the position of the given vehicle within the shared order vehicle list.
 
 * @param v is the vehicle of which to get the position
 
 * @return position of v within the shared vehicle chain.
 
 */
 
int OrderList::GetPositionInSharedOrderList(const Vehicle *v) const
 
{
 
	int count = 0;
 
	for (const Vehicle *v_shared = v->PreviousShared(); v_shared != nullptr; v_shared = v_shared->PreviousShared()) count++;
 
	return count;
 
}
 

	
 
/**
 
 * Checks whether all orders of the list have a filled timetable.
 
 * @return whether all orders have a filled timetable.
 
 */
src/pathfinder/yapf/yapf_road.cpp
Show inline comments
 
@@ -427,12 +427,6 @@ public:
 
		return next_trackdir;
 
	}
 

	
 
	static uint stDistanceToTile(const RoadVehicle *v, TileIndex tile)
 
	{
 
		Tpf pf;
 
		return pf.DistanceToTile(v, tile);
 
	}
 

	
 
	inline uint DistanceToTile(const RoadVehicle *v, TileIndex dst_tile)
 
	{
 
		/* handle special case - when current tile is the destination tile */
src/road.cpp
Show inline comments
 
@@ -270,39 +270,3 @@ RoadType GetRoadTypeByLabel(RoadTypeLabe
 
	/* No matching label was found, so it is invalid */
 
	return INVALID_ROADTYPE;
 
}
 

	
 
/**
 
 * Returns the available RoadSubTypes for the provided RoadType
 
 * If the given company is valid then will be returned a list of the available sub types at the current date, while passing
 
 * a deity company will make all the sub types available
 
 * @param rt the RoadType to filter
 
 * @param c the company ID to check the roadtype against
 
 * @param any_date whether to return only currently introduced roadtypes or also future ones
 
 * @returns the existing RoadSubTypes
 
 */
 
RoadTypes ExistingRoadTypes(CompanyID c)
 
{
 
	/* Check only players which can actually own vehicles, editor and gamescripts are considered deities */
 
	if (c < OWNER_END) {
 
		const Company *company = Company::GetIfValid(c);
 
		if (company != nullptr) return company->avail_roadtypes;
 
	}
 

	
 
	RoadTypes known_roadtypes = ROADTYPES_NONE;
 

	
 
	/* Find used roadtypes */
 
	for (Engine *e : Engine::IterateType(VEH_ROAD)) {
 
		/* Check if the roadtype can be used in the current climate */
 
		if (!HasBit(e->info.climates, _settings_game.game_creation.landscape)) continue;
 

	
 
		/* Check whether available for all potential companies */
 
		if (e->company_avail != MAX_UVALUE(CompanyMask)) continue;
 

	
 
		known_roadtypes |= GetRoadTypeInfo(e->u.road.roadtype)->introduces_roadtypes;
 
	}
 

	
 
	/* Get the date introduced roadtypes as well. */
 
	known_roadtypes = AddDateIntroducedRoadTypes(known_roadtypes, CalendarTime::MAX_DATE);
 

	
 
	return known_roadtypes;
 
}
src/strings.cpp
Show inline comments
 
@@ -1957,14 +1957,6 @@ const char *GetCurrentLocale(const char 
 
const char *GetCurrentLocale(const char *param);
 
#endif /* !(defined(_WIN32) || defined(__APPLE__)) */
 

	
 
bool StringIDSorter(const StringID &a, const StringID &b)
 
{
 
	std::string stra = GetString(a);
 
	std::string strb = GetString(b);
 

	
 
	return StrNaturalCompare(stra, strb) < 0;
 
}
 

	
 
/**
 
 * Get the language with the given NewGRF language ID.
 
 * @param newgrflangid NewGRF languages ID to check.
src/strings_func.h
Show inline comments
 
@@ -110,8 +110,6 @@ extern TextDirection _current_text_dir; 
 
void InitializeLanguagePacks();
 
const char *GetCurrentLanguageIsoCode();
 

	
 
bool StringIDSorter(const StringID &a, const StringID &b);
 

	
 
/**
 
 * A searcher for missing glyphs.
 
 */
src/vehicle.cpp
Show inline comments
 
@@ -2354,32 +2354,6 @@ void Vehicle::HandleLoading(bool mode)
 
}
 

	
 
/**
 
 * Get a map of cargoes and free capacities in the consist.
 
 * @param capacities Map to be filled with cargoes and capacities.
 
 */
 
void Vehicle::GetConsistFreeCapacities(std::map<CargoID, uint> &capacities) const
 
{
 
	for (const Vehicle *v = this; v != nullptr; v = v->Next()) {
 
		if (v->cargo_cap == 0) continue;
 
		auto pair = capacities.find(v->cargo_type);
 
		if (pair == capacities.end()) {
 
			capacities[v->cargo_type] = v->cargo_cap - v->cargo.StoredCount();
 
		} else {
 
			pair->second += v->cargo_cap - v->cargo.StoredCount();
 
		}
 
	}
 
}
 

	
 
uint Vehicle::GetConsistTotalCapacity() const
 
{
 
	uint result = 0;
 
	for (const Vehicle *v = this; v != nullptr; v = v->Next()) {
 
		result += v->cargo_cap;
 
	}
 
	return result;
 
}
 

	
 
/**
 
 * Send this vehicle to the depot using the given command(s).
 
 * @param flags   the command flags (like execute and such).
 
 * @param command the command to execute.
src/vehicle_base.h
Show inline comments
 
@@ -391,10 +391,6 @@ public:
 

	
 
	void HandleLoading(bool mode = false);
 

	
 
	void GetConsistFreeCapacities(std::map<CargoID, uint> &capacities) const;
 

	
 
	uint GetConsistTotalCapacity() const;
 

	
 
	/**
 
	 * Marks the vehicles to be redrawn and updates cached variables
 
	 *
0 comments (0 inline, 0 general)