Quantcast
Channel: forum.freeciv.org
Viewing all articles
Browse latest Browse all 370

Tech support • Re: Global vars weirdness on load in Freeciv 2.6.4 with GTK2 client

$
0
0
I eventually got around the problem of script command execution prior to global vars being restored (which was happening on unit_moved and/or city_destroyed and city_transferred signal during a reload of a saved game.)

I added river to a specific tile in the scenario map. At the beginning of the scenario's script code section, placed commands to check for the presence of river on the specific tile. The commands should be "loose" rather than within any function. If river is present on the tile then it is turn 0 just prior to game start, remove river from the tile. Subsequent reloads will no longer find river on the specific tile and thus the script can differentiate turn 0 from any reload. If it is a reload, then call a "setup" function* to re-define needed functions and global vars ( to the extent possible before real data values are restored at "End Turn".)

* = actually set a flag to run the setup function (_G.ReloadDetected), then define the setup function in the script, then call it with a loose command just following the setup function (as in if _G.ReloadDetected then call the function just above the command.)

Then it is possible to work-around the issue of unit_moved or other signals issued prior to the global vars data being restored.

Statistics: Posted by Molo_Parko — Tue Aug 27, 2024 4:15 pm



Viewing all articles
Browse latest Browse all 370

Trending Articles