Changeset - r23529:c3623e1b8808
[Not reviewed]
master
0 9 0
Henry Wilson - 6 years ago 2018-09-25 20:01:56
m3henry@googlemail.com
Codechange: Replaced SmallVector::Get(n) non-const with std::vector::data() + n
9 files changed with 10 insertions and 23 deletions:
0 comments (0 inline, 0 general)
src/console_cmds.cpp
Show inline comments
 
@@ -566,7 +566,7 @@ DEF_CONSOLE_CMD(ConUnBan)
 
		seprintf(msg, lastof(msg), "Unbanned %s", _network_ban_list[index]);
 
		IConsolePrint(CC_DEFAULT, msg);
 
		free(_network_ban_list[index]);
 
		_network_ban_list.Erase(_network_ban_list.Get(index));
 
		_network_ban_list.erase(_network_ban_list.begin() + index);
 
	} else {
 
		IConsolePrint(CC_DEFAULT, "Invalid list index or IP not in ban-list.");
 
		IConsolePrint(CC_DEFAULT, "For a list of banned IP's, see the command 'banlist'");
src/core/smallvec_type.hpp
Show inline comments
 
@@ -180,19 +180,6 @@ public:
 
		assert(index <= std::vector<T>::size());
 
		return this->Begin() + index;
 
	}
 

	
 
	/**
 
	 * Get the pointer to item "number"
 
	 *
 
	 * @param index the position of the item
 
	 * @return the pointer to the item
 
	 */
 
	inline T *Get(uint index)
 
	{
 
		/* Allow access to the 'first invalid' item */
 
		assert(index <= std::vector<T>::size());
 
		return this->Begin() + index;
 
	}
 
};
 

	
 

	
src/engine_gui.cpp
Show inline comments
 
@@ -344,6 +344,6 @@ void EngList_SortPartial(GUIEngineList *
 
	if (num_items < 2) return;
 
	assert(begin < el->size());
 
	assert(begin + num_items <= el->size());
 
	QSortT(el->Get(begin), num_items, compare);
 
	QSortT(el->data() + begin, num_items, compare);
 
}
 

	
src/fios.h
Show inline comments
 
@@ -165,7 +165,7 @@ public:
 
	 */
 
	inline FiosItem *Get(uint index)
 
	{
 
		return this->files.Get(index);
 
		return this->files.data() + index;
 
	}
 

	
 
	inline const FiosItem &operator[](uint index) const
src/linkgraph/linkgraph.cpp
Show inline comments
 
@@ -139,7 +139,7 @@ void LinkGraph::RemoveNode(NodeID id)
 
		node_edges[id] = node_edges[last_node];
 
	}
 
	Station::Get(this->nodes[last_node].station)->goods[this->cargo].node = id;
 
	this->nodes.Erase(this->nodes.Get(id));
 
	this->nodes.erase(this->nodes.begin() + id);
 
	this->edges.EraseColumn(id);
 
	/* Not doing EraseRow here, as having the extra invalid row doesn't hurt
 
	 * and removing it would trigger a lot of memmove. The data has already
src/newgrf.cpp
Show inline comments
 
@@ -637,7 +637,7 @@ static Engine *GetNewEngine(const GRFFil
 

	
 
		/* Reserve the engine slot */
 
		if (!static_access) {
 
			EngineIDMapping *eid = _engine_mngr.Get(engine);
 
			EngineIDMapping *eid = _engine_mngr.data() + engine;
 
			eid->grfid           = scope_grfid; // Note: this is INVALID_GRFID if dynamic_engines is disabled, so no reservation
 
		}
 

	
src/newgrf_config.cpp
Show inline comments
 
@@ -262,7 +262,7 @@ GRFParameterInfo::GRFParameterInfo(GRFPa
 
	complete_labels(info.complete_labels)
 
{
 
	for (uint i = 0; i < info.value_names.size(); i++) {
 
		SmallPair<uint32, GRFText *> *data = info.value_names.Get(i);
 
		SmallPair<uint32, GRFText *> *data = info.value_names.data() + i;
 
		this->value_names.Insert(data->first, DuplicateGRFText(data->second));
 
	}
 
}
 
@@ -273,7 +273,7 @@ GRFParameterInfo::~GRFParameterInfo()
 
	CleanUpGRFText(this->name);
 
	CleanUpGRFText(this->desc);
 
	for (uint i = 0; i < this->value_names.size(); i++) {
 
		SmallPair<uint32, GRFText *> *data = this->value_names.Get(i);
 
		SmallPair<uint32, GRFText *> *data = this->value_names.data() + i;
 
		CleanUpGRFText(data->second);
 
	}
 
}
src/station_gui.cpp
Show inline comments
 
@@ -2133,7 +2133,7 @@ static bool AddNearbyStation(TileIndex t
 

	
 
	/* First check if there were deleted stations here */
 
	for (uint i = 0; i < _deleted_stations_nearby.size(); i++) {
 
		TileAndStation *ts = _deleted_stations_nearby.Get(i);
 
		TileAndStation *ts = _deleted_stations_nearby.data() + i;
 
		if (ts->tile == tile) {
 
			*_stations_nearby_list.Append() = _deleted_stations_nearby[i].station;
 
			_deleted_stations_nearby.Erase(ts);
src/texteff.cpp
Show inline comments
 
@@ -50,7 +50,7 @@ TextEffectID AddTextEffect(StringID msg,
 
	}
 
	if (i == _text_effects.size()) _text_effects.Append();
 

	
 
	TextEffect *te = _text_effects.Get(i);
 
	TextEffect *te = _text_effects.data() + i;
 

	
 
	/* Start defining this object */
 
	te->string_id = msg;
 
@@ -69,7 +69,7 @@ TextEffectID AddTextEffect(StringID msg,
 
void UpdateTextEffect(TextEffectID te_id, StringID msg)
 
{
 
	/* Update details */
 
	TextEffect *te = _text_effects.Get(te_id);
 
	TextEffect *te = _text_effects.data() + te_id;
 
	if (msg == te->string_id && GetDParam(0) == te->params_1) return;
 
	te->string_id = msg;
 
	te->params_1 = GetDParam(0);
0 comments (0 inline, 0 general)