Currently Online

Latest Posts

Topic: LUA: allow_saving = false

kaputtnik
Avatar
Topic Opener
Joined: 2013-02-18, 20:48
Posts: 2433
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2020-07-18, 17:23

I have trouble to disallow saving in a scenario.

According to https://www.widelands.org/documentation/autogen_wl/#wl.Game.allow_saving i thought it might be enough to write:

wl.Game().allow_saving = false

bu it does not work. Attached a minimalistic scenario, containing only an init.lua with the line shown above at the end of it. If i start this scenario, i can save the game.

What do i miss?


Attachment:
test_allow_saving.zip (5.5 KB)

Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
Nordfriese
Avatar
Joined: 2017-01-17, 18:07
Posts: 1928
OS: Debian Testing
Version: Latest master
Ranking
One Elder of Players
Location: 0x55555d3a34c0
Posted at: 2020-07-18, 17:32

It's a bug in Widelands. This function affects only the SaveHandler that handles Autosaves (scripting/lua_root.cc:158 and logic/save_handler.cc:136), but for custom saves a dedicated savehandler is created in wui/game_main_menu_save_game.cc:249 which is simply not aware of the autosave-handler's allow_saving_ state. Open an issue please?


Top Quote
kaputtnik
Avatar
Topic Opener
Joined: 2013-02-18, 20:48
Posts: 2433
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2020-07-18, 17:57

Thanks face-smile.png

bug report

Knowing that it works for autosaves is enough for my scenario face-smile.png


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote