From 887f330a36b8ebad137cad93148d8bae2a874f83 Mon Sep 17 00:00:00 2001
From: Allanis <allanis.saracraft.studios@gmail.com>
Date: Sun, 14 Jan 2018 14:11:21 +0000
Subject: [PATCH] [Change] Renaming a few stuff to comply with convention.

---
 src/frame.cpp              | 18 +++++-----
 src/frame.h                |  2 +-
 src/l3d.h                  | 24 ++++++-------
 src/main.cpp               | 74 +++++++++++++++++++-------------------
 src/player.cpp             |  2 +-
 src/sector_view.cpp        |  2 +-
 src/ship.cpp               |  4 +--
 src/space.cpp              | 12 +++----
 src/space_station_view.cpp |  2 +-
 src/star_system.h          |  7 +++-
 src/system_view.cpp        |  2 +-
 11 files changed, 77 insertions(+), 72 deletions(-)

diff --git a/src/frame.cpp b/src/frame.cpp
index bd93003..693a322 100644
--- a/src/frame.cpp
+++ b/src/frame.cpp
@@ -18,15 +18,15 @@ void Frame::RemoveChild(Frame* f) {
 }
 
 void Frame::Init(Frame* parent, const char* label, unsigned int flags) {
-  sBody = 0;
-  m_parent = parent;
-  m_flags = flags;
-  m_radius = 0;
-  m_pos = vector3d(0.0f);
-  m_vel = vector3d(0.0);
-  m_angVel = vector3d(0.0);
-  m_orient = matrix4x4d::Identity();
-  m_dSpaceID = dHashSpaceCreate(0);
+  m_sBody     = 0;
+  m_parent    = parent;
+  m_flags     = flags;
+  m_radius    = 0;
+  m_pos       = vector3d(0.0f);
+  m_vel       = vector3d(0.0);
+  m_angVel    = vector3d(0.0);
+  m_orient    = matrix4x4d::Identity();
+  m_dSpaceID  = dHashSpaceCreate(0);
   if(m_parent) {
     m_parent->m_children.push_back(this);
   }
diff --git a/src/frame.h b/src/frame.h
index 294d285..15f06e1 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -42,7 +42,7 @@ public:
   /* If parent is null then frame position is absolute. */
   Frame* m_parent;
   std::list<Frame*> m_children;
-  StarSystem::SBody* sBody; /* Points to SBodies in L3D::current_system. */
+  StarSystem::SBody* m_sBody; /* Points to SBodies in L3D::current_system. */
 
   enum { TEMP_VIEWING=1 };
 
diff --git a/src/l3d.h b/src/l3d.h
index 6c6ec6d..de4544f 100644
--- a/src/l3d.h
+++ b/src/l3d.h
@@ -68,35 +68,35 @@ public:
   enum MapView { MAP_NOMAP, MAP_SECTOR, MAP_SYSTEM };
   static void SetCamType(enum CamType);
   static void SetMapView(enum MapView);
-  static enum CamType GetCamType(void)  { return cam_type; }
-  static enum MapView GetMapView(void)  { return map_view; }
+  static enum CamType GetCamType(void)  { return camType; }
+  static enum MapView GetMapView(void)  { return mapView; }
   static void SetView(View* v);
-  static View* GetView(void)            { return current_view; }
+  static View* GetView(void)            { return currentView; }
   static StarSystem* GetSelectedSystem(void);
 
   static systemloc_t        playerLoc;
   static Player*            player;
-  static SectorView*        sector_view;
-  static SystemInfoView*    system_info_view;
-  static WorldView*         world_view;
+  static SectorView*        sectorView;
+  static SystemInfoView*    systemInfoView;
+  static WorldView*         worldView;
   static ObjectViewerView*  objectViewerView;
   static SpaceStationView*  spaceStationView;
   static InfoView*          infoView;
   static ShipCpanel*        cpan;
   static GLUquadric*        gluQuadric;
-  static StarSystem*        current_system;
+  static StarSystem*        currentSystem;
 
 private:
   static void InitOpenGL(void);
   static void HandleEvents(void);
 
-  static View* current_view;
-  static SystemView* system_view;
+  static View* currentView;
+  static SystemView* systemView;
 
   static double       gameTime;
-  static StarSystem*  selected_system;
-  static enum CamType cam_type;
-  static enum MapView map_view;
+  static StarSystem*  selectedSystem;
+  static enum CamType camType;
+  static enum MapView mapView;
   static float        timeAccel;
   static float        frameTime;
   static int          scrWidth, scrHeight;
diff --git a/src/main.cpp b/src/main.cpp
index 2de6a10..9d662d8 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -30,20 +30,20 @@ sigc::signal<void, int, int, int> L3D::onMouseButtonDown;
 char              L3D::keyState[SDLK_LAST];
 char              L3D::mouseButton[5];
 int               L3D::mouseMotion[2];
-enum L3D::CamType  L3D::cam_type;
-enum L3D::MapView  L3D::map_view;
+enum L3D::CamType  L3D::camType;
+enum L3D::MapView  L3D::mapView;
 Player*           L3D::player;
-View*             L3D::current_view;
-WorldView*        L3D::world_view;
+View*             L3D::currentView;
+WorldView*        L3D::worldView;
 ObjectViewerView* L3D::objectViewerView;
 SpaceStationView* L3D::spaceStationView;
 InfoView*         L3D::infoView;
-SectorView*       L3D::sector_view;
-SystemView*       L3D::system_view;
-SystemInfoView*   L3D::system_info_view;
+SectorView*       L3D::sectorView;
+SystemView*       L3D::systemView;
+SystemInfoView*   L3D::systemInfoView;
 ShipCpanel*       L3D::cpan;
-StarSystem*       L3D::selected_system;
-StarSystem*       L3D::current_system;
+StarSystem*       L3D::selectedSystem;
+StarSystem*       L3D::currentSystem;
 MTRand            L3D::rng;
 double            L3D::gameTime;
 float             L3D::frameTime;
@@ -125,23 +125,23 @@ void L3D::Quit(void) {
 }
 
 void L3D::SetCamType(enum CamType c) {
-  cam_type = c;
-  map_view = MAP_NOMAP;
-  SetView(world_view);
+  camType = c;
+  mapView = MAP_NOMAP;
+  SetView(worldView);
 }
 
 void L3D::SetMapView(enum MapView v) {
-  map_view = v;
+  mapView = v;
   if(v == MAP_SECTOR)
-    SetView(sector_view);
+    SetView(sectorView);
   else
-    SetView(system_view);
+    SetView(systemView);
 }
 
 void L3D::SetView(View* v) {
-  if(current_view) current_view->HideAll();
-  current_view = v;
-  current_view->ShowAll();
+  if(currentView) currentView->HideAll();
+  currentView = v;
+  currentView->ShowAll();
 }
 
 void L3D::HandleEvents(void) {
@@ -207,7 +207,7 @@ void L3D::MainLoop(void) {
 
   Frame* stationFrame = new Frame(pframe, "Station frame..");
   stationFrame->SetRadius(5000);
-  stationFrame->sBody = 0;
+  stationFrame->m_sBody = 0;
   stationFrame->SetPosition(vector3d(0, 0, zpos));
   stationFrame->SetAngVelocity(vector3d(0,0,0.5));
 
@@ -235,15 +235,15 @@ void L3D::MainLoop(void) {
   cpan = new ShipCpanel();
   cpan->ShowAll();
 
-  sector_view       = new SectorView();
-  system_view       = new SystemView();
-  system_info_view  = new SystemInfoView();
-  world_view        = new WorldView();
+  sectorView        = new SectorView();
+  systemView        = new SystemView();
+  systemInfoView    = new SystemInfoView();
+  worldView         = new WorldView();
   objectViewerView  = new ObjectViewerView();
   spaceStationView  = new SpaceStationView();
   infoView          = new InfoView();
 
-  SetView(world_view);
+  SetView(worldView);
   player->SetDockedWith(station);
 
   Uint32 last_stats = SDL_GetTicks();
@@ -256,7 +256,7 @@ void L3D::MainLoop(void) {
     glMatrixMode(GL_MODELVIEW);
     glLoadIdentity();
 
-    current_view->Draw3D();
+    currentView->Draw3D();
     /*
      * TODO: HandleEvents at the moment must be after view->Draw3D and before
      * Gui::Draw so that labels drawn to screen can have mouse events correctly
@@ -296,7 +296,7 @@ void L3D::MainLoop(void) {
       Space::TimeStep(step);
       gameTime += step;
     }
-    current_view->Update();
+    currentView->Update();
 
     if(SDL_GetTicks() - last_stats > 1000) {
       snprintf(fps_readout, sizeof(fps_readout), "%d fps", frame_stat);
@@ -308,29 +308,29 @@ void L3D::MainLoop(void) {
 
 StarSystem* L3D::GetSelectedSystem(void) {
   int sector_x, sector_y, system_idx;
-  L3D::sector_view->GetSelectedSystem(&sector_x, &sector_y, &system_idx);
+  L3D::sectorView->GetSelectedSystem(&sector_x, &sector_y, &system_idx);
   if(system_idx == -1) {
-    selected_system = 0;
+    selectedSystem = 0;
     return NULL;
   }
-  if(selected_system) {
-    if(!selected_system->IsSystem(sector_x, sector_y, system_idx)) {
-      delete selected_system;
-      selected_system = 0;
+  if(selectedSystem) {
+    if(!selectedSystem->IsSystem(sector_x, sector_y, system_idx)) {
+      delete selectedSystem;
+      selectedSystem = 0;
     }
   }
-  if(!selected_system) {
-    selected_system = new StarSystem(sector_x, sector_y, system_idx);
+  if(!selectedSystem) {
+    selectedSystem = new StarSystem(sector_x, sector_y, system_idx);
   }
-  return selected_system;
+  return selectedSystem;
 }
 
 void L3D::HyperspaceTo(StarSystem* dest) {
   int sec_x, sec_y, sys_idx;
   dest->GetPos(&sec_x, &sec_y, &sys_idx);
 
-  if(current_system) delete current_system;
-  current_system = new StarSystem(sec_x, sec_y, sys_idx);
+  if(currentSystem) delete currentSystem;
+  currentSystem = new StarSystem(sec_x, sec_y, sys_idx);
 
   Space::Clear();
   Space::BuildSystem();
diff --git a/src/player.cpp b/src/player.cpp
index cccfdf8..630d74e 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -179,7 +179,7 @@ void Player::DrawHUD(const Frame* cam_frame) {
                                   &_pos.x, &_pos.y, &_pos.z)) {
         b->SetProjectedPos(_pos);
         b->SetOnscreen(true);
-        if(L3D::world_view->GetShowLabels()) Gui::Screen::RenderLabel(b->GetLabel(), _pos.x, _pos.y);
+        if(L3D::worldView->GetShowLabels()) Gui::Screen::RenderLabel(b->GetLabel(), _pos.x, _pos.y);
       } else
         b->SetOnscreen(false);
     }
diff --git a/src/sector_view.cpp b/src/sector_view.cpp
index ed472a5..47c49ed 100644
--- a/src/sector_view.cpp
+++ b/src/sector_view.cpp
@@ -41,7 +41,7 @@ SectorView::~SectorView(void) {
 }
 
 void SectorView::OnClickSystemInfo(void) {
-  L3D::SetView(L3D::system_info_view);
+  L3D::SetView(L3D::systemInfoView);
 }
 
 bool SectorView::GetSelectedSystem(int* sector_x, int* sector_y, int* system_idx) {
diff --git a/src/ship.cpp b/src/ship.cpp
index cd5226a..b3e942a 100644
--- a/src/ship.cpp
+++ b/src/ship.cpp
@@ -195,12 +195,12 @@ void Ship::SetWheelState(bool down) {
 
 void Ship::SetNavTarget(Body* const target) {
   m_navTarget = target;
-  L3D::world_view->UpdateCommsOptions();
+  L3D::worldView->UpdateCommsOptions();
 }
 
 void Ship::SetCombatTarget(Body* const target) {
   m_combatTarget = target;
-  L3D::world_view->UpdateCommsOptions();
+  L3D::worldView->UpdateCommsOptions();
 }
 
 bool Ship::IsFiringLasers(void) {
diff --git a/src/space.cpp b/src/space.cpp
index fc61156..d6b3244 100644
--- a/src/space.cpp
+++ b/src/space.cpp
@@ -42,10 +42,10 @@ void Space::Clear(void) {
 }
 
 void Space::MoveOrbitingObjectFrames(Frame* f) {
-  if(f->sBody) {
+  if(f->m_sBody) {
     /* Not too efficient. */
-    vector3d pos = f->sBody->orbit.CartesianPosAtTime(L3D::GetGameTime());
-    vector3d pos2 = f->sBody->orbit.CartesianPosAtTime(L3D::GetGameTime()+1.0);
+    vector3d pos = f->m_sBody->orbit.CartesianPosAtTime(L3D::GetGameTime());
+    vector3d pos2 = f->m_sBody->orbit.CartesianPosAtTime(L3D::GetGameTime()+1.0);
     vector3d vel = pos2 - pos;
     f->SetPosition(pos);
     f->SetVelocity(vel);
@@ -74,7 +74,7 @@ static Frame* MakeFrameFor(StarSystem::SBody* sbody, Body* b, Frame* f) {
     case StarSystem::SUPERTYPE_GAS_GIANT:
     case StarSystem::SUPERTYPE_ROCKY_PLANET:
       orbFrame = new Frame(f, sbody->name.c_str());
-      orbFrame->sBody = sbody;
+      orbFrame->m_sBody = sbody;
       orbFrame->SetRadius(10*sbody->GetRadius());
 
       assert(sbody->GetRotationPeriod() != 0);
@@ -87,7 +87,7 @@ static Frame* MakeFrameFor(StarSystem::SBody* sbody, Body* b, Frame* f) {
     case StarSystem::SUPERTYPE_STAR:
     default:
       orbFrame = new Frame(f, sbody->name.c_str());
-      orbFrame->sBody = sbody;
+      orbFrame->m_sBody = sbody;
       orbFrame->SetRadius(1.2*sbody->GetRadius());
       b->SetFrame(orbFrame);
       return orbFrame;
@@ -121,7 +121,7 @@ just_make_child:
 }
 
 void Space::BuildSystem(void) {
-  GenBody(L3D::current_system->rootBody, rootFrame);
+  GenBody(L3D::currentSystem->rootBody, rootFrame);
   MoveOrbitingObjectFrames(rootFrame);
 }
 
diff --git a/src/space_station_view.cpp b/src/space_station_view.cpp
index 57b7586..1070039 100644
--- a/src/space_station_view.cpp
+++ b/src/space_station_view.cpp
@@ -33,7 +33,7 @@ SpaceStationView::SpaceStationView(void) : View() {
 
 void SpaceStationView::OnClickRequestLaunch(void) {
   L3D::player->SetDockedWith(0);
-  L3D::SetView(L3D::world_view);
+  L3D::SetView(L3D::worldView);
 }
 
 void SpaceStationView::Draw3D(void) {
diff --git a/src/star_system.h b/src/star_system.h
index 206fe6f..0a0e19f 100644
--- a/src/star_system.h
+++ b/src/star_system.h
@@ -78,7 +78,9 @@ public:
 
   };
 
-  struct SBody {
+  class SBody {
+  public:
+    friend class StarSystem;
     ~SBody(void);
     void EliminateBadChildren(void); /* :D */
     void PickPlanetType(SBody*, fixed distToPrimary, MTRand& drand, bool genMoons);
@@ -117,6 +119,9 @@ public:
 
     BodySuperType supertype;
     BodyType type;
+
+  private:
+
   };
 
   SBody* rootBody;
diff --git a/src/system_view.cpp b/src/system_view.cpp
index df59038..04e3787 100644
--- a/src/system_view.cpp
+++ b/src/system_view.cpp
@@ -166,7 +166,7 @@ void SystemView::Draw3D(void) {
   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
   int sector_x, sector_y, system_idx;
-  L3D::sector_view->GetSelectedSystem(&sector_x, &sector_y, &system_idx);
+  L3D::sectorView->GetSelectedSystem(&sector_x, &sector_y, &system_idx);
   if(m_system) {
     if(!m_system->IsSystem(sector_x, sector_y, system_idx)) {
       delete m_system;