diff options
author | skidd13 <skidd13@openttd.org> | 2008-06-19 10:19:02 +0000 |
---|---|---|
committer | skidd13 <skidd13@openttd.org> | 2008-06-19 10:19:02 +0000 |
commit | 2f65d35ead535a16e418f9dbf64468c7141519d8 (patch) | |
tree | 60ef81ba2a70923661577658f6b89c7e0df8ef16 /src | |
parent | c4cc5cdf3b2f8f349c723de98538adec45db9c55 (diff) | |
download | openttd-2f65d35ead535a16e418f9dbf64468c7141519d8.tar.xz |
(svn r13575) -Codechange: Move small vector to core since it fits better in there
-Codechange: convert smallvector from struct to class
Diffstat (limited to 'src')
-rw-r--r-- | src/core/smallvec_type.hpp (renamed from src/misc/smallvec.h) | 16 | ||||
-rw-r--r-- | src/fios.h | 2 | ||||
-rw-r--r-- | src/sortlist_type.h | 2 | ||||
-rw-r--r-- | src/vehiclelist.h | 2 | ||||
-rw-r--r-- | src/viewport.cpp | 2 |
5 files changed, 13 insertions, 11 deletions
diff --git a/src/misc/smallvec.h b/src/core/smallvec_type.hpp index 477a93178..ce41af9fd 100644 --- a/src/misc/smallvec.h +++ b/src/core/smallvec_type.hpp @@ -1,12 +1,12 @@ /* $Id$ */ -/** @file smallvec.h Simple vector class that allows allocating an item without the need to copy this->data needlessly. */ +/** @file smallvec_type.hpp Simple vector class that allows allocating an item without the need to copy this->data needlessly. */ -#ifndef SMALLVEC_H -#define SMALLVEC_H +#ifndef SMALLVEC_TYPE_HPP +#define SMALLVEC_TYPE_HPP -#include "../core/alloc_func.hpp" -#include "../core/math_func.hpp" +#include "alloc_func.hpp" +#include "math_func.hpp" /** * Simple vector template class. @@ -19,11 +19,13 @@ * @param S The steps of allocation */ template <typename T, uint S> -struct SmallVector { +class SmallVector { +protected: T *data; ///< The pointer to the first item uint items; ///< The number of items stored uint capacity; ///< The avalible space for storing items +public: SmallVector() : data(NULL), items(0), capacity(0) { } ~SmallVector() @@ -160,4 +162,4 @@ struct SmallVector { } }; -#endif /* SMALLVEC_H */ +#endif /* SMALLVEC_TYPE_HPP */ diff --git a/src/fios.h b/src/fios.h index 7e7e80975..6a46987b3 100644 --- a/src/fios.h +++ b/src/fios.h @@ -6,7 +6,7 @@ #define FIOS_H #include "strings_type.h" -#include "misc/smallvec.h" +#include "core/smallvec_type.hpp" enum { /** diff --git a/src/sortlist_type.h b/src/sortlist_type.h index 371de1a9c..9c0f6638e 100644 --- a/src/sortlist_type.h +++ b/src/sortlist_type.h @@ -9,7 +9,7 @@ #include "core/bitmath_func.hpp" #include "core/mem_func.hpp" #include "core/sort_func.hpp" -#include "misc/smallvec.h" +#include "core/smallvec_type.hpp" #include "date_type.h" enum SortListFlags { diff --git a/src/vehiclelist.h b/src/vehiclelist.h index 93a643e5a..a5ba00f8b 100644 --- a/src/vehiclelist.h +++ b/src/vehiclelist.h @@ -5,7 +5,7 @@ #ifndef VEHICLELIST_H #define VEHICLELIST_H -#include "misc/smallvec.h" +#include "core/smallvec_type.hpp" typedef SmallVector<const Vehicle *, 32> VehicleList; diff --git a/src/viewport.cpp b/src/viewport.cpp index 7b0cfb107..c63375155 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -44,7 +44,7 @@ #include "settings_type.h" #include "station_func.h" #include "core/alloc_type.hpp" -#include "misc/smallvec.h" +#include "core/smallvec_type.hpp" #include "window_func.h" #include "tilehighlight_func.h" #include "window_gui.h" |