URL:
<http://gna.org/bugs/?15586>
Summary: Scripting: Can not save Player value into savegame
(Failed to dump variables)
Project: Freeciv
Submitted by: englabenny
Submitted on: fredag 2010-03-12 den 13:37
Category: general
Severity: 3 - Normal
Priority: 1 - Later
Status: None
Assigned to: None
Originator Email:
Open/Closed: Open
Release: 2.2
Discussion Lock: Any
Operating System: None
Planned Release:
_______________________________________________________
Details:
The Player value has no .id field anymore so it cannot be saved via the
script values scheme.
The Player "class" lost its 'id' field in Revision r14223
Attached scenario tries to store a player value in a global script variable.
It will print the error "lua error: Failed to dump variables" if you try to
save a savegame. However, the rest of the savegame seems to save intact so
freeciv does very well.
It looks like the only way to fix it is to re-add the 'id' field, since all
our types are supposed to have it, but I don't know what that technically
entails.
the alternative is an id() accessor and then special-casing Players in the
dumper(?)
Discovered when updating
http://freeciv.wikia.com/wiki/Events_Reference_Manual
thanks
Script inside the savegame, with the output vars=$$:
[script]
code=$
function new_turn_callback(turn, year)
local player = find.player(0)
I_am_player = player
notify.all("Found player %s of the %s, now try save him/her into a
savefile", player.name, player.nation:plural_translation())
end
I_am_player = nil
signal.connect('turn_started', 'new_turn_callback')
$
vars=$$
---
The expected output in vars would be to somehow save the I_am_player
variable.
If there would have been more variables, all would be lost, not just the
player variable.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: fredag 2010-03-12 den 13:37 Name: FailDumpPlayer.sav Size: 33 kB
By: englabenny
<http://gna.org/bugs/download.php?file_id=8458>
_______________________________________________________
Reply to this item at:
<http://gna.org/bugs/?15586>
_______________________________________________
Meddelandet skickades via/av Gna!
http://gna.org/
_______________________________________________
Freeciv-dev mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-dev