From f183dbba5e5df5ad7e252279303025e783b4cf54 Mon Sep 17 00:00:00 2001 From: Sverre Rabbelier Date: Fri, 18 Apr 2008 00:52:20 +0200 Subject: [PATCH] Fix the silly values in the db by working around negative values. --- src/DB/Savables/Exit.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/DB/Savables/Exit.cpp b/src/DB/Savables/Exit.cpp index 6b9fadc..739bfa6 100644 --- a/src/DB/Savables/Exit.cpp +++ b/src/DB/Savables/Exit.cpp @@ -48,9 +48,12 @@ value_type Exit::getToChunk() const Coordinate Exit::getDirection() const { - int x = m_exit->getValue(db::TableImpls::Get()->EXITS->X)->getIntegerValue(); - int y = m_exit->getValue(db::TableImpls::Get()->EXITS->Y)->getIntegerValue(); - int z = m_exit->getValue(db::TableImpls::Get()->EXITS->Z)->getIntegerValue(); + /* + * The -1 is to correct from the +1 from below + */ + int x = m_exit->getValue(db::TableImpls::Get()->EXITS->X)->getIntegerValue()-1; + int y = m_exit->getValue(db::TableImpls::Get()->EXITS->Y)->getIntegerValue()-1; + int z = m_exit->getValue(db::TableImpls::Get()->EXITS->Z)->getIntegerValue()-1; Coordinate result(x, y, z); return result; @@ -76,14 +79,17 @@ void Exit::setDirection(const Coordinate& direction) Lock(); ValuePtr value; - - value = FieldValuePtr(new FieldValue(db::TableImpls::Get()->EXITS->X, direction.getXCoordinate())); + + /* + * The +1 is to keep negative values from going into the database. + */ + value = FieldValuePtr(new FieldValue(db::TableImpls::Get()->EXITS->X, direction.getXCoordinate()+1)); m_exit->setValue(value); - value = FieldValuePtr(new FieldValue(db::TableImpls::Get()->EXITS->Y, direction.getYCoordinate())); + value = FieldValuePtr(new FieldValue(db::TableImpls::Get()->EXITS->Y, direction.getYCoordinate()+1)); m_exit->setValue(value); - value = FieldValuePtr(new FieldValue(db::TableImpls::Get()->EXITS->Z, direction.getZCoordinate())); + value = FieldValuePtr(new FieldValue(db::TableImpls::Get()->EXITS->Z, direction.getZCoordinate()+1)); m_exit->setValue(value); } -- 2.11.4.GIT