URL:
<http://gna.org/bugs/?15696>
Summary: Scripting: Make all fields constant
Project: Freeciv
Submitted by: englabenny
Submitted on: torsdag 2010-03-25 den 16:47
Category: None
Severity: 3 - Normal
Priority: 1 - Later
Status: None
Assigned to: englabenny
Originator Email:
Open/Closed: Open
Release: 2.2
Discussion Lock: Any
Operating System: None
Planned Release:
_______________________________________________________
Details:
The Scripting API provides read and **write** access to many fields of Units,
Cities, Unit_Types etc, all fields that are not declared 'const' in api.pkg.
This access is probably unintended, and modifies pointers directly (not using
accessors). Mostly, freeciv does not cope well with changes, for example,
changing unit owner:
> lua u = find.unit(find.player(1), 113)
> lua print(u.utype)
userdata: 0x0x112a2160
> lua print(u.utype:rule_name())
Explorer
> lua u.owner = find.player(2)
>
1: in srv_running() [srv_main.c::2073]: Failed at
[sanitycheck.c::545]:!(unit_owner(punit) == pplayer)
1: in begin_phase() [srv_main.c::818]: last message repeated 2 times
1: in begin_phase() [srv_main.c::818]: Failed at [sanitycheck.c::548]:!(phome
= player_find_city_by_id(pplayer, punit->homecity))
1: can_unit_do_activity_targeted_at() unknown activity -1
1: in get_activity_text() [unit.c::620]: assertion 'FALSE' failed.
I have yet to find any settable field that freeciv can cope with. Changing
building or Unit_Type's build_cost does not appear to have any effect. (Any
changes like that that we don't save into the savegame, are even more
pointless).
_______________________________________________________
Reply to this item at:
<http://gna.org/bugs/?15696>
_______________________________________________
Meddelandet skickades via/av Gna!
http://gna.org/
_______________________________________________
Freeciv-dev mailing list
[email protected]
https://mail.gna.org/listinfo/freeciv-dev