Skip to content

Commit

Permalink
Run clang format on these two files
Browse files Browse the repository at this point in the history
  • Loading branch information
JonBooth78 committed Nov 20, 2023
1 parent 4e973c2 commit 3261098
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
14 changes: 6 additions & 8 deletions src/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include "CargoBody.h"
#include "Frame.h"
#include "GameSaveError.h"
#include "JsonUtils.h"
#include "HyperspaceCloud.h"
#include "JsonUtils.h"
#include "Missile.h"
#include "Planet.h"
#include "Player.h"
Expand Down Expand Up @@ -259,22 +259,21 @@ vector3d Body::GetVelocityRelTo(const Body *relTo) const
return GetVelocityRelTo(relTo->m_frame) - relTo->GetVelocityRelTo(relTo->m_frame);
}

double Body::GetAltitudeRelTo(const Body* relTo, AltitudeType altType)
double Body::GetAltitudeRelTo(const Body *relTo, AltitudeType altType)
{
if (!relTo) {
return 0.0;
}
vector3d pos = GetPositionRelTo(relTo);
double center_dist = pos.Length();
if (relTo->IsType(ObjectType::TERRAINBODY)) {
const TerrainBody* terrain = static_cast<const TerrainBody*>(relTo);
const TerrainBody *terrain = static_cast<const TerrainBody *>(relTo);
vector3d surface_pos = pos.Normalized();
double radius;
if (altType != AltitudeType::DEFAULT) {
radius = altType == AltitudeType::SEA_LEVEL ? terrain->GetSystemBody()->GetRadius() :
terrain->GetTerrainHeight(surface_pos);
}
else {
terrain->GetTerrainHeight(surface_pos);
} else {
radius = terrain->GetSystemBody()->GetRadius();
if (center_dist <= 3.0 * terrain->GetMaxFeatureRadius()) {
radius = terrain->GetTerrainHeight(surface_pos);
Expand All @@ -284,8 +283,7 @@ double Body::GetAltitudeRelTo(const Body* relTo, AltitudeType altType)
if (altitude < 0)
altitude = 0;
return altitude;
}
else {
} else {
return center_dist;
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/lua/LuaBody.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,7 @@ static int l_body_get_altitude_rel_to(lua_State *l)
Body *b = LuaObject<Body>::CheckFromLua(1);
const Body *other = LuaObject<Body>::CheckFromLua(2);
AltitudeType altType = AltitudeType::DEFAULT;
if (!lua_isnoneornil(l, 3))
{
if (!lua_isnoneornil(l, 3)) {
bool terrainRelative = lua_toboolean(l, 3);
altType = terrainRelative ? AltitudeType::ABOVE_TERRAIN : AltitudeType::SEA_LEVEL;
}
Expand Down Expand Up @@ -664,7 +663,7 @@ static int l_body_get_ground_position(lua_State *l)
lua_pushnil(l);
return 1;
}
Body* astro = f->GetBody();
Body *astro = f->GetBody();
if (!astro) {
lua_pushnil(l);
return 1;
Expand Down

0 comments on commit 3261098

Please sign in to comment.