[Freeciv-Dev] [bug #14221] notify.all and notify.player don't work in lua scripts

2009-08-31 Thread matz

URL:
  http://gna.org/bugs/?14221

 Summary: notify.all and notify.player don't work in lua
scripts
 Project: Freeciv
Submitted by: matz
Submitted on: Monday 08/31/2009 at 19:12
Category: general
Severity: 3 - Normal
Priority: 5 - Normal
  Status: None
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Release: 
 Discussion Lock: Any
Operating System: None
 Planned Release: None

___

Details:

calling notify.all or notify.player from a lua script results in an error:

lua error:
error in error handling


I think the problem lies in the following lines from
server/scripting/api.pkg:


function notify.all(...)
  notify.event_msg(nil, nil, E.NOEVENT, string.format(unpack(arg)))
end

function notify.player(player, ...)
  notify.event_msg(player, nil, E.NOEVENT, string.format(unpack(arg)))
end


As far as I can see E.NOEVENT has been removed in SVN revision #10901
http://svn.gna.org/viewcvs/freeciv?rev=10901view=rev. Replacing E.NOEVENT
by -1, 0 or one of the existing events like E.CHAT_MSG seems to work. But I
have no idea which one could be appropriate.




___

Reply to this item at:

  http://gna.org/bugs/?14221

___
  Message sent via/by Gna!
  http://gna.org/


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


[Freeciv-Dev] [bug #14221] notify.all and notify.player don't work in lua scripts

2009-08-31 Thread matz

Follow-up Comment #1, bug #14221 (project freeciv):

The Bugreport applies to 2.1 and trunk. In 2.1 no error message is generated
though.

Steps to reproduce the bug:
1. Add the following snippet to script.lua of a ruleset

function turn_started_callback(turn, year)
  notify.all(Hello World)
end

2. start a game with that ruleset

___

Reply to this item at:

  http://gna.org/bugs/?14221

___
  Message sent via/by Gna!
  http://gna.org/


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


[Freeciv-Dev] [bug #14217] tech_researched signal called with wrong tech (patch included)

2009-08-30 Thread matz

URL:
  http://gna.org/bugs/?14217

 Summary: tech_researched signal called with wrong tech
(patch included)
 Project: Freeciv
Submitted by: matz
Submitted on: Sunday 08/30/2009 at 20:15
Category: None
Severity: 3 - Normal
Priority: 5 - Normal
  Status: None
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Release: 
 Discussion Lock: Any
Operating System: None
 Planned Release: None

___

Details:

When a new technology is researched the tech_researched signal gets called
with the newly selected research target instead of the technology which has
just been researched. It seems that this bug has been introduced in SVN
revision #15849. 

Steps to reproduce:
1. Add the following snippet to script.lua of a ruleset

function tech_researched_callback(tech, player, source)
  notify.event(nil,nil,0,'Player ' .. player.name .. ' just researched ' .. 
methods_tech_type_rule_name(tech))
end
signal.connect(tech_researched, tech_researched_callback)

2. start a game with that ruleset
3. Select Alphabet to research and Bronze Working as goal
4. Wait till Alphabet is researched
5. Message Player X just researched Bronze Working is shown.
Expected message would be Player X just researched Alphabet

The attached patch fixes the problem.



___

File Attachments:


---
Date: Sunday 08/30/2009 at 20:15  Name: 2009-08-30_tech_researched.patch 
Size: 823B   By: matz

http://gna.org/bugs/download.php?file_id=6539

___

Reply to this item at:

  http://gna.org/bugs/?14217

___
  Message sent via/by Gna!
  http://gna.org/


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