summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorHenry Wilson <m3henry@googlemail.com>2018-09-20 22:41:43 +0100
committerPeterN <peter@fuzzle.org>2019-03-26 20:15:57 +0000
commit4b349c0f90c3f7b6a39171cec41cd98dcd0d88b7 (patch)
treecc3ae4e4a7a4defd8a672ae9dd3983bd02b654f4 /src/script
parent7a32cf1401d289f04682aa91fbfb779cbb2378e4 (diff)
downloadopenttd-4b349c0f90c3f7b6a39171cec41cd98dcd0d88b7.tar.xz
Codechange: [core] Implement SmallVector using std::vector
The public and protected interface to SmallVector are unchanged SmallVector now requires that items be default constructible This isn't an issue since some contained items were previously created uninitialized. Temporary default constructors are added to the following structs - SmallPair - SmallStackItem - GRFPresence Where vector<bool> is required, transition immediately to std::vector to avoid returning proxy object references.
Diffstat (limited to 'src/script')
-rw-r--r--src/script/squirrel_helper.hpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/script/squirrel_helper.hpp b/src/script/squirrel_helper.hpp
index 22d738d4f..002c56106 100644
--- a/src/script/squirrel_helper.hpp
+++ b/src/script/squirrel_helper.hpp
@@ -32,7 +32,7 @@ namespace SQConvert {
struct SQAutoFreePointers : SmallVector<void *, 1> {
~SQAutoFreePointers()
{
- for (uint i = 0; i < this->items; i++) free(this->data[i]);
+ for (uint i = 0; i < std::vector<void *>::size(); i++) free(std::vector<void *>::operator[](i));
}
};