From ed7816419d2b1d2ddd3a371efb4276ca67dfb4d8 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 29 Jan 2014 19:19:14 +0000 Subject: Fixed redstone simulator crash found in #570 --- src/ChunkDef.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/ChunkDef.h') diff --git a/src/ChunkDef.h b/src/ChunkDef.h index d1288994c..13933e6f1 100644 --- a/src/ChunkDef.h +++ b/src/ChunkDef.h @@ -499,13 +499,14 @@ public: /// Generic template that can store any kind of data together with a triplet of 3 coords: -template class cCoordWithData +template class cCoordWithData { public: int x; int y; int z; X Data; + Y SecondData; cCoordWithData(int a_X, int a_Y, int a_Z) : x(a_X), y(a_Y), z(a_Z) @@ -516,14 +517,19 @@ public: x(a_X), y(a_Y), z(a_Z), Data(a_Data) { } + + cCoordWithData(int a_X, int a_Y, int a_Z, const X & a_Data, const Y & a_SecondData) : + x(a_X), y(a_Y), z(a_Z), Data(a_Data), SecondData(a_SecondData) + { + } } ; -// Illegal in C++03: typedef std::list< cCoordWithData > cCoordWithDataList; -typedef cCoordWithData cCoordWithInt; -typedef cCoordWithData cCoordWithBlock; +typedef cCoordWithData cCoordWithInt; +typedef cCoordWithData cCoordWithBlockAndBool; + typedef std::list cCoordWithIntList; typedef std::vector cCoordWithIntVector; -typedef std::vector cCoordWithBlockVector; +typedef std::vector cCoordWithBlockAndBoolVector; -- cgit v1.2.3 From b0784d1931b4a6771321a0c3b33af537200bf084 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sat, 1 Feb 2014 21:40:02 +0000 Subject: Split cCoord template into one and two data types --- src/ChunkDef.h | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) (limited to 'src/ChunkDef.h') diff --git a/src/ChunkDef.h b/src/ChunkDef.h index 13933e6f1..2c50755cf 100644 --- a/src/ChunkDef.h +++ b/src/ChunkDef.h @@ -498,15 +498,14 @@ public: -/// Generic template that can store any kind of data together with a triplet of 3 coords: -template class cCoordWithData +/** Generic template that can store any kind of data together with a triplet of 3 coords*/ +template class cCoordWithData { public: int x; int y; int z; X Data; - Y SecondData; cCoordWithData(int a_X, int a_Y, int a_Z) : x(a_X), y(a_Y), z(a_Z) @@ -517,18 +516,41 @@ public: x(a_X), y(a_Y), z(a_Z), Data(a_Data) { } - - cCoordWithData(int a_X, int a_Y, int a_Z, const X & a_Data, const Y & a_SecondData) : - x(a_X), y(a_Y), z(a_Z), Data(a_Data), SecondData(a_SecondData) - { - } } ; -typedef cCoordWithData cCoordWithInt; -typedef cCoordWithData cCoordWithBlockAndBool; +typedef cCoordWithData cCoordWithInt; +typedef cCoordWithData cCoordWithBlock; typedef std::list cCoordWithIntList; typedef std::vector cCoordWithIntVector; + + + + + +/** Generic template that can store two types of any kind of data together with a triplet of 3 coords */ +template class cCoordWithDoubleData +{ +public: + int x; + int y; + int z; + X Data; + Z DataTwo; + + cCoordWithDoubleData(int a_X, int a_Y, int a_Z) : + x(a_X), y(a_Y), z(a_Z) + { + } + + cCoordWithDoubleData(int a_X, int a_Y, int a_Z, const X & a_Data, const Z & a_DataTwo) : + x(a_X), y(a_Y), z(a_Z), Data(a_Data), DataTwo(a_DataTwo) + { + } +}; + +typedef cCoordWithDoubleData cCoordWithBlockAndBool; + typedef std::vector cCoordWithBlockAndBoolVector; -- cgit v1.2.3