mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Removed SmallVector completely
parent
6570f7989f
commit
c01a2e2a81
|
@ -19,7 +19,7 @@
|
||||||
#include "safeguards.h"
|
#include "safeguards.h"
|
||||||
|
|
||||||
/** The table/list with animated tiles. */
|
/** The table/list with animated tiles. */
|
||||||
SmallVector<TileIndex, 256> _animated_tiles;
|
std::vector<TileIndex> _animated_tiles;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the given tile from the animated tile table.
|
* Removes the given tile from the animated tile table.
|
||||||
|
|
|
@ -562,7 +562,7 @@ private:
|
||||||
uint rows;
|
uint rows;
|
||||||
uint line_height;
|
uint line_height;
|
||||||
GUIGroupList groups;
|
GUIGroupList groups;
|
||||||
SmallVector<int, 32> indents;
|
std::vector<int> indents;
|
||||||
Scrollbar *vscroll;
|
Scrollbar *vscroll;
|
||||||
|
|
||||||
void ShowColourDropDownMenu(uint32 widget)
|
void ShowColourDropDownMenu(uint32 widget)
|
||||||
|
|
|
@ -26,7 +26,7 @@ enum PoolType {
|
||||||
};
|
};
|
||||||
DECLARE_ENUM_AS_BIT_SET(PoolType)
|
DECLARE_ENUM_AS_BIT_SET(PoolType)
|
||||||
|
|
||||||
typedef SmallVector<struct PoolBase *, 4> PoolVector; ///< Vector of pointers to PoolBase
|
typedef std::vector<struct PoolBase *> PoolVector; ///< Vector of pointers to PoolBase
|
||||||
|
|
||||||
/** Base class for base of all pools. */
|
/** Base class for base of all pools. */
|
||||||
struct PoolBase {
|
struct PoolBase {
|
||||||
|
|
|
@ -40,7 +40,7 @@ struct SmallPair {
|
||||||
* @see SmallVector
|
* @see SmallVector
|
||||||
*/
|
*/
|
||||||
template <typename T, typename U, uint S = 16>
|
template <typename T, typename U, uint S = 16>
|
||||||
struct SmallMap : SmallVector<SmallPair<T, U>, S> {
|
struct SmallMap : std::vector<SmallPair<T, U> > {
|
||||||
typedef ::SmallPair<T, U> Pair;
|
typedef ::SmallPair<T, U> Pair;
|
||||||
typedef Pair *iterator;
|
typedef Pair *iterator;
|
||||||
typedef const Pair *const_iterator;
|
typedef const Pair *const_iterator;
|
||||||
|
|
|
@ -87,7 +87,7 @@ private:
|
||||||
Tindex first_free;
|
Tindex first_free;
|
||||||
|
|
||||||
ThreadMutex *mutex;
|
ThreadMutex *mutex;
|
||||||
SmallVector<SimplePoolPoolItem, Tgrowth_step> data;
|
std::vector<SimplePoolPoolItem> data;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -34,22 +34,6 @@ inline bool include(std::vector<T>& vec, const T &item)
|
||||||
return is_member;
|
return is_member;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Simple vector template class.
|
|
||||||
*
|
|
||||||
* @note There are no asserts in the class so you have
|
|
||||||
* to care about that you grab an item which is
|
|
||||||
* inside the list.
|
|
||||||
*
|
|
||||||
* @tparam T The type of the items stored
|
|
||||||
* @tparam S The steps of allocation
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T, uint S>
|
|
||||||
using SmallVector = std::vector<T>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to get the index of an item
|
* Helper function to get the index of an item
|
||||||
* Consider using std::set, std::unordered_set or std::flat_set in new code
|
* Consider using std::set, std::unordered_set or std::flat_set in new code
|
||||||
|
@ -73,19 +57,18 @@ int find_index(std::vector<T> const& vec, T const& item)
|
||||||
* Consider using std::back_inserter in new code
|
* Consider using std::back_inserter in new code
|
||||||
*
|
*
|
||||||
* @param vec A reference to the vector to be extended
|
* @param vec A reference to the vector to be extended
|
||||||
* @param num The number of elements to default-construct
|
* @param num Number of elements to be default-constructed
|
||||||
*
|
*
|
||||||
* @return Pointer to the first new element
|
* @return Pointer to the first new element
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T* grow(std::vector<T>& vec, std::size_t num)
|
T* grow(std::vector<T>& vec, std::size_t num)
|
||||||
{
|
{
|
||||||
const std::size_t pos = vec.size();
|
std::size_t const pos = vec.size();
|
||||||
vec.resize(pos + num);
|
vec.resize(pos + num);
|
||||||
return vec.data() + pos;
|
return vec.data() + pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple vector template class, with automatic free.
|
* Simple vector template class, with automatic free.
|
||||||
*
|
*
|
||||||
|
@ -97,7 +80,7 @@ inline T* grow(std::vector<T>& vec, std::size_t num)
|
||||||
* @param S The steps of allocation
|
* @param S The steps of allocation
|
||||||
*/
|
*/
|
||||||
template <typename T, uint S>
|
template <typename T, uint S>
|
||||||
class AutoFreeSmallVector : public SmallVector<T, S> {
|
class AutoFreeSmallVector : public std::vector<T> {
|
||||||
public:
|
public:
|
||||||
~AutoFreeSmallVector()
|
~AutoFreeSmallVector()
|
||||||
{
|
{
|
||||||
|
@ -128,7 +111,7 @@ public:
|
||||||
* @param S The steps of allocation
|
* @param S The steps of allocation
|
||||||
*/
|
*/
|
||||||
template <typename T, uint S>
|
template <typename T, uint S>
|
||||||
class AutoDeleteSmallVector : public SmallVector<T, S> {
|
class AutoDeleteSmallVector : public std::vector<T> {
|
||||||
public:
|
public:
|
||||||
~AutoDeleteSmallVector()
|
~AutoDeleteSmallVector()
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,7 +77,7 @@ static inline int32 BigMulS(const int32 a, const int32 b, const uint8 shift)
|
||||||
return (int32)((int64)a * (int64)b >> shift);
|
return (int32)((int64)a * (int64)b >> shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef SmallVector<Industry *, 16> SmallIndustryList;
|
typedef std::vector<Industry *> SmallIndustryList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Score info, values used for computing the detailed performance rating.
|
* Score info, values used for computing the detailed performance rating.
|
||||||
|
|
|
@ -156,7 +156,7 @@ struct EngineIDMapping {
|
||||||
* Stores the mapping of EngineID to the internal id of newgrfs.
|
* Stores the mapping of EngineID to the internal id of newgrfs.
|
||||||
* Note: This is not part of Engine, as the data in the EngineOverrideManager and the engine pool get resetted in different cases.
|
* Note: This is not part of Engine, as the data in the EngineOverrideManager and the engine pool get resetted in different cases.
|
||||||
*/
|
*/
|
||||||
struct EngineOverrideManager : SmallVector<EngineIDMapping, 256> {
|
struct EngineOverrideManager : std::vector<EngineIDMapping> {
|
||||||
static const uint NUM_DEFAULT_ENGINES; ///< Number of default entries
|
static const uint NUM_DEFAULT_ENGINES; ///< Number of default entries
|
||||||
|
|
||||||
void ResetToDefaultMapping();
|
void ResetToDefaultMapping();
|
||||||
|
|
|
@ -655,7 +655,7 @@ struct ScenarioIdentifier {
|
||||||
/**
|
/**
|
||||||
* Scanner to find the unique IDs of scenarios
|
* Scanner to find the unique IDs of scenarios
|
||||||
*/
|
*/
|
||||||
class ScenarioScanner : protected FileScanner, public SmallVector<ScenarioIdentifier, 8> {
|
class ScenarioScanner : protected FileScanner, public std::vector<ScenarioIdentifier> {
|
||||||
bool scanned; ///< Whether we've already scanned
|
bool scanned; ///< Whether we've already scanned
|
||||||
public:
|
public:
|
||||||
/** Initialise */
|
/** Initialise */
|
||||||
|
|
|
@ -198,7 +198,7 @@ public:
|
||||||
void BuildFileList(AbstractFileType abstract_filetype, SaveLoadOperation fop);
|
void BuildFileList(AbstractFileType abstract_filetype, SaveLoadOperation fop);
|
||||||
const FiosItem *FindItem(const char *file);
|
const FiosItem *FindItem(const char *file);
|
||||||
|
|
||||||
SmallVector<FiosItem, 32> files; ///< The list of files.
|
std::vector<FiosItem> files; ///< The list of files.
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SortingBits {
|
enum SortingBits {
|
||||||
|
|
|
@ -121,7 +121,7 @@ private:
|
||||||
uint tiny_step_height; ///< Step height for the group list
|
uint tiny_step_height; ///< Step height for the group list
|
||||||
Scrollbar *group_sb;
|
Scrollbar *group_sb;
|
||||||
|
|
||||||
SmallVector<int, 16> indents; ///< Indentation levels
|
std::vector<int> indents; ///< Indentation levels
|
||||||
|
|
||||||
Dimension column_size[VGC_END]; ///< Size of the columns in the group list.
|
Dimension column_size[VGC_END]; ///< Size of the columns in the group list.
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ char *_hotkeys_file;
|
||||||
* List of all HotkeyLists.
|
* List of all HotkeyLists.
|
||||||
* This is a pointer to ensure initialisation order with the various static HotkeyList instances.
|
* This is a pointer to ensure initialisation order with the various static HotkeyList instances.
|
||||||
*/
|
*/
|
||||||
static SmallVector<HotkeyList*, 16> *_hotkey_lists = NULL;
|
static std::vector<HotkeyList*> *_hotkey_lists = NULL;
|
||||||
|
|
||||||
/** String representation of a keycode */
|
/** String representation of a keycode */
|
||||||
struct KeycodeNames {
|
struct KeycodeNames {
|
||||||
|
@ -254,7 +254,7 @@ void Hotkey::AddKeycode(uint16 keycode)
|
||||||
HotkeyList::HotkeyList(const char *ini_group, Hotkey *items, GlobalHotkeyHandlerFunc global_hotkey_handler) :
|
HotkeyList::HotkeyList(const char *ini_group, Hotkey *items, GlobalHotkeyHandlerFunc global_hotkey_handler) :
|
||||||
global_hotkey_handler(global_hotkey_handler), ini_group(ini_group), items(items)
|
global_hotkey_handler(global_hotkey_handler), ini_group(ini_group), items(items)
|
||||||
{
|
{
|
||||||
if (_hotkey_lists == NULL) _hotkey_lists = new SmallVector<HotkeyList*, 16>();
|
if (_hotkey_lists == NULL) _hotkey_lists = new std::vector<HotkeyList*>();
|
||||||
_hotkey_lists->push_back(this);
|
_hotkey_lists->push_back(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ struct Hotkey {
|
||||||
|
|
||||||
const char *name;
|
const char *name;
|
||||||
int num;
|
int num;
|
||||||
SmallVector<uint16, 1> keycodes;
|
std::vector<uint16> keycodes;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define HOTKEY_LIST_END Hotkey((uint16)0, NULL, -1)
|
#define HOTKEY_LIST_END Hotkey((uint16)0, NULL, -1)
|
||||||
|
|
|
@ -1884,7 +1884,7 @@ static CommandCost CreateNewIndustryHelper(TileIndex tile, IndustryType type, Do
|
||||||
|
|
||||||
*ip = NULL;
|
*ip = NULL;
|
||||||
|
|
||||||
SmallVector<ClearedObjectArea, 1> object_areas(_cleared_object_areas);
|
std::vector<ClearedObjectArea> object_areas(_cleared_object_areas);
|
||||||
CommandCost ret = CheckIfIndustryTilesAreFree(tile, it, itspec_index, type, random_initial_bits, founder, creation_type, &custom_shape_check);
|
CommandCost ret = CheckIfIndustryTilesAreFree(tile, it, itspec_index, type, random_initial_bits, founder, creation_type, &custom_shape_check);
|
||||||
_cleared_object_areas = object_areas;
|
_cleared_object_areas = object_areas;
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
|
|
|
@ -2155,7 +2155,7 @@ next_cargo: ;
|
||||||
struct IndustryCargoesWindow : public Window {
|
struct IndustryCargoesWindow : public Window {
|
||||||
static const int HOR_TEXT_PADDING, VERT_TEXT_PADDING;
|
static const int HOR_TEXT_PADDING, VERT_TEXT_PADDING;
|
||||||
|
|
||||||
typedef SmallVector<CargoesRow, 4> Fields;
|
typedef std::vector<CargoesRow> Fields;
|
||||||
|
|
||||||
Fields fields; ///< Fields to display in the #WID_IC_PANEL.
|
Fields fields; ///< Fields to display in the #WID_IC_PANEL.
|
||||||
uint ind_cargo; ///< If less than #NUM_INDUSTRYTYPES, an industry type, else a cargo id + NUM_INDUSTRYTYPES.
|
uint ind_cargo; ///< If less than #NUM_INDUSTRYTYPES, an industry type, else a cargo id + NUM_INDUSTRYTYPES.
|
||||||
|
|
|
@ -96,7 +96,7 @@ struct LanguageMetadata : public LanguagePackHeader {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Type for the list of language meta data. */
|
/** Type for the list of language meta data. */
|
||||||
typedef SmallVector<LanguageMetadata, 4> LanguageList;
|
typedef std::vector<LanguageMetadata> LanguageList;
|
||||||
|
|
||||||
/** The actual list of language meta data. */
|
/** The actual list of language meta data. */
|
||||||
extern LanguageList _languages;
|
extern LanguageList _languages;
|
||||||
|
|
|
@ -435,7 +435,7 @@ public:
|
||||||
void RemoveEdge(NodeID to);
|
void RemoveEdge(NodeID to);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef SmallVector<BaseNode, 16> NodeVector;
|
typedef std::vector<BaseNode> NodeVector;
|
||||||
typedef SmallMatrix<BaseEdge> EdgeMatrix;
|
typedef SmallMatrix<BaseEdge> EdgeMatrix;
|
||||||
|
|
||||||
/** Minimum effective distance for timeout calculation. */
|
/** Minimum effective distance for timeout calculation. */
|
||||||
|
|
|
@ -50,7 +50,7 @@ private:
|
||||||
void Init(uint supply);
|
void Init(uint supply);
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef SmallVector<NodeAnnotation, 16> NodeAnnotationVector;
|
typedef std::vector<NodeAnnotation> NodeAnnotationVector;
|
||||||
typedef SmallMatrix<EdgeAnnotation> EdgeAnnotationMatrix;
|
typedef SmallMatrix<EdgeAnnotation> EdgeAnnotationMatrix;
|
||||||
|
|
||||||
friend const SaveLoad *GetLinkGraphJobDesc();
|
friend const SaveLoad *GetLinkGraphJobDesc();
|
||||||
|
|
|
@ -24,7 +24,7 @@ struct MidiFile {
|
||||||
struct DataBlock {
|
struct DataBlock {
|
||||||
uint32 ticktime; ///< tick number since start of file this block should be triggered at
|
uint32 ticktime; ///< tick number since start of file this block should be triggered at
|
||||||
uint32 realtime; ///< real-time (microseconds) since start of file this block should be triggered at
|
uint32 realtime; ///< real-time (microseconds) since start of file this block should be triggered at
|
||||||
SmallVector<byte, 8> data; ///< raw midi data contained in block
|
std::vector<byte> data; ///< raw midi data contained in block
|
||||||
DataBlock(uint32 _ticktime = 0) : ticktime(_ticktime) { }
|
DataBlock(uint32 _ticktime = 0) : ticktime(_ticktime) { }
|
||||||
};
|
};
|
||||||
struct TempoChange {
|
struct TempoChange {
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "../../core/smallmap_type.hpp"
|
#include "../../core/smallmap_type.hpp"
|
||||||
|
|
||||||
class NetworkAddress;
|
class NetworkAddress;
|
||||||
typedef SmallVector<NetworkAddress, 4> NetworkAddressList; ///< Type for a list of addresses.
|
typedef std::vector<NetworkAddress> NetworkAddressList; ///< Type for a list of addresses.
|
||||||
typedef SmallMap<NetworkAddress, SOCKET, 4> SocketList; ///< Type for a mapping between address and socket.
|
typedef SmallMap<NetworkAddress, SOCKET, 4> SocketList; ///< Type for a mapping between address and socket.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#include "../../safeguards.h"
|
#include "../../safeguards.h"
|
||||||
|
|
||||||
/** List of connections that are currently being created */
|
/** List of connections that are currently being created */
|
||||||
static SmallVector<TCPConnecter *, 1> _tcp_connecters;
|
static std::vector<TCPConnecter *> _tcp_connecters;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new connecter for the given address
|
* Create a new connecter for the given address
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "../../safeguards.h"
|
#include "../../safeguards.h"
|
||||||
|
|
||||||
/** List of open HTTP connections. */
|
/** List of open HTTP connections. */
|
||||||
static SmallVector<NetworkHTTPSocketHandler *, 1> _http_connections;
|
static std::vector<NetworkHTTPSocketHandler *> _http_connections;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start the querying
|
* Start the querying
|
||||||
|
|
|
@ -16,9 +16,9 @@
|
||||||
#include "core/tcp_http.h"
|
#include "core/tcp_http.h"
|
||||||
|
|
||||||
/** Vector with content info */
|
/** Vector with content info */
|
||||||
typedef SmallVector<ContentInfo *, 16> ContentVector;
|
typedef std::vector<ContentInfo *> ContentVector;
|
||||||
/** Vector with constant content info */
|
/** Vector with constant content info */
|
||||||
typedef SmallVector<const ContentInfo *, 16> ConstContentVector;
|
typedef std::vector<const ContentInfo *> ConstContentVector;
|
||||||
|
|
||||||
/** Iterator for the content vector */
|
/** Iterator for the content vector */
|
||||||
typedef ContentInfo **ContentIterator;
|
typedef ContentInfo **ContentIterator;
|
||||||
|
@ -66,11 +66,11 @@ struct ContentCallback {
|
||||||
*/
|
*/
|
||||||
class ClientNetworkContentSocketHandler : public NetworkContentSocketHandler, ContentCallback, HTTPCallback {
|
class ClientNetworkContentSocketHandler : public NetworkContentSocketHandler, ContentCallback, HTTPCallback {
|
||||||
protected:
|
protected:
|
||||||
typedef SmallVector<ContentID, 4> ContentIDList; ///< List of content IDs to (possibly) select.
|
typedef std::vector<ContentID> ContentIDList; ///< List of content IDs to (possibly) select.
|
||||||
SmallVector<ContentCallback *, 2> callbacks; ///< Callbacks to notify "the world"
|
std::vector<ContentCallback *> callbacks; ///< Callbacks to notify "the world"
|
||||||
ContentIDList requested; ///< ContentIDs we already requested (so we don't do it again)
|
ContentIDList requested; ///< ContentIDs we already requested (so we don't do it again)
|
||||||
ContentVector infos; ///< All content info we received
|
ContentVector infos; ///< All content info we received
|
||||||
SmallVector<char, 1024> http_response; ///< The HTTP response to the requests we've been doing
|
std::vector<char> http_response; ///< The HTTP response to the requests we've been doing
|
||||||
int http_response_index; ///< Where we are, in the response, with handling it
|
int http_response_index; ///< Where we are, in the response, with handling it
|
||||||
|
|
||||||
FILE *curFile; ///< Currently downloaded file
|
FILE *curFile; ///< Currently downloaded file
|
||||||
|
|
|
@ -160,7 +160,7 @@ void BaseNetworkContentDownloadStatusWindow::OnDownloadProgress(const ContentInf
|
||||||
/** Window for showing the download status of content */
|
/** Window for showing the download status of content */
|
||||||
struct NetworkContentDownloadStatusWindow : public BaseNetworkContentDownloadStatusWindow {
|
struct NetworkContentDownloadStatusWindow : public BaseNetworkContentDownloadStatusWindow {
|
||||||
private:
|
private:
|
||||||
SmallVector<ContentType, 4> receivedTypes; ///< Types we received so we can update their cache
|
std::vector<ContentType> receivedTypes; ///< Types we received so we can update their cache
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1728,7 +1728,7 @@ struct NetworkClientListPopupWindow : Window {
|
||||||
uint sel_index;
|
uint sel_index;
|
||||||
ClientID client_id;
|
ClientID client_id;
|
||||||
Point desired_location;
|
Point desired_location;
|
||||||
SmallVector<ClientListAction, 2> actions; ///< Actions to execute
|
std::vector<ClientListAction> actions; ///< Actions to execute
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an action to the list of actions to execute.
|
* Add an action to the list of actions to execute.
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
* served as subject to the initial testing of this codec. */
|
* served as subject to the initial testing of this codec. */
|
||||||
|
|
||||||
/** List of all loaded GRF files */
|
/** List of all loaded GRF files */
|
||||||
static SmallVector<GRFFile *, 16> _grf_files;
|
static std::vector<GRFFile *> _grf_files;
|
||||||
|
|
||||||
/** Miscellaneous GRF features, set by Action 0x0D, parameter 0x9E */
|
/** Miscellaneous GRF features, set by Action 0x0D, parameter 0x9E */
|
||||||
byte _misc_grf_features = 0;
|
byte _misc_grf_features = 0;
|
||||||
|
@ -459,7 +459,7 @@ struct StringIDMapping {
|
||||||
StringID source; ///< Source StringID (GRF local).
|
StringID source; ///< Source StringID (GRF local).
|
||||||
StringID *target; ///< Destination for mapping result.
|
StringID *target; ///< Destination for mapping result.
|
||||||
};
|
};
|
||||||
typedef SmallVector<StringIDMapping, 16> StringIDMappingVector;
|
typedef std::vector<StringIDMapping> StringIDMappingVector;
|
||||||
static StringIDMappingVector _string_to_grf_mapping;
|
static StringIDMappingVector _string_to_grf_mapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1901,7 +1901,7 @@ static ChangeInfoResult StationChangeInfo(uint stid, int numinfo, int prop, Byte
|
||||||
/* On error, bail out immediately. Temporary GRF data was already freed */
|
/* On error, bail out immediately. Temporary GRF data was already freed */
|
||||||
if (_cur.skip_sprites < 0) return CIR_DISABLED;
|
if (_cur.skip_sprites < 0) return CIR_DISABLED;
|
||||||
|
|
||||||
static SmallVector<DrawTileSeqStruct, 8> tmp_layout;
|
static std::vector<DrawTileSeqStruct> tmp_layout;
|
||||||
tmp_layout.clear();
|
tmp_layout.clear();
|
||||||
for (;;) {
|
for (;;) {
|
||||||
/* no relative bounding box support */
|
/* no relative bounding box support */
|
||||||
|
@ -4787,7 +4787,7 @@ static void NewSpriteGroup(ByteReader *buf)
|
||||||
case 2: group->size = DSG_SIZE_DWORD; varsize = 4; break;
|
case 2: group->size = DSG_SIZE_DWORD; varsize = 4; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
static SmallVector<DeterministicSpriteGroupAdjust, 16> adjusts;
|
static std::vector<DeterministicSpriteGroupAdjust> adjusts;
|
||||||
adjusts.clear();
|
adjusts.clear();
|
||||||
|
|
||||||
/* Loop through the var adjusts. Unfortunately we don't know how many we have
|
/* Loop through the var adjusts. Unfortunately we don't know how many we have
|
||||||
|
|
|
@ -122,10 +122,10 @@ struct GRFFile : ZeroedMemoryAllocator {
|
||||||
|
|
||||||
GRFLabel *label; ///< Pointer to the first label. This is a linked list, not an array.
|
GRFLabel *label; ///< Pointer to the first label. This is a linked list, not an array.
|
||||||
|
|
||||||
SmallVector<CargoLabel, 4> cargo_list; ///< Cargo translation table (local ID -> label)
|
std::vector<CargoLabel> cargo_list; ///< Cargo translation table (local ID -> label)
|
||||||
uint8 cargo_map[NUM_CARGO]; ///< Inverse cargo translation table (CargoID -> local ID)
|
uint8 cargo_map[NUM_CARGO]; ///< Inverse cargo translation table (CargoID -> local ID)
|
||||||
|
|
||||||
SmallVector<RailTypeLabel, 4> railtype_list; ///< Railtype translation table
|
std::vector<RailTypeLabel> railtype_list; ///< Railtype translation table
|
||||||
RailTypeByte railtype_map[RAILTYPE_END];
|
RailTypeByte railtype_map[RAILTYPE_END];
|
||||||
|
|
||||||
CanalProperties canal_local_properties[CF_END]; ///< Canal properties as set by this NewGRF
|
CanalProperties canal_local_properties[CF_END]; ///< Canal properties as set by this NewGRF
|
||||||
|
|
|
@ -579,7 +579,7 @@ bool Convert8bitBooleanCallback(const GRFFile *grffile, uint16 cbid, uint16 cb_r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* static */ SmallVector<DrawTileSeqStruct, 8> NewGRFSpriteLayout::result_seq;
|
/* static */ std::vector<DrawTileSeqStruct> NewGRFSpriteLayout::result_seq;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clone the building sprites of a spritelayout.
|
* Clone the building sprites of a spritelayout.
|
||||||
|
|
|
@ -170,7 +170,7 @@ struct NewGRFSpriteLayout : ZeroedMemoryAllocator, DrawTileSprites {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static SmallVector<DrawTileSeqStruct, 8> result_seq; ///< Temporary storage when preprocessing spritelayouts.
|
static std::vector<DrawTileSeqStruct> result_seq; ///< Temporary storage when preprocessing spritelayouts.
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -172,7 +172,7 @@ struct GRFConfig : ZeroedMemoryAllocator {
|
||||||
uint8 num_params; ///< Number of used parameters
|
uint8 num_params; ///< Number of used parameters
|
||||||
uint8 num_valid_params; ///< NOSAVE: Number of valid parameters (action 0x14)
|
uint8 num_valid_params; ///< NOSAVE: Number of valid parameters (action 0x14)
|
||||||
uint8 palette; ///< GRFPalette, bitset
|
uint8 palette; ///< GRFPalette, bitset
|
||||||
SmallVector<GRFParameterInfo *, 4> param_info; ///< NOSAVE: extra information about the parameters
|
std::vector<GRFParameterInfo *> param_info; ///< NOSAVE: extra information about the parameters
|
||||||
bool has_param_defaults; ///< NOSAVE: did this newgrf specify any defaults for it's parameters
|
bool has_param_defaults; ///< NOSAVE: did this newgrf specify any defaults for it's parameters
|
||||||
|
|
||||||
struct GRFConfig *next; ///< NOSAVE: Next item in the linked list
|
struct GRFConfig *next; ///< NOSAVE: Next item in the linked list
|
||||||
|
|
|
@ -29,7 +29,7 @@ struct NewGrfDebugSpritePicker {
|
||||||
NewGrfDebugSpritePickerMode mode; ///< Current state
|
NewGrfDebugSpritePickerMode mode; ///< Current state
|
||||||
void *clicked_pixel; ///< Clicked pixel (pointer to blitter buffer)
|
void *clicked_pixel; ///< Clicked pixel (pointer to blitter buffer)
|
||||||
uint32 click_time; ///< Realtime tick when clicked to detect next frame
|
uint32 click_time; ///< Realtime tick when clicked to detect next frame
|
||||||
SmallVector<SpriteID, 256> sprites; ///< Sprites found
|
std::vector<SpriteID> sprites; ///< Sprites found
|
||||||
};
|
};
|
||||||
|
|
||||||
extern NewGrfDebugSpritePicker _newgrf_debug_sprite_picker;
|
extern NewGrfDebugSpritePicker _newgrf_debug_sprite_picker;
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
#include "safeguards.h"
|
#include "safeguards.h"
|
||||||
|
|
||||||
/** The sprite picker. */
|
/** The sprite picker. */
|
||||||
NewGrfDebugSpritePicker _newgrf_debug_sprite_picker = { SPM_NONE, NULL, 0, SmallVector<SpriteID, 256>() };
|
NewGrfDebugSpritePicker _newgrf_debug_sprite_picker = { SPM_NONE, NULL, 0, std::vector<SpriteID>() };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the feature index related to the window number.
|
* Get the feature index related to the window number.
|
||||||
|
@ -894,7 +894,7 @@ struct SpriteAlignerWindow : Window {
|
||||||
const NWidgetBase *nwid = this->GetWidget<NWidgetBase>(widget);
|
const NWidgetBase *nwid = this->GetWidget<NWidgetBase>(widget);
|
||||||
int step_size = nwid->resize_y;
|
int step_size = nwid->resize_y;
|
||||||
|
|
||||||
SmallVector<SpriteID, 256> &list = _newgrf_debug_sprite_picker.sprites;
|
std::vector<SpriteID> &list = _newgrf_debug_sprite_picker.sprites;
|
||||||
int max = min<int>(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), list.size());
|
int max = min<int>(this->vscroll->GetPosition() + this->vscroll->GetCapacity(), list.size());
|
||||||
|
|
||||||
int y = r.top + WD_FRAMERECT_TOP;
|
int y = r.top + WD_FRAMERECT_TOP;
|
||||||
|
|
|
@ -1185,7 +1185,7 @@ struct ListOrderChange {
|
||||||
uint target; ///< local ID
|
uint target; ///< local ID
|
||||||
};
|
};
|
||||||
|
|
||||||
static SmallVector<ListOrderChange, 16> _list_order_changes;
|
static std::vector<ListOrderChange> _list_order_changes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Record a vehicle ListOrderChange.
|
* Record a vehicle ListOrderChange.
|
||||||
|
@ -1226,7 +1226,7 @@ static int CDECL EnginePreSort(const EngineID *a, const EngineID *b)
|
||||||
void CommitVehicleListOrderChanges()
|
void CommitVehicleListOrderChanges()
|
||||||
{
|
{
|
||||||
/* Pre-sort engines by scope-grfid and local index */
|
/* Pre-sort engines by scope-grfid and local index */
|
||||||
SmallVector<EngineID, 16> ordering;
|
std::vector<EngineID> ordering;
|
||||||
Engine *e;
|
Engine *e;
|
||||||
FOR_ALL_ENGINES(e) {
|
FOR_ALL_ENGINES(e) {
|
||||||
ordering.push_back(e->index);
|
ordering.push_back(e->index);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include "safeguards.h"
|
#include "safeguards.h"
|
||||||
|
|
||||||
static SmallVector<SoundEntry, 8> _sounds;
|
static std::vector<SoundEntry> _sounds;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -167,7 +167,7 @@ static byte _currentLangID = GRFLX_ENGLISH; ///< by default, english is used.
|
||||||
*/
|
*/
|
||||||
int LanguageMap::GetMapping(int newgrf_id, bool gender) const
|
int LanguageMap::GetMapping(int newgrf_id, bool gender) const
|
||||||
{
|
{
|
||||||
const SmallVector<Mapping, 1> &map = gender ? this->gender_map : this->case_map;
|
const std::vector<Mapping> &map = gender ? this->gender_map : this->case_map;
|
||||||
for (const Mapping &m : map) {
|
for (const Mapping &m : map) {
|
||||||
if (m.newgrf_id == newgrf_id) return m.openttd_id;
|
if (m.newgrf_id == newgrf_id) return m.openttd_id;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ int LanguageMap::GetMapping(int newgrf_id, bool gender) const
|
||||||
*/
|
*/
|
||||||
int LanguageMap::GetReverseMapping(int openttd_id, bool gender) const
|
int LanguageMap::GetReverseMapping(int openttd_id, bool gender) const
|
||||||
{
|
{
|
||||||
const SmallVector<Mapping, 1> &map = gender ? this->gender_map : this->case_map;
|
const std::vector<Mapping> &map = gender ? this->gender_map : this->case_map;
|
||||||
for (const Mapping &m : map) {
|
for (const Mapping &m : map) {
|
||||||
if (m.openttd_id == openttd_id) return m.newgrf_id;
|
if (m.openttd_id == openttd_id) return m.newgrf_id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,8 +57,8 @@ struct LanguageMap {
|
||||||
* the genders/cases/plural OpenTTD IDs to the NewGRF's internal IDs. In this
|
* the genders/cases/plural OpenTTD IDs to the NewGRF's internal IDs. In this
|
||||||
* case a NewGRF developer/translator might want a different translation for
|
* case a NewGRF developer/translator might want a different translation for
|
||||||
* both cases. Thus we are basically implementing a multi-map. */
|
* both cases. Thus we are basically implementing a multi-map. */
|
||||||
SmallVector<Mapping, 1> gender_map; ///< Mapping of NewGRF and OpenTTD IDs for genders.
|
std::vector<Mapping> gender_map; ///< Mapping of NewGRF and OpenTTD IDs for genders.
|
||||||
SmallVector<Mapping, 1> case_map; ///< Mapping of NewGRF and OpenTTD IDs for cases.
|
std::vector<Mapping> case_map; ///< Mapping of NewGRF and OpenTTD IDs for cases.
|
||||||
int plural_form; ///< The plural form used for this language.
|
int plural_form; ///< The plural form used for this language.
|
||||||
|
|
||||||
int GetMapping(int newgrf_id, bool gender) const;
|
int GetMapping(int newgrf_id, bool gender) const;
|
||||||
|
|
|
@ -92,6 +92,6 @@ struct ClearedObjectArea {
|
||||||
};
|
};
|
||||||
|
|
||||||
ClearedObjectArea *FindClearedObject(TileIndex tile);
|
ClearedObjectArea *FindClearedObject(TileIndex tile);
|
||||||
extern SmallVector<ClearedObjectArea, 4> _cleared_object_areas;
|
extern std::vector<ClearedObjectArea> _cleared_object_areas;
|
||||||
|
|
||||||
#endif /* OBJECT_BASE_H */
|
#endif /* OBJECT_BASE_H */
|
||||||
|
|
|
@ -442,7 +442,7 @@ static void ReallyClearObjectTile(Object *o)
|
||||||
delete o;
|
delete o;
|
||||||
}
|
}
|
||||||
|
|
||||||
SmallVector<ClearedObjectArea, 4> _cleared_object_areas;
|
std::vector<ClearedObjectArea> _cleared_object_areas;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the entry in _cleared_object_areas which occupies a certain tile.
|
* Find the entry in _cleared_object_areas which occupies a certain tile.
|
||||||
|
|
|
@ -1174,7 +1174,7 @@ static void CheckCaches()
|
||||||
if (_debug_desync_level <= 1) return;
|
if (_debug_desync_level <= 1) return;
|
||||||
|
|
||||||
/* Check the town caches. */
|
/* Check the town caches. */
|
||||||
SmallVector<TownCache, 4> old_town_caches;
|
std::vector<TownCache> old_town_caches;
|
||||||
Town *t;
|
Town *t;
|
||||||
FOR_ALL_TOWNS(t) {
|
FOR_ALL_TOWNS(t) {
|
||||||
old_town_caches.push_back(t->cache);
|
old_town_caches.push_back(t->cache);
|
||||||
|
@ -1193,7 +1193,7 @@ static void CheckCaches()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check company infrastructure cache. */
|
/* Check company infrastructure cache. */
|
||||||
SmallVector<CompanyInfrastructure, 4> old_infrastructure;
|
std::vector<CompanyInfrastructure> old_infrastructure;
|
||||||
Company *c;
|
Company *c;
|
||||||
FOR_ALL_COMPANIES(c) old_infrastructure.push_back(c->infrastructure);
|
FOR_ALL_COMPANIES(c) old_infrastructure.push_back(c->infrastructure);
|
||||||
|
|
||||||
|
|
|
@ -118,7 +118,7 @@ enum RailFenceOffset {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** List of rail type labels. */
|
/** List of rail type labels. */
|
||||||
typedef SmallVector<RailTypeLabel, 4> RailTypeLabelList;
|
typedef std::vector<RailTypeLabel> RailTypeLabelList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This struct contains all the info that is needed to draw and construct tracks.
|
* This struct contains all the info that is needed to draw and construct tracks.
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#include "safeguards.h"
|
#include "safeguards.h"
|
||||||
|
|
||||||
/** Helper type for lists/vectors of trains */
|
/** Helper type for lists/vectors of trains */
|
||||||
typedef SmallVector<Train *, 16> TrainList;
|
typedef std::vector<Train *> TrainList;
|
||||||
|
|
||||||
RailtypeInfo _railtypes[RAILTYPE_END];
|
RailtypeInfo _railtypes[RAILTYPE_END];
|
||||||
RailType _sorted_railtypes[RAILTYPE_END];
|
RailType _sorted_railtypes[RAILTYPE_END];
|
||||||
|
@ -1603,7 +1603,7 @@ CommandCost CmdConvertRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
SmallVector<Train *, 2> vehicles_affected;
|
std::vector<Train *> vehicles_affected;
|
||||||
|
|
||||||
/* Vehicle on the tile when not converting Rail <-> ElRail
|
/* Vehicle on the tile when not converting Rail <-> ElRail
|
||||||
* Tunnels and bridges have special check later */
|
* Tunnels and bridges have special check later */
|
||||||
|
|
|
@ -2195,7 +2195,7 @@ bool AfterLoadGame()
|
||||||
/* Animated tiles would sometimes not be actually animated or
|
/* Animated tiles would sometimes not be actually animated or
|
||||||
* in case of old savegames duplicate. */
|
* in case of old savegames duplicate. */
|
||||||
|
|
||||||
extern SmallVector<TileIndex, 256> _animated_tiles;
|
extern std::vector<TileIndex> _animated_tiles;
|
||||||
|
|
||||||
for (auto tile = _animated_tiles.begin(); tile < _animated_tiles.end(); /* Nothing */) {
|
for (auto tile = _animated_tiles.begin(); tile < _animated_tiles.end(); /* Nothing */) {
|
||||||
/* Remove if tile is not animated */
|
/* Remove if tile is not animated */
|
||||||
|
@ -2939,7 +2939,7 @@ bool AfterLoadGame()
|
||||||
* So, make articulated parts catch up. */
|
* So, make articulated parts catch up. */
|
||||||
RoadVehicle *v;
|
RoadVehicle *v;
|
||||||
bool roadside = _settings_game.vehicle.road_side == 1;
|
bool roadside = _settings_game.vehicle.road_side == 1;
|
||||||
SmallVector<uint, 16> skip_frames;
|
std::vector<uint> skip_frames;
|
||||||
FOR_ALL_ROADVEHICLES(v) {
|
FOR_ALL_ROADVEHICLES(v) {
|
||||||
if (!v->IsFrontEngine()) continue;
|
if (!v->IsFrontEngine()) continue;
|
||||||
skip_frames.clear();
|
skip_frames.clear();
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
#include "../safeguards.h"
|
#include "../safeguards.h"
|
||||||
|
|
||||||
extern SmallVector<TileIndex, 256> _animated_tiles;
|
extern std::vector<TileIndex> _animated_tiles;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save the ANIT chunk.
|
* Save the ANIT chunk.
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
#include "../safeguards.h"
|
#include "../safeguards.h"
|
||||||
|
|
||||||
static SmallVector<RailTypeLabel, RAILTYPE_END> _railtype_list;
|
static std::vector<RailTypeLabel> _railtype_list;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test if any saved rail type labels are different to the currently loaded
|
* Test if any saved rail type labels are different to the currently loaded
|
||||||
|
@ -42,7 +42,7 @@ static bool NeedRailTypeConversion()
|
||||||
void AfterLoadLabelMaps()
|
void AfterLoadLabelMaps()
|
||||||
{
|
{
|
||||||
if (NeedRailTypeConversion()) {
|
if (NeedRailTypeConversion()) {
|
||||||
SmallVector<RailType, RAILTYPE_END> railtype_conversion_map;
|
std::vector<RailType> railtype_conversion_map;
|
||||||
|
|
||||||
for (uint i = 0; i < _railtype_list.size(); i++) {
|
for (uint i = 0; i < _railtype_list.size(); i++) {
|
||||||
RailType r = GetRailTypeByLabel(_railtype_list[i]);
|
RailType r = GetRailTypeByLabel(_railtype_list[i]);
|
||||||
|
|
|
@ -51,7 +51,7 @@ const SaveLoad *GetLinkGraphDesc()
|
||||||
*/
|
*/
|
||||||
const SaveLoad *GetLinkGraphJobDesc()
|
const SaveLoad *GetLinkGraphJobDesc()
|
||||||
{
|
{
|
||||||
static SmallVector<SaveLoad, 16> saveloads;
|
static std::vector<SaveLoad> saveloads;
|
||||||
static const char *prefix = "linkgraph.";
|
static const char *prefix = "linkgraph.";
|
||||||
|
|
||||||
/* Build the SaveLoad array on first call and don't touch it later on */
|
/* Build the SaveLoad array on first call and don't touch it later on */
|
||||||
|
|
|
@ -491,7 +491,7 @@ static inline uint RemapOrderIndex(uint x)
|
||||||
return _savegame_type == SGT_TTO ? (x - 0x1AC4) / 2 : (x - 0x1C18) / 2;
|
return _savegame_type == SGT_TTO ? (x - 0x1AC4) / 2 : (x - 0x1C18) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern SmallVector<TileIndex, 256> _animated_tiles;
|
extern std::vector<TileIndex> _animated_tiles;
|
||||||
extern char *_old_name_array;
|
extern char *_old_name_array;
|
||||||
|
|
||||||
static uint32 _old_town_index;
|
static uint32 _old_town_index;
|
||||||
|
|
|
@ -42,7 +42,7 @@ struct OldWaypoint {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Temporary array with old waypoints. */
|
/** Temporary array with old waypoints. */
|
||||||
static SmallVector<OldWaypoint, 16> _old_waypoints;
|
static std::vector<OldWaypoint> _old_waypoints;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the waypoint orders to get the new waypoint ID.
|
* Update the waypoint orders to get the new waypoint ID.
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace SQConvert {
|
||||||
* comes out of scope. Useful to make sure you can use stredup(),
|
* comes out of scope. Useful to make sure you can use stredup(),
|
||||||
* without leaking memory.
|
* without leaking memory.
|
||||||
*/
|
*/
|
||||||
struct SQAutoFreePointers : SmallVector<void *, 1> {
|
struct SQAutoFreePointers : std::vector<void *> {
|
||||||
~SQAutoFreePointers()
|
~SQAutoFreePointers()
|
||||||
{
|
{
|
||||||
for (uint i = 0; i < std::vector<void *>::size(); i++) free(std::vector<void *>::operator[](i));
|
for (uint i = 0; i < std::vector<void *>::size(); i++) free(std::vector<void *>::operator[](i));
|
||||||
|
@ -132,7 +132,7 @@ namespace SQConvert {
|
||||||
sq_pushobject(vm, obj);
|
sq_pushobject(vm, obj);
|
||||||
sq_pushnull(vm);
|
sq_pushnull(vm);
|
||||||
|
|
||||||
SmallVector<int32, 2> data;
|
std::vector<int32> data;
|
||||||
|
|
||||||
while (SQ_SUCCEEDED(sq_next(vm, -2))) {
|
while (SQ_SUCCEEDED(sq_next(vm, -2))) {
|
||||||
SQInteger tmp;
|
SQInteger tmp;
|
||||||
|
|
|
@ -152,7 +152,7 @@ private:
|
||||||
return num_blocks > 0 && this->output_buffer[num_blocks - 1].HasRoom();
|
return num_blocks > 0 && this->output_buffer[num_blocks - 1].HasRoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef SmallVector<OutputBuffer, 2> OutputBufferVector; ///< Vector type for output buffers.
|
typedef std::vector<OutputBuffer> OutputBufferVector; ///< Vector type for output buffers.
|
||||||
OutputBufferVector output_buffer; ///< Vector of blocks containing the stored output.
|
OutputBufferVector output_buffer; ///< Vector of blocks containing the stored output.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ struct Filtering {
|
||||||
* @tparam F Type of data fed as additional value to the filter function. @see FilterFunction
|
* @tparam F Type of data fed as additional value to the filter function. @see FilterFunction
|
||||||
*/
|
*/
|
||||||
template <typename T, typename F = const char*>
|
template <typename T, typename F = const char*>
|
||||||
class GUIList : public SmallVector<T, 32> {
|
class GUIList : public std::vector<T> {
|
||||||
public:
|
public:
|
||||||
typedef int CDECL SortFunction(const T*, const T*); ///< Signature of sort function.
|
typedef int CDECL SortFunction(const T*, const T*); ///< Signature of sort function.
|
||||||
typedef bool CDECL FilterFunction(const T*, F); ///< Signature of filter function.
|
typedef bool CDECL FilterFunction(const T*, F); ///< Signature of filter function.
|
||||||
|
|
|
@ -887,7 +887,7 @@ static CommandCost CheckFlatLandAirport(AirportTileTableIterator tile_iter, DoCo
|
||||||
* @param numtracks Number of platforms.
|
* @param numtracks Number of platforms.
|
||||||
* @return The cost in case of success, or an error code if it failed.
|
* @return The cost in case of success, or an error code if it failed.
|
||||||
*/
|
*/
|
||||||
static CommandCost CheckFlatLandRailStation(TileArea tile_area, DoCommandFlag flags, Axis axis, StationID *station, RailType rt, SmallVector<Train *, 4> &affected_vehicles, StationClassID spec_class, byte spec_index, byte plat_len, byte numtracks)
|
static CommandCost CheckFlatLandRailStation(TileArea tile_area, DoCommandFlag flags, Axis axis, StationID *station, RailType rt, std::vector<Train *> &affected_vehicles, StationClassID spec_class, byte spec_index, byte plat_len, byte numtracks)
|
||||||
{
|
{
|
||||||
CommandCost cost(EXPENSES_CONSTRUCTION);
|
CommandCost cost(EXPENSES_CONSTRUCTION);
|
||||||
int allowed_z = -1;
|
int allowed_z = -1;
|
||||||
|
@ -1310,7 +1310,7 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32
|
||||||
|
|
||||||
/* Make sure the area below consists of clear tiles. (OR tiles belonging to a certain rail station) */
|
/* Make sure the area below consists of clear tiles. (OR tiles belonging to a certain rail station) */
|
||||||
StationID est = INVALID_STATION;
|
StationID est = INVALID_STATION;
|
||||||
SmallVector<Train *, 4> affected_vehicles;
|
std::vector<Train *> affected_vehicles;
|
||||||
/* Clear the land below the station. */
|
/* Clear the land below the station. */
|
||||||
CommandCost cost = CheckFlatLandRailStation(new_location, flags, axis, &est, rt, affected_vehicles, spec_class, spec_index, plat_len, numtracks);
|
CommandCost cost = CheckFlatLandRailStation(new_location, flags, axis, &est, rt, affected_vehicles, spec_class, spec_index, plat_len, numtracks);
|
||||||
if (cost.Failed()) return cost;
|
if (cost.Failed()) return cost;
|
||||||
|
@ -1547,7 +1547,7 @@ restart:
|
||||||
* @return the number of cleared tiles or an error.
|
* @return the number of cleared tiles or an error.
|
||||||
*/
|
*/
|
||||||
template <class T>
|
template <class T>
|
||||||
CommandCost RemoveFromRailBaseStation(TileArea ta, SmallVector<T *, 4> &affected_stations, DoCommandFlag flags, Money removal_cost, bool keep_rail)
|
CommandCost RemoveFromRailBaseStation(TileArea ta, std::vector<T *> &affected_stations, DoCommandFlag flags, Money removal_cost, bool keep_rail)
|
||||||
{
|
{
|
||||||
/* Count of the number of tiles removed */
|
/* Count of the number of tiles removed */
|
||||||
int quantity = 0;
|
int quantity = 0;
|
||||||
|
@ -1660,7 +1660,7 @@ CommandCost CmdRemoveFromRailStation(TileIndex start, DoCommandFlag flags, uint3
|
||||||
if (start >= MapSize() || end >= MapSize()) return CMD_ERROR;
|
if (start >= MapSize() || end >= MapSize()) return CMD_ERROR;
|
||||||
|
|
||||||
TileArea ta(start, end);
|
TileArea ta(start, end);
|
||||||
SmallVector<Station *, 4> affected_stations;
|
std::vector<Station *> affected_stations;
|
||||||
|
|
||||||
CommandCost ret = RemoveFromRailBaseStation(ta, affected_stations, flags, _price[PR_CLEAR_STATION_RAIL], HasBit(p2, 0));
|
CommandCost ret = RemoveFromRailBaseStation(ta, affected_stations, flags, _price[PR_CLEAR_STATION_RAIL], HasBit(p2, 0));
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
|
@ -1694,7 +1694,7 @@ CommandCost CmdRemoveFromRailWaypoint(TileIndex start, DoCommandFlag flags, uint
|
||||||
if (start >= MapSize() || end >= MapSize()) return CMD_ERROR;
|
if (start >= MapSize() || end >= MapSize()) return CMD_ERROR;
|
||||||
|
|
||||||
TileArea ta(start, end);
|
TileArea ta(start, end);
|
||||||
SmallVector<Waypoint *, 4> affected_stations;
|
std::vector<Waypoint *> affected_stations;
|
||||||
|
|
||||||
return RemoveFromRailBaseStation(ta, affected_stations, flags, _price[PR_CLEAR_WAYPOINT_RAIL], HasBit(p2, 0));
|
return RemoveFromRailBaseStation(ta, affected_stations, flags, _price[PR_CLEAR_WAYPOINT_RAIL], HasBit(p2, 0));
|
||||||
}
|
}
|
||||||
|
@ -1727,7 +1727,7 @@ CommandCost RemoveRailStation(T *st, DoCommandFlag flags, Money removal_cost)
|
||||||
TILE_AREA_LOOP(tile, ta) {
|
TILE_AREA_LOOP(tile, ta) {
|
||||||
/* only remove tiles that are actually train station tiles */
|
/* only remove tiles that are actually train station tiles */
|
||||||
if (st->TileBelongsToRailStation(tile)) {
|
if (st->TileBelongsToRailStation(tile)) {
|
||||||
SmallVector<T*, 4> affected_stations; // dummy
|
std::vector<T*> affected_stations; // dummy
|
||||||
CommandCost ret = RemoveFromRailBaseStation(TileArea(tile, 1, 1), affected_stations, flags, removal_cost, false);
|
CommandCost ret = RemoveFromRailBaseStation(TileArea(tile, 1, 1), affected_stations, flags, removal_cost, false);
|
||||||
if (ret.Failed()) return ret;
|
if (ret.Failed()) return ret;
|
||||||
cost.AddCost(ret);
|
cost.AddCost(ret);
|
||||||
|
@ -3521,7 +3521,7 @@ void DeleteStaleLinks(Station *from)
|
||||||
/* Have all vehicles refresh their next hops before deciding to
|
/* Have all vehicles refresh their next hops before deciding to
|
||||||
* remove the node. */
|
* remove the node. */
|
||||||
OrderList *l;
|
OrderList *l;
|
||||||
SmallVector<Vehicle *, 32> vehicles;
|
std::vector<Vehicle *> vehicles;
|
||||||
FOR_ALL_ORDER_LISTS(l) {
|
FOR_ALL_ORDER_LISTS(l) {
|
||||||
bool found_from = false;
|
bool found_from = false;
|
||||||
bool found_to = false;
|
bool found_to = false;
|
||||||
|
|
|
@ -2116,8 +2116,8 @@ struct TileAndStation {
|
||||||
StationID station; ///< StationID
|
StationID station; ///< StationID
|
||||||
};
|
};
|
||||||
|
|
||||||
static SmallVector<TileAndStation, 8> _deleted_stations_nearby;
|
static std::vector<TileAndStation> _deleted_stations_nearby;
|
||||||
static SmallVector<StationID, 8> _stations_nearby_list;
|
static std::vector<StationID> _stations_nearby_list;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add station on this tile to _stations_nearby_list if it's fully within the
|
* Add station on this tile to _stations_nearby_list if it's fully within the
|
||||||
|
|
|
@ -235,7 +235,7 @@ static ParsedCommandStruct _cur_pcs;
|
||||||
static int _cur_argidx;
|
static int _cur_argidx;
|
||||||
|
|
||||||
/** The buffer for writing a single string. */
|
/** The buffer for writing a single string. */
|
||||||
struct Buffer : SmallVector<byte, 256> {
|
struct Buffer : std::vector<byte> {
|
||||||
/**
|
/**
|
||||||
* Convenience method for adding a byte.
|
* Convenience method for adding a byte.
|
||||||
* @param value The value to add.
|
* @param value The value to add.
|
||||||
|
|
|
@ -624,8 +624,8 @@ class IcuStringIterator : public StringIterator
|
||||||
icu::BreakIterator *char_itr; ///< ICU iterator for characters.
|
icu::BreakIterator *char_itr; ///< ICU iterator for characters.
|
||||||
icu::BreakIterator *word_itr; ///< ICU iterator for words.
|
icu::BreakIterator *word_itr; ///< ICU iterator for words.
|
||||||
|
|
||||||
SmallVector<UChar, 32> utf16_str; ///< UTF-16 copy of the string.
|
std::vector<UChar> utf16_str; ///< UTF-16 copy of the string.
|
||||||
SmallVector<size_t, 32> utf16_to_utf8; ///< Mapping from UTF-16 code point position to index in the UTF-8 source string.
|
std::vector<size_t> utf16_to_utf8; ///< Mapping from UTF-16 code point position to index in the UTF-8 source string.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IcuStringIterator() : char_itr(NULL), word_itr(NULL)
|
IcuStringIterator() : char_itr(NULL), word_itr(NULL)
|
||||||
|
|
|
@ -39,7 +39,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *filter_buffer; ///< Parsed filter string. Words separated by 0.
|
const char *filter_buffer; ///< Parsed filter string. Words separated by 0.
|
||||||
SmallVector<WordState, 4> word_index; ///< Word index and filter state.
|
std::vector<WordState> word_index; ///< Word index and filter state.
|
||||||
uint word_matches; ///< Summary of filter state: Number of words matched.
|
uint word_matches; ///< Summary of filter state: Number of words matched.
|
||||||
|
|
||||||
const bool *case_sensitive; ///< Match case-sensitively (usually a static variable).
|
const bool *case_sensitive; ///< Match case-sensitively (usually a static variable).
|
||||||
|
|
|
@ -564,7 +564,7 @@ bool CheckSubsidised(CargoID cargo_type, CompanyID company, SourceType src_type,
|
||||||
|
|
||||||
/* Remember all towns near this station (at least one house in its catchment radius)
|
/* Remember all towns near this station (at least one house in its catchment radius)
|
||||||
* which are destination of subsidised path. Do that only if needed */
|
* which are destination of subsidised path. Do that only if needed */
|
||||||
SmallVector<const Town *, 2> towns_near;
|
std::vector<const Town *> towns_near;
|
||||||
if (!st->rect.IsEmpty()) {
|
if (!st->rect.IsEmpty()) {
|
||||||
Subsidy *s;
|
Subsidy *s;
|
||||||
FOR_ALL_SUBSIDIES(s) {
|
FOR_ALL_SUBSIDIES(s) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ struct TextEffect : public ViewportSign {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static SmallVector<struct TextEffect, 32> _text_effects; ///< Text effects are stored there
|
static std::vector<struct TextEffect> _text_effects; ///< Text effects are stored there
|
||||||
|
|
||||||
/* Text Effects */
|
/* Text Effects */
|
||||||
TextEffectID AddTextEffect(StringID msg, int center, int y, uint8 duration, TextEffectMode mode)
|
TextEffectID AddTextEffect(StringID msg, int center, int y, uint8 duration, TextEffectMode mode)
|
||||||
|
|
|
@ -21,12 +21,12 @@ const char *GetTextfile(TextfileType type, Subdirectory dir, const char *filenam
|
||||||
|
|
||||||
/** Window for displaying a textfile */
|
/** Window for displaying a textfile */
|
||||||
struct TextfileWindow : public Window, MissingGlyphSearcher {
|
struct TextfileWindow : public Window, MissingGlyphSearcher {
|
||||||
TextfileType file_type; ///< Type of textfile to view.
|
TextfileType file_type; ///< Type of textfile to view.
|
||||||
Scrollbar *vscroll; ///< Vertical scrollbar.
|
Scrollbar *vscroll; ///< Vertical scrollbar.
|
||||||
Scrollbar *hscroll; ///< Horizontal scrollbar.
|
Scrollbar *hscroll; ///< Horizontal scrollbar.
|
||||||
char *text; ///< Lines of text from the NewGRF's textfile.
|
char *text; ///< Lines of text from the NewGRF's textfile.
|
||||||
SmallVector<const char *, 64> lines; ///< #text, split into lines in a table with lines.
|
std::vector<const char *> lines; ///< #text, split into lines in a table with lines.
|
||||||
uint search_iterator; ///< Iterator for the font check search.
|
uint search_iterator; ///< Iterator for the font check search.
|
||||||
|
|
||||||
static const int TOP_SPACING = WD_FRAMETEXT_TOP; ///< Additional spacing at the top of the #WID_TF_BACKGROUND widget.
|
static const int TOP_SPACING = WD_FRAMETEXT_TOP; ///< Additional spacing at the top of the #WID_TF_BACKGROUND widget.
|
||||||
static const int BOTTOM_SPACING = WD_FRAMETEXT_BOTTOM; ///< Additional spacing at the bottom of the #WID_TF_BACKGROUND widget.
|
static const int BOTTOM_SPACING = WD_FRAMETEXT_BOTTOM; ///< Additional spacing at the bottom of the #WID_TF_BACKGROUND widget.
|
||||||
|
|
|
@ -281,7 +281,7 @@ CommandCost CmdSetTimetableStart(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||||
if (timetable_all && !v->orders.list->IsCompleteTimetable()) return CMD_ERROR;
|
if (timetable_all && !v->orders.list->IsCompleteTimetable()) return CMD_ERROR;
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
SmallVector<Vehicle *, 8> vehs;
|
std::vector<Vehicle *> vehs;
|
||||||
|
|
||||||
if (timetable_all) {
|
if (timetable_all) {
|
||||||
for (Vehicle *w = v->orders.list->GetFirstSharedVehicle(); w != NULL; w = w->NextShared()) {
|
for (Vehicle *w = v->orders.list->GetFirstSharedVehicle(); w != NULL; w = w->NextShared()) {
|
||||||
|
|
|
@ -814,7 +814,7 @@ static Train *FindGoodVehiclePos(const Train *src)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Helper type for lists/vectors of trains */
|
/** Helper type for lists/vectors of trains */
|
||||||
typedef SmallVector<Train *, 16> TrainList;
|
typedef std::vector<Train *> TrainList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a backup of a train into a train list.
|
* Make a backup of a train into a train list.
|
||||||
|
|
|
@ -186,7 +186,7 @@ static const uint TRAIN_DETAILS_MIN_INDENT = 32; ///< Minimum indent level in th
|
||||||
static const uint TRAIN_DETAILS_MAX_INDENT = 72; ///< Maximum indent level in the train details window; wider than this and we start on a new line
|
static const uint TRAIN_DETAILS_MAX_INDENT = 72; ///< Maximum indent level in the train details window; wider than this and we start on a new line
|
||||||
|
|
||||||
/** Container for the cargo summary information. */
|
/** Container for the cargo summary information. */
|
||||||
typedef SmallVector<CargoSummaryItem, 2> CargoSummary;
|
typedef std::vector<CargoSummaryItem> CargoSummary;
|
||||||
/** Reused container of cargo details */
|
/** Reused container of cargo details */
|
||||||
static CargoSummary _cargo_summary;
|
static CargoSummary _cargo_summary;
|
||||||
|
|
||||||
|
|
|
@ -346,8 +346,7 @@ static CommandCost RefitVehicle(Vehicle *v, bool only_this, uint8 num_vehicles,
|
||||||
v = v->First();
|
v = v->First();
|
||||||
}
|
}
|
||||||
|
|
||||||
static SmallVector<RefitResult, 16> refit_result;
|
std::vector<RefitResult> refit_result;
|
||||||
refit_result.clear();
|
|
||||||
|
|
||||||
v->InvalidateNewGRFCacheOfChain();
|
v->InvalidateNewGRFCacheOfChain();
|
||||||
byte actual_subtype = new_subtype;
|
byte actual_subtype = new_subtype;
|
||||||
|
|
|
@ -175,7 +175,7 @@ bool CanVehicleUseStation(const Vehicle *v, const struct Station *st);
|
||||||
|
|
||||||
void ReleaseDisastersTargetingVehicle(VehicleID vehicle);
|
void ReleaseDisastersTargetingVehicle(VehicleID vehicle);
|
||||||
|
|
||||||
typedef SmallVector<VehicleID, 2> VehicleSet;
|
typedef std::vector<VehicleID> VehicleSet;
|
||||||
void GetVehicleSet(VehicleSet &set, Vehicle *v, uint8 num_vehicles);
|
void GetVehicleSet(VehicleSet &set, Vehicle *v, uint8 num_vehicles);
|
||||||
|
|
||||||
void CheckCargoCapacity(Vehicle *v);
|
void CheckCargoCapacity(Vehicle *v);
|
||||||
|
|
|
@ -233,7 +233,7 @@ byte GetBestFittingSubType(Vehicle *v_from, Vehicle *v_for, CargoID dest_cargo_t
|
||||||
v_for = v_for->GetFirstEnginePart();
|
v_for = v_for->GetFirstEnginePart();
|
||||||
|
|
||||||
/* Create a list of subtypes used by the various parts of v_for */
|
/* Create a list of subtypes used by the various parts of v_for */
|
||||||
static SmallVector<StringID, 4> subtypes;
|
static std::vector<StringID> subtypes;
|
||||||
subtypes.clear();
|
subtypes.clear();
|
||||||
for (; v_from != NULL; v_from = v_from->HasArticulatedPart() ? v_from->GetNextArticulatedPart() : NULL) {
|
for (; v_from != NULL; v_from = v_from->HasArticulatedPart() ? v_from->GetNextArticulatedPart() : NULL) {
|
||||||
const Engine *e_from = v_from->GetEngine();
|
const Engine *e_from = v_from->GetEngine();
|
||||||
|
@ -317,7 +317,7 @@ struct RefitOption {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef SmallVector<RefitOption, 32> SubtypeList; ///< List of refit subtypes associated to a cargo.
|
typedef std::vector<RefitOption> SubtypeList; ///< List of refit subtypes associated to a cargo.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw the list of available refit options for a consist and highlight the selected refit option (if any).
|
* Draw the list of available refit options for a consist and highlight the selected refit option (if any).
|
||||||
|
|
|
@ -52,7 +52,7 @@ struct VehicleListIdentifier {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** A list of vehicles. */
|
/** A list of vehicles. */
|
||||||
typedef SmallVector<const Vehicle *, 32> VehicleList;
|
typedef std::vector<const Vehicle *> VehicleList;
|
||||||
|
|
||||||
bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &identifier);
|
bool GenerateVehicleSortList(VehicleList *list, const VehicleListIdentifier &identifier);
|
||||||
void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engine_list, VehicleList *wagon_list, bool individual_wagons = false);
|
void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engine_list, VehicleList *wagon_list, bool individual_wagons = false);
|
||||||
|
|
|
@ -153,10 +153,10 @@ enum SpriteCombineMode {
|
||||||
SPRITE_COMBINE_ACTIVE, ///< %Sprite combining is active. #AddSortableSpriteToDraw outputs child sprites.
|
SPRITE_COMBINE_ACTIVE, ///< %Sprite combining is active. #AddSortableSpriteToDraw outputs child sprites.
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef SmallVector<TileSpriteToDraw, 64> TileSpriteToDrawVector;
|
typedef std::vector<TileSpriteToDraw> TileSpriteToDrawVector;
|
||||||
typedef SmallVector<StringSpriteToDraw, 4> StringSpriteToDrawVector;
|
typedef std::vector<StringSpriteToDraw> StringSpriteToDrawVector;
|
||||||
typedef SmallVector<ParentSpriteToDraw, 64> ParentSpriteToDrawVector;
|
typedef std::vector<ParentSpriteToDraw> ParentSpriteToDrawVector;
|
||||||
typedef SmallVector<ChildScreenSpriteToDraw, 16> ChildScreenSpriteToDrawVector;
|
typedef std::vector<ChildScreenSpriteToDraw> ChildScreenSpriteToDrawVector;
|
||||||
|
|
||||||
/** Data structure storing rendering information */
|
/** Data structure storing rendering information */
|
||||||
struct ViewportDrawer {
|
struct ViewportDrawer {
|
||||||
|
|
|
@ -41,7 +41,7 @@ struct ParentSpriteToDraw {
|
||||||
bool comparison_done; ///< Used during sprite sorting: true if sprite has been compared with all other sprites
|
bool comparison_done; ///< Used during sprite sorting: true if sprite has been compared with all other sprites
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef SmallVector<ParentSpriteToDraw*, 64> ParentSpriteToSortVector;
|
typedef std::vector<ParentSpriteToDraw*> ParentSpriteToSortVector;
|
||||||
|
|
||||||
/** Type for method for checking whether a viewport sprite sorter exists. */
|
/** Type for method for checking whether a viewport sprite sorter exists. */
|
||||||
typedef bool (*VpSorterChecker)();
|
typedef bool (*VpSorterChecker)();
|
||||||
|
|
|
@ -85,7 +85,7 @@ SpecialMouseMode _special_mouse_mode; ///< Mode of the mouse.
|
||||||
* List of all WindowDescs.
|
* List of all WindowDescs.
|
||||||
* This is a pointer to ensure initialisation order with the various static WindowDesc instances.
|
* This is a pointer to ensure initialisation order with the various static WindowDesc instances.
|
||||||
*/
|
*/
|
||||||
static SmallVector<WindowDesc*, 16> *_window_descs = NULL;
|
static std::vector<WindowDesc*> *_window_descs = NULL;
|
||||||
|
|
||||||
/** Config file to store WindowDesc */
|
/** Config file to store WindowDesc */
|
||||||
char *_windows_file;
|
char *_windows_file;
|
||||||
|
@ -108,7 +108,7 @@ WindowDesc::WindowDesc(WindowPosition def_pos, const char *ini_key, int16 def_wi
|
||||||
default_width_trad(def_width_trad),
|
default_width_trad(def_width_trad),
|
||||||
default_height_trad(def_height_trad)
|
default_height_trad(def_height_trad)
|
||||||
{
|
{
|
||||||
if (_window_descs == NULL) _window_descs = new SmallVector<WindowDesc*, 16>();
|
if (_window_descs == NULL) _window_descs = new std::vector<WindowDesc*>();
|
||||||
_window_descs->push_back(this);
|
_window_descs->push_back(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -281,7 +281,7 @@ protected:
|
||||||
void InitializePositionSize(int x, int y, int min_width, int min_height);
|
void InitializePositionSize(int x, int y, int min_width, int min_height);
|
||||||
virtual void FindWindowPlacementAndResize(int def_width, int def_height);
|
virtual void FindWindowPlacementAndResize(int def_width, int def_height);
|
||||||
|
|
||||||
SmallVector<int, 4> scheduled_invalidation_data; ///< Data of scheduled OnInvalidateData() calls.
|
std::vector<int> scheduled_invalidation_data; ///< Data of scheduled OnInvalidateData() calls.
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Window(WindowDesc *desc);
|
Window(WindowDesc *desc);
|
||||||
|
|
Loading…
Reference in New Issue