Follow-up Comment #7, bug #21776 (project wesnoth):

> but in the game the lua variables are deleted during reload, in the replay
that doesnt happen. And the prelaod events are normaly executed to compensate
that.

Oh, I didn't know that.

>thats also possible with the current implementation. save variables in
wesnoth.game_events.on_save and restore them in preload events. 

you mean "in game_events.on_load"? 
game_events.on_load is not skipped in replays like preload events?
and wiki confuses me - game_events.on_load is called also when a game starts
or only when a sevefile is loaded?

>i don't think fireing preload events again would cause problems though.

If you don't delete the Lua environment concurrently then it can cause
problems.  
- An initialization of a Lua structure in a preload event can use 'if
something == nil then'
- In a non-preload event one can check whether the game has been reloaded by
testing a Lua variable

>  i think throwing them away just to rebuild it in a replay would waste of
cputime

IMHO to save cpu time by complicating things and asking for problems is not a
good idea.
I would say it even if I didn't see any concrete issues, but here are some
more that come to my mind:

- a savefile can serve as the starting point of the game and can offer
choices
- a specific side controller may be required to play the game or may determine
a mode of the game
- sometimes a preload event is a way how to bypass a Wesnoth bug:
-- in past a status of disallow_end_turn was not saved in a savefile
-- if [variables] didn't exist then this bug could be prevented in a reload
event: https://gna.org/bugs/?19258


_______________________________________________________________
Conquest Minus:

>hm i still dont understand how do you put the input you gained during that
one turn in the save of the first turn. do you use [set_global_variable] ? 

The players' input is not a part of the game. In the input players can veto
the game. So the input determines whether the game will continue (and will be
reloaded) or a new game will start. 
I need players do the input simultaneously, without any knowledge of the input
of the other player - this is why a Wesnoth chat cannot be used.


    _______________________________________________________

Reply to this item at:

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

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


_______________________________________________
Wesnoth-bugs mailing list
Wesnoth-bugs@gna.org
https://mail.gna.org/listinfo/wesnoth-bugs

Reply via email to