summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Items/ItemEmptyMap.h6
-rw-r--r--src/Map.cpp14
-rw-r--r--src/WorldStorage/MapSerializer.cpp4
3 files changed, 12 insertions, 12 deletions
diff --git a/src/Items/ItemEmptyMap.h b/src/Items/ItemEmptyMap.h
index db28511f3..6618bfce2 100644
--- a/src/Items/ItemEmptyMap.h
+++ b/src/Items/ItemEmptyMap.h
@@ -36,10 +36,10 @@ public:
// The map center is fixed at the central point of the 8x8 block of chunks you are standing in when you right-click it.
- const int RegionWidth = cChunkDef::Width * 8 * pow(2, DEFAULT_SCALE);
+ const int RegionWidth = cChunkDef::Width * 8 * pow(2.0, (double) DEFAULT_SCALE);
- int CenterX = round(a_Player->GetPosX() / (float) RegionWidth) * RegionWidth;
- int CenterZ = round(a_Player->GetPosZ() / (float) RegionWidth) * RegionWidth;
+ int CenterX = floor(a_Player->GetPosX() / (float) RegionWidth) * RegionWidth;
+ int CenterZ = floor(a_Player->GetPosZ() / (float) RegionWidth) * RegionWidth;
cMap * NewMap = a_World->GetMapManager().CreateMap(CenterX, CenterZ, DEFAULT_SCALE);
diff --git a/src/Map.cpp b/src/Map.cpp
index 2b8c4c74c..337c9cd31 100644
--- a/src/Map.cpp
+++ b/src/Map.cpp
@@ -51,8 +51,8 @@ void cMapDecorator::Update(void)
int InsideWidth = (m_Map->GetWidth() / 2) - 1;
int InsideHeight = (m_Map->GetHeight() / 2) - 1;
- int PixelX = (m_Player->GetPosX() - m_Map->GetCenterX()) / PixelWidth;
- int PixelZ = (m_Player->GetPosZ() - m_Map->GetCenterZ()) / PixelWidth;
+ int PixelX = (int) (m_Player->GetPosX() - m_Map->GetCenterX()) / PixelWidth;
+ int PixelZ = (int) (m_Player->GetPosZ() - m_Map->GetCenterZ()) / PixelWidth;
// Center of pixel
m_PixelX = (2 * PixelX) + 1;
@@ -69,11 +69,11 @@ void cMapDecorator::Update(void)
Int64 WorldAge = m_Player->GetWorld()->GetWorldAge();
// TODO 2014-02-19 xdot: Refine
- m_Rot = Random.NextInt(16, WorldAge);
+ m_Rot = Random.NextInt(16, (int) WorldAge);
}
else
{
- m_Rot = (Yaw * 16) / 360;
+ m_Rot = (int) (Yaw * 16) / 360;
}
m_Type = E_TYPE_PLAYER;
@@ -183,8 +183,8 @@ void cMap::UpdateRadius(cPlayer & a_Player, unsigned int a_Radius)
{
unsigned int PixelWidth = GetPixelWidth();
- int PixelX = (a_Player.GetPosX() - m_CenterX) / PixelWidth + (m_Width / 2);
- int PixelZ = (a_Player.GetPosZ() - m_CenterZ) / PixelWidth + (m_Height / 2);
+ int PixelX = (int) (a_Player.GetPosX() - m_CenterX) / PixelWidth + (m_Width / 2);
+ int PixelZ = (int) (a_Player.GetPosZ() - m_CenterZ) / PixelWidth + (m_Height / 2);
UpdateRadius(PixelX, PixelZ, a_Radius);
}
@@ -620,7 +620,7 @@ unsigned int cMap::GetNumDecorators(void) const
unsigned int cMap::GetPixelWidth(void) const
{
- return pow(2, m_Scale);
+ return (int) pow(2.0, (double) m_Scale);
}
diff --git a/src/WorldStorage/MapSerializer.cpp b/src/WorldStorage/MapSerializer.cpp
index 0bbe71a60..a4a0aab57 100644
--- a/src/WorldStorage/MapSerializer.cpp
+++ b/src/WorldStorage/MapSerializer.cpp
@@ -112,7 +112,7 @@ void cMapSerializer::SaveMapToNBT(cFastNBTWriter & a_Writer)
a_Writer.AddInt("zCenter", m_Map->GetCenterZ());
const cMap::cColorList & Data = m_Map->GetData();
- a_Writer.AddByteArray("colors", (char *) Data.data(), Data.size());
+ a_Writer.AddByteArray("colors", (char *) &Data[0], Data.size());
a_Writer.EndCompound();
}
@@ -178,7 +178,7 @@ bool cMapSerializer::LoadMapFromNBT(const cParsedNBT & a_NBT)
CurrLine = a_NBT.FindChildByName(Data, "colors");
if ((CurrLine >= 0) && (a_NBT.GetType(CurrLine) == TAG_ByteArray))
{
- memcpy(m_Map->m_Data.data(), a_NBT.GetData(CurrLine), NumPixels);
+ memcpy(&m_Map->m_Data[0], a_NBT.GetData(CurrLine), NumPixels);
}
return true;