Skip to content

Commit 7e43270

Browse files
committed
attempt to make exposure value to display rounded
1 parent e203600 commit 7e43270

File tree

8 files changed

+18
-18
lines changed

8 files changed

+18
-18
lines changed

src/celengine/simulation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ double Simulation::getTimeScale() const
495495
return pauseState?storedTimeScale:timeScale;
496496
}
497497

498-
void Simulation::setTimeScale(double _timeScale)
498+
void Simulation::setTimeScale(float _timeScale)
499499
{
500500
if (pauseState)
501501
{

src/celengine/simulation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class Simulation
110110
SolarSystem* getNearestSolarSystem() const;
111111

112112
double getTimeScale() const;
113-
void setTimeScale(double);
113+
void setTimeScale(float);
114114
bool getSyncTime() const;
115115
void setSyncTime(bool);
116116
void synchronizeTime();

src/celestia/celestiacore.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,7 @@ void CelestiaCore::charEntered(const char *c_p, int modifiers)
13891389
break;
13901390

13911391
case 'R':
1392-
if (c == 'r') // Skip rangechecking as setResolution does it already
1392+
if (c == 'r') // Skip range checking as setResolution does it already
13931393
renderer->setResolution(renderer->getResolution() - 1);
13941394
else
13951395
renderer->setResolution(renderer->getResolution() + 1);
@@ -1405,7 +1405,7 @@ void CelestiaCore::charEntered(const char *c_p, int modifiers)
14051405
flash(_("High res textures"));
14061406
break;
14071407
}
1408-
notifyWatchers(RenderFlagsChanged); //how to synchronize with menu?
1408+
notifyWatchers(RenderFlagsChanged); // how to synchronize with menu?
14091409
break;
14101410

14111411
case 'Q':
@@ -1468,16 +1468,16 @@ void CelestiaCore::charEntered(const char *c_p, int modifiers)
14681468

14691469
case '[':
14701470
{
1471-
setExposure(sim->getExposure() * 0.5);
1472-
auto buf = fmt::format(loc, _("Exposure time: {:.2f}"), sim->getExposure());
1471+
setExposure(sim->getExposure() * 0.5f);
1472+
auto buf = fmt::format(loc, _("Exposure time: {:.6g}"), sim->getExposure());
14731473
flash(buf);
14741474
}
14751475
break;
14761476

14771477
case ']':
14781478
{
1479-
setExposure(sim->getExposure() * 2.0);
1480-
auto buf = fmt::format(loc, _("Exposure time: {:.2f}"), sim->getExposure());
1479+
setExposure(sim->getExposure() * 2.0f);
1480+
auto buf = fmt::format(loc, _("Exposure time: {:.6g}"), sim->getExposure());
14811481
flash(buf);
14821482
}
14831483
break;

src/celestia/qt/qttimetoolbar.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,31 +89,31 @@ TimeToolBar::slotReverseTime()
8989
void
9090
TimeToolBar::slotRealTime()
9191
{
92-
appCore->getSimulation()->setTimeScale(1.0);
92+
appCore->getSimulation()->setTimeScale(1.0f);
9393
}
9494

9595
void
9696
TimeToolBar::slotDoubleTime()
9797
{
98-
appCore->getSimulation()->setTimeScale(2.0 * appCore->getSimulation()->getTimeScale());
98+
appCore->getSimulation()->setTimeScale(2.0f * appCore->getSimulation()->getTimeScale());
9999
}
100100

101101
void
102102
TimeToolBar::slotHalfTime()
103103
{
104-
appCore->getSimulation()->setTimeScale(0.5 * appCore->getSimulation()->getTimeScale());
104+
appCore->getSimulation()->setTimeScale(0.5f * appCore->getSimulation()->getTimeScale());
105105
}
106106

107107
void
108108
TimeToolBar::slotFaster()
109109
{
110-
appCore->getSimulation()->setTimeScale(10.0 * appCore->getSimulation()->getTimeScale());
110+
appCore->getSimulation()->setTimeScale(10.0f * appCore->getSimulation()->getTimeScale());
111111
}
112112

113113
void
114114
TimeToolBar::slotSlower()
115115
{
116-
appCore->getSimulation()->setTimeScale(0.1 * appCore->getSimulation()->getTimeScale());
116+
appCore->getSimulation()->setTimeScale(0.1f * appCore->getSimulation()->getTimeScale());
117117
}
118118

119119
void
@@ -125,7 +125,7 @@ TimeToolBar::slotCurrentTime()
125125
astro::Date celDate(d.year(), d.month(), d.day());
126126
celDate.hour = t.hour();
127127
celDate.minute = t.minute();
128-
celDate.seconds = (double) t.second() + t.msec() / 1000.0;
128+
celDate.seconds = (double) t.second() + t.msec() * 0.001;
129129

130130
appCore->getSimulation()->setTime(astro::UTCtoTDB(celDate));
131131
}

src/celscript/legacy/cmdparser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ ParseResult parseTimeCommand(const Hash& paramList, const ScriptMaps&)
455455

456456
ParseResult parseTimeRateCommand(const Hash& paramList, const ScriptMaps&)
457457
{
458-
auto rate = paramList.getNumber<double>("rate").value_or(1.0);
458+
auto rate = paramList.getNumber<float>("rate").value_or(1.0f);
459459
return std::make_unique<CommandSetTimeRate>(rate);
460460
}
461461

src/celscript/legacy/command.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ void CommandSetTime::processInstantaneous(ExecutionEnvironment& env)
331331
////////////////
332332
// Set time rate command: set the simulation time rate
333333

334-
CommandSetTimeRate::CommandSetTimeRate(double _rate) : rate(_rate)
334+
CommandSetTimeRate::CommandSetTimeRate(float _rate) : rate(_rate)
335335
{
336336
}
337337

src/celscript/legacy/command.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ class CommandSetTime : public InstantaneousCommand
301301
class CommandSetTimeRate : public InstantaneousCommand
302302
{
303303
public:
304-
CommandSetTimeRate(double);
304+
CommandSetTimeRate(float);
305305

306306
protected:
307307
void processInstantaneous(ExecutionEnvironment&) override;

src/celscript/lua/celx_celestia.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1269,7 +1269,7 @@ static int celestia_settimescale(lua_State* l)
12691269
Celx_CheckArgs(l, 2, 2, "One argument expected to function celestia:settimescale");
12701270

12711271
CelestiaCore* appCore = this_celestia(l);
1272-
double t = Celx_SafeGetNumber(l, 2, AllErrors, "Second arg to celestia:settimescale must be a number");
1272+
float t = Celx_SafeGetNumber(l, 2, AllErrors, "Second arg to celestia:settimescale must be a number");
12731273
appCore->getSimulation()->setTimeScale(t);
12741274

12751275
return 0;

0 commit comments

Comments
 (0)