summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/bitary.cc
diff options
context:
space:
mode:
authorPete Hurst <pete@streamuniverse.tv>2013-05-15 06:08:15 +0100
committerPete Hurst <pete@streamuniverse.tv>2013-05-19 23:01:04 +0100
commitb4d6f14cf200970d981b78a384e918c01c1a0167 (patch)
treeb61a9c57f63a086e819158f3662bd99b7b9af7ac /crawl-ref/source/bitary.cc
parent6484a40017ffa9e33a22607e40e9baa42042543d (diff)
downloadcrawl-ref-b4d6f14cf200970d981b78a384e918c01c1a0167.tar.gz
crawl-ref-b4d6f14cf200970d981b78a384e918c01c1a0167.zip
Add a copy constructor to bit_vector (xFleury)
This caused an error with clouds and LOS due to an implicit copy having undefined behaviour and not working properly in MSVC.
Diffstat (limited to 'crawl-ref/source/bitary.cc')
-rw-r--r--crawl-ref/source/bitary.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/crawl-ref/source/bitary.cc b/crawl-ref/source/bitary.cc
index 69965008bc..2d4d3f818b 100644
--- a/crawl-ref/source/bitary.cc
+++ b/crawl-ref/source/bitary.cc
@@ -15,6 +15,14 @@ bit_vector::bit_vector(unsigned long s)
reset();
}
+bit_vector::bit_vector(const bit_vector& other) : size(other.size)
+{
+ nwords = static_cast<int>((size + LONGSIZE - 1) / LONGSIZE);
+ data = new unsigned long[nwords];
+ for (int w = 0; w < nwords; ++w)
+ data[w] = other.data[w];
+}
+
bit_vector::~bit_vector()
{
delete[] data;