Skip to content

Commit

Permalink
arbitrary gravity code cleanup
Browse files Browse the repository at this point in the history
Was working on modernizing the code in my mod, copied all the changes here too
  • Loading branch information
jacob1 committed Aug 5, 2019
1 parent ee2a765 commit e280fea
Show file tree
Hide file tree
Showing 6 changed files with 345 additions and 374 deletions.
8 changes: 4 additions & 4 deletions src/gui/game/GameModel.cpp
Expand Up @@ -174,7 +174,7 @@ GameModel::~GameModel()
Client::Ref().SetPref("Renderer.DebugMode", ren->debugLines); //These two should always be equivalent, even though they are different things

Client::Ref().SetPref("Simulation.EdgeMode", edgeMode);
Client::Ref().SetPref("Simulation.NewtonianGravity", sim->grav->ngrav_enable);
Client::Ref().SetPref("Simulation.NewtonianGravity", sim->grav->IsEnabled());
Client::Ref().SetPref("Simulation.AmbientHeat", sim->aheat_enable);
Client::Ref().SetPref("Simulation.PrettyPowder", sim->pretty_powder);

Expand Down Expand Up @@ -719,11 +719,11 @@ void GameModel::SetSaveFile(SaveFile * newSave, bool invertIncludePressure)
sim->legacy_enable = saveData->legacyEnable;
sim->water_equal_test = saveData->waterEEnabled;
sim->aheat_enable = saveData->aheatEnable;
if(saveData->gravityEnable && !sim->grav->ngrav_enable)
if(saveData->gravityEnable && !sim->grav->IsEnabled())
{
sim->grav->start_grav_async();
}
else if(!saveData->gravityEnable && sim->grav->ngrav_enable)
else if(!saveData->gravityEnable && sim->grav->IsEnabled())
{
sim->grav->stop_grav_async();
}
Expand Down Expand Up @@ -995,7 +995,7 @@ void GameModel::SetNewtonianGravity(bool newtonainGravity)

bool GameModel::GetNewtonianGrvity()
{
return sim->grav->ngrav_enable;
return sim->grav->IsEnabled();
}

void GameModel::ShowGravityGrid(bool showGrid)
Expand Down
2 changes: 1 addition & 1 deletion src/gui/options/OptionsModel.cpp
Expand Up @@ -46,7 +46,7 @@ void OptionsModel::SetAmbientHeatSimulation(bool state)

bool OptionsModel::GetNewtonianGravity()
{
return sim->grav->ngrav_enable?true:false;
return sim->grav->IsEnabled();
}

void OptionsModel::SetNewtonianGravity(bool state)
Expand Down
2 changes: 1 addition & 1 deletion src/lua/LegacyLuaAPI.cpp
Expand Up @@ -1226,7 +1226,7 @@ int luatpt_gravity(lua_State* l)
int acount = lua_gettop(l);
if (acount == 0)
{
lua_pushinteger(l, luacon_sim->grav->ngrav_enable);
lua_pushinteger(l, luacon_sim->grav->IsEnabled() ? 1 : 0);
return 1;
}
int gravstate = luaL_checkint(l, 1);
Expand Down

0 comments on commit e280fea

Please sign in to comment.