Currently Online

Latest Posts

Topic: save frequency setting broken?

Tibor

Topic Opener
Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2016-05-12, 21:00

MiroslavR wrote:

Tibor wrote:

MiroslavR wrote:

Using Pause Break to pause the game instead of lowering the speed to 0 with Page Down seems to stop the autosave mechanism as intended.

I had no idea about Pause Break feature, thanks for info. BTW setting speed to 0x should have the same effect, should it not?

From what I can tell, there is no difference other than is_paused() not working properly. The only place I could find this function used was in the autosave code. I think the fix should be as simple as "is_paused() { return real_speed() == 0; }" instead of returning paused_, because lowering the speed to 0 does not seem to set paused_ to true.

I will use your suggestion, thanks


Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2016-05-12, 21:26

At the end I used bit different approach, see:

https://code.launchpad.net/~widelands-dev/widelands/bug-1566441_Saving_game

I will test it a bit and then propose for merging..


Top Quote
MiroslavR

Joined: 2010-10-16, 16:56
Posts: 35
Ranking
Pry about Widelands
Location: Slovakia
Posted at: 2016-05-12, 21:54

Quite frankly, I'm not a huge fan of that approach. I think doing it in is_paused() is less prone to potential future errors.


Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2016-05-13, 09:42

which approach? The one you suggested or one I implemented in the branch? My implementation seems to me less intrusive....


Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2016-05-13, 10:06

BTW, regression tests fails in trunk, is this issue known?


Top Quote
MiroslavR

Joined: 2010-10-16, 16:56
Posts: 35
Ranking
Pry about Widelands
Location: Slovakia
Posted at: 2016-05-13, 11:09

Tibor wrote:

which approach? The one you suggested or one I implemented in the branch? My implementation seems to me less intrusive....

The implementation in your branch. I would say the behavior of is_paused() is non-intuitive and could lead to future bugs similar to this one. Regarding intrusiveness, I can't think of a case when you would need to differentiate between speed 0 and Pause Break pauses when checking if the game is paused.


Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2016-05-13, 11:19

BTW, Pause/Break does not work here. Could we perhpas get completely rid of this "pause" stuff? And use only Page up/down keys?


Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 14:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2016-05-13, 12:24

set_paused is also used by the save handler, so the same will stop running while being saved, and then return to its former speed, all without changing the game speed display.

The regression tests on trunk are OK on my machine.


Busy indexing nil values

Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2016-05-13, 12:59

GunChleoc wrote:

set_paused is also used by the save handler, so the same will stop running while being saved, and then return to its former speed, all without changing the game speed display.

OK, but if there is specific state "paused", the function is_paused() should not return paused if actual status is 'not paused but speed set to 0'

The regression tests on trunk are OK on my machine.

Hm, I will recompile and re-test...


Top Quote
Tibor

Topic Opener
Joined: 2009-03-23, 22:24
Posts: 1377
Ranking
One Elder of Players
Location: Slovakia
Posted at: 2016-05-13, 13:21

I recompiled the latest trunk and it works, fine then...

EDIT: my branch works now fine too... (regression tests)

Edited: 2016-05-13, 13:50

Top Quote