1
0

Merge pull request #999 from mc-server/fixes

A few warning fixes
This commit is contained in:
Mattes D 2014-05-12 08:51:07 +02:00
commit 702643d7e6
6 changed files with 80 additions and 54 deletions

View File

@ -2123,7 +2123,7 @@ void cBlockArea::MergeByStrategy(const cBlockArea & a_Src, int a_RelX, int a_Rel
a_Src.GetSizeX(), a_Src.GetSizeY(), a_Src.GetSizeZ(),
m_Size.x, m_Size.y, m_Size.z
);
break;
return;
} // case msOverwrite
case cBlockArea::msFillAir:
@ -2137,7 +2137,7 @@ void cBlockArea::MergeByStrategy(const cBlockArea & a_Src, int a_RelX, int a_Rel
a_Src.GetSizeX(), a_Src.GetSizeY(), a_Src.GetSizeZ(),
m_Size.x, m_Size.y, m_Size.z
);
break;
return;
} // case msFillAir
case cBlockArea::msImprint:
@ -2151,7 +2151,7 @@ void cBlockArea::MergeByStrategy(const cBlockArea & a_Src, int a_RelX, int a_Rel
a_Src.GetSizeX(), a_Src.GetSizeY(), a_Src.GetSizeZ(),
m_Size.x, m_Size.y, m_Size.z
);
break;
return;
} // case msImprint
case cBlockArea::msLake:
@ -2165,7 +2165,7 @@ void cBlockArea::MergeByStrategy(const cBlockArea & a_Src, int a_RelX, int a_Rel
a_Src.GetSizeX(), a_Src.GetSizeY(), a_Src.GetSizeZ(),
m_Size.x, m_Size.y, m_Size.z
);
break;
return;
} // case msLake
case cBlockArea::msSpongePrint:
@ -2179,7 +2179,7 @@ void cBlockArea::MergeByStrategy(const cBlockArea & a_Src, int a_RelX, int a_Rel
a_Src.GetSizeX(), a_Src.GetSizeY(), a_Src.GetSizeZ(),
m_Size.x, m_Size.y, m_Size.z
);
break;
return;
} // case msSpongePrint
case cBlockArea::msDifference:
@ -2193,7 +2193,7 @@ void cBlockArea::MergeByStrategy(const cBlockArea & a_Src, int a_RelX, int a_Rel
a_Src.GetSizeX(), a_Src.GetSizeY(), a_Src.GetSizeZ(),
m_Size.x, m_Size.y, m_Size.z
);
break;
return;
} // case msDifference
case cBlockArea::msMask:
@ -2207,16 +2207,13 @@ void cBlockArea::MergeByStrategy(const cBlockArea & a_Src, int a_RelX, int a_Rel
a_Src.GetSizeX(), a_Src.GetSizeY(), a_Src.GetSizeZ(),
m_Size.x, m_Size.y, m_Size.z
);
break;
return;
} // case msMask
default:
{
LOGWARNING("Unknown block area merge strategy: %d", a_Strategy);
ASSERT(!"Unknown block area merge strategy");
break;
}
} // switch (a_Strategy)
LOGWARNING("Unknown block area merge strategy: %d", a_Strategy);
ASSERT(!"Unknown block area merge strategy");
return;
}

View File

@ -596,24 +596,22 @@ void cStructGenDirectOverhangs::GenFinish(cChunkDesc & a_ChunkDesc)
// Interpolate between FloorLo and FloorHi:
for (int z = 0; z < 16; z++) for (int x = 0; x < 16; x++)
{
switch (a_ChunkDesc.GetBiome(x, z))
EMCSBiome biome = a_ChunkDesc.GetBiome(x, z);
if ((biome == biExtremeHills) || (biome == biExtremeHillsEdge))
{
case biExtremeHills:
case biExtremeHillsEdge:
int Lo = FloorLo[x + 17 * z] / 256;
int Hi = FloorHi[x + 17 * z] / 256;
for (int y = 0; y < SEGMENT_HEIGHT; y++)
{
int Lo = FloorLo[x + 17 * z] / 256;
int Hi = FloorHi[x + 17 * z] / 256;
for (int y = 0; y < SEGMENT_HEIGHT; y++)
int Val = Lo + (Hi - Lo) * y / SEGMENT_HEIGHT;
if (Val < 0)
{
int Val = Lo + (Hi - Lo) * y / SEGMENT_HEIGHT;
if (Val < 0)
{
a_ChunkDesc.SetBlockType(x, y + Segment, z, E_BLOCK_AIR);
}
} // for y
break;
}
} // switch (biome)
a_ChunkDesc.SetBlockType(x, y + Segment, z, E_BLOCK_AIR);
}
} // for y
break;
} // if (biome)
} // for z, x
// Swap the floors:

View File

@ -174,7 +174,7 @@ void GetTreeImageByBiome(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_No
{
GetBirchTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
}
break;
return;
}
case biTaiga:
@ -184,14 +184,14 @@ void GetTreeImageByBiome(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_No
{
// Conifers
GetConiferTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
break;
return;
}
case biSwampland:
{
// Swamp trees:
GetSwampTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
break;
return;
}
case biJungle:
@ -207,21 +207,21 @@ void GetTreeImageByBiome(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_No
{
GetJungleTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
}
break;
return;
}
case biBirchForest:
case biBirchForestHills:
{
GetBirchTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
break;
return;
}
case biBirchForestM:
case biBirchForestHillsM:
{
GetTallBirchTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
break;
return;
}
case biRoofedForest:
@ -257,9 +257,29 @@ void GetTreeImageByBiome(int a_BlockX, int a_BlockY, int a_BlockZ, cNoise & a_No
{
// TODO: These need their special trees
GetBirchTreeImage(a_BlockX, a_BlockY, a_BlockZ, a_Noise, a_Seq, a_LogBlocks, a_OtherBlocks);
break;
return;
}
case biDesert:
case biDesertHills:
case biRiver:
case biBeach:
case biHell:
case biSky:
case biOcean:
case biFrozenOcean:
case biFrozenRiver:
case biVariant:
case biNumBiomes:
case biNumVariantBiomes:
case biInvalidBiome:
{
// These biomes have no trees, or are non-biome members of the enum.
return;
}
}
ASSERT(!"Invalid biome type!");
}

View File

@ -355,6 +355,8 @@ void cMonster::Tick(float a_Dt, cChunk & a_Chunk)
InStateEscaping(a_Dt);
break;
}
case ATTACKING: break;
} // switch (m_EMState)
BroadcastMovementUpdate();

View File

@ -391,38 +391,41 @@ void cNBTChunkSerializer::AddFallingBlockEntity(cFallingBlock * a_FallingBlock)
void cNBTChunkSerializer::AddMinecartEntity(cMinecart * a_Minecart)
{
const char * EntityClass = NULL;
switch (a_Minecart->GetPayload())
{
case cMinecart::mpNone: EntityClass = "MinecartRideable"; break;
case cMinecart::mpChest: EntityClass = "MinecartChest"; break;
case cMinecart::mpFurnace: EntityClass = "MinecartFurnace"; break;
case cMinecart::mpTNT: EntityClass = "MinecartTNT"; break;
case cMinecart::mpHopper: EntityClass = "MinecartHopper"; break;
default:
{
ASSERT(!"Unhandled minecart payload type");
return;
}
} // switch (payload)
m_Writer.BeginCompound("");
AddBasicEntity(a_Minecart, EntityClass);
switch (a_Minecart->GetPayload())
{
case cMinecart::mpChest:
{
AddBasicEntity(a_Minecart, "MinecartChest");
// Add chest contents into the Items tag:
AddMinecartChestContents((cMinecartWithChest *)a_Minecart);
break;
}
case cMinecart::mpFurnace:
{
AddBasicEntity(a_Minecart, "MinecartFurnace");
// TODO: Add "Push" and "Fuel" tags
break;
}
case cMinecart::mpHopper:
{
AddBasicEntity(a_Minecart, "MinecartHopper");
// TODO: Add hopper contents?
break;
}
case cMinecart::mpTNT:
{
AddBasicEntity(a_Minecart, "MinecartTNT");
break;
}
case cMinecart::mpNone:
{
AddBasicEntity(a_Minecart, "MinecartRideable");
break;
}
} // switch (Payload)
m_Writer.EndCompound();
}
@ -650,6 +653,13 @@ void cNBTChunkSerializer::AddHangingEntity(cHangingEntity * a_Hanging)
case BLOCK_FACE_YP: m_Writer.AddByte("Dir", (unsigned char)1); break;
case BLOCK_FACE_ZM: m_Writer.AddByte("Dir", (unsigned char)0); break;
case BLOCK_FACE_ZP: m_Writer.AddByte("Dir", (unsigned char)3); break;
case BLOCK_FACE_XM:
case BLOCK_FACE_XP:
case BLOCK_FACE_NONE:
{
break;
}
}
}

View File

@ -243,7 +243,6 @@ void cWorldStorage::Execute(void)
bool Success;
do
{
Success = false;
if (m_ShouldTerminate)
{
return;