Skip to content

Commit

Permalink
pong: Replace time numeric limit with constants.
Browse files Browse the repository at this point in the history
  • Loading branch information
heinezen committed Dec 25, 2023
1 parent 6f0117b commit 1f54b5d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions libopenage/main/demo/pong/aicontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ std::vector<PongEvent> get_ai_inputs(const std::shared_ptr<PongPlayer> &player,
time::time_t ty_hit = 0, tx_hit = 0;

if (speed[0] == 0) {
tx_hit = std::numeric_limits<time::time_t>::max();
tx_hit = time::TIME_MAX;
}
else if (speed[0] > 0) {
tx_hit = time::time_t::from_double((area_width - ball_pos[0]) / speed[0]);
Expand All @@ -44,7 +44,7 @@ std::vector<PongEvent> get_ai_inputs(const std::shared_ptr<PongPlayer> &player,
}

if (speed[1] == 0) {
ty_hit = std::numeric_limits<time::time_t>::max();
ty_hit = time::TIME_MAX;
}
else if (speed[1] > 0) {
ty_hit = time::time_t::from_double((area_height - ball_pos[1]) / speed[1]);
Expand Down
4 changes: 2 additions & 2 deletions libopenage/main/demo/pong/physics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class BallReflectWall : public event::DependencyEventHandler {
auto screen_size = state->area_size->get(now);

if (speed[1] == 0) {
return std::numeric_limits<time::time_t>::max();
return time::TIME_MAX;
}

time::time_t ty = 0;
Expand Down Expand Up @@ -199,7 +199,7 @@ class BallReflectPanel : public event::DependencyEventHandler {
auto screen_size = state->area_size->get(now);

if (speed[0] == 0)
return std::numeric_limits<time::time_t>::max();
return time::TIME_MAX;

time::time_t ty = 0;

Expand Down

0 comments on commit 1f54b5d

Please sign in to comment.