Merge branch 'master' into jgrpp-beta
# Conflicts: # src/economy.cpp # src/elrail.cpp # src/graph_gui.cpp # src/linkgraph/linkgraph_gui.cpp # src/network/core/game_info.cpp # src/newgrf_station.cpp # src/saveload/saveload.cpp # src/settings.cpp # src/station_cmd.cpp # src/station_gui.cpp # src/strings_func.h # src/table/settings/network_settings.ini # src/table/settings/settings.ini
This commit is contained in:
@@ -100,6 +100,29 @@ IniItem *IniGroup::GetItem(const std::string &name, bool create)
|
||||
return new IniItem(this, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the item with the given name.
|
||||
* @param name Name of the item to remove.
|
||||
*/
|
||||
void IniGroup::RemoveItem(const std::string &name)
|
||||
{
|
||||
IniItem **prev = &this->item;
|
||||
|
||||
for (IniItem *item = this->item; item != nullptr; prev = &item->next, item = item->next) {
|
||||
if (item->name != name) continue;
|
||||
|
||||
*prev = item->next;
|
||||
if (this->last_item == &this->item) {
|
||||
this->last_item = &item->next;
|
||||
}
|
||||
|
||||
item->next = nullptr;
|
||||
delete item;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear all items in the group
|
||||
*/
|
||||
|
Reference in New Issue
Block a user