Merge branch 'master' into jgrpp

# Conflicts:
#	cmake/CompileFlags.cmake
#	src/cargomonitor.cpp
#	src/core/CMakeLists.txt
#	src/economy.cpp
#	src/landscape.cpp
#	src/linkgraph/flowmapper.cpp
#	src/linkgraph/linkgraph_gui.cpp
#	src/linkgraph/linkgraphschedule.cpp
#	src/misc_gui.cpp
#	src/newgrf_generic.cpp
#	src/newgrf_storage.cpp
#	src/rail_gui.cpp
#	src/saveload/afterload.cpp
#	src/saveload/station_sl.cpp
#	src/script/script_gui.cpp
#	src/station_cmd.cpp
#	src/station_gui.cpp
#	src/string_func.h
#	src/terraform_cmd.cpp
This commit is contained in:
Jonathan G Rennison
2023-06-07 21:28:46 +01:00
129 changed files with 2080 additions and 2061 deletions

View File

@@ -32,7 +32,6 @@ add_files(
smallmap_type.hpp
smallstack_type.hpp
smallvec_type.hpp
string_compare_type.hpp
tinystring_type.hpp
y_combinator.hpp
)

View File

@@ -40,11 +40,7 @@ struct SmallMap : std::vector<std::pair<T, U> > {
*/
inline typename std::vector<Pair>::const_iterator Find(const T &key) const
{
typename std::vector<Pair>::const_iterator it;
for (it = std::vector<Pair>::begin(); it != std::vector<Pair>::end(); it++) {
if (key == it->first) return it;
}
return it;
return std::find_if(std::vector<Pair>::begin(), std::vector<Pair>::end(), [&key](const Pair &pair) { return key == pair.first; });
}
/**

View File

@@ -1,27 +0,0 @@
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file string_compare_type.hpp Comparator class for "const char *" so it can be used as a key for std::map */
#ifndef STRING_COMPARE_TYPE_HPP
#define STRING_COMPARE_TYPE_HPP
/** Comparator for strings. */
struct StringCompare {
/**
* Compare two strings.
* @param a The first string.
* @param b The second string.
* @return True is the first string is deemed "lower" than the second string.
*/
bool operator () (const char *a, const char *b) const
{
return strcmp(a, b) < 0;
}
};
#endif /* STRING_COMPARE_TYPE_HPP */