任务单 #44902

Cast int to double, compare to 0.01

开放日期: 2022-06-22 06:33 最后更新: 2023-02-22 12:40

报告人:
(匿名)
属主:
类型:
状态:
关闭
组件:
里程碑:
优先:
5 - Medium
严重性:
5 - Medium
处理结果:
Fixed
文件:
3

Details

I'm not sure what this code is supposed to do, but it looks wrong:

https://github.com/freeciv/freeciv/blob/master/client/text.c#L1555

get_seconds_to_new_turn() returns int, not double. Even then it would be a pretty stringent test (less than one frame worth of time).

任务单历史 (3/8 Histories)

2022-06-22 06:33 Updated by: None
  • New Ticket "Cast int to double, compare to 0.01" created
2022-06-22 06:53 Updated by: cazfi
评论

Reply To (Anonymous)

get_seconds_to_new_turn() returns int, not double. Even then it would be a pretty stringent test (less than one frame worth of time).

Looking around where the get_seconds_to_new_turn() value comes, there seems to be more double/integer confusion (there's 'ceil() + 0.1' assigned to that integer...)

I think the point of that test is to avoid displaying negative values if the turn change takes longer than estimated (the estimate is just the lenght of the previous turn change)

2023-02-04 22:22 Updated by: cazfi
  • 里程碑 Update from (无) to 3.0.7 (关闭)
  • 组件 Update from (无) to Client common
2023-02-18 03:57 Updated by: cazfi
  • 属主 Update from (无) to cazfi
  • 处理结果 Update from to Accepted
2023-02-22 12:40 Updated by: cazfi
  • 状态 Update from 开启 to 关闭
  • 处理结果 Update from Accepted to Fixed

编辑

Please login to add comment to this ticket » 登录名