Update of bug #15586 (project freeciv):

                  Status:                    None => Ready For Test         

    _______________________________________________________

Follow-up Comment #1:

A suggested patch is attached. Patch text:

Subject: [PATCH] Add Player:id() method to allow saving players in savegame

Bug #15586: Scripting: Can not save Player value into savegame (Failed
to dump variables)

Since revision r14223, Player does not have any .id field anymore,
so it can not be saved by our dump function (in fact the whole dump
failed).

How this change can/could have been made better:
It may be possible to add properties with tolua (so that the .id
field is a maskeraded function call), but no documentation for this
was found.

It may be preferable to name this method :index() or :number()
instead, since it is not symmetric with the .id fields of other types
anyway.

----

Patch against 2.2 attached.
Updated testcase attached (testcase will correctly load a Player variable).

I suggest applying this to 2.2 as a bug fix (Player save bug is fixed and API
is extended, not modfied)

A different solution where find.player(..) would accept a player name was
explored, but it does not work: At the time when the server evaluates the
saved vars=$$ code, the player names are not available.

(file #8462, file #8463)
    _______________________________________________________

Additional Item Attachment:

File name: 0001-Add-Player-id-method-to-allow-saving-players-in-save.patch
Size:3 KB
File name: FailDumpPlayer.sav             Size:33 KB


    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?15586>

_______________________________________________
  Meddelandet skickades via/av Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to