IRC logs for #openttd.dev on OFTC at 2015-02-22
⏴ go to previous day
01:49:07 *** dihedral has joined #openttd.dev
08:03:46 *** Alberth has joined #openttd.dev
08:03:46 *** ChanServ sets mode: +v Alberth
12:08:24 *** frosch123 has joined #openttd.dev
12:08:24 *** ChanServ sets mode: +v frosch123
13:09:42 *** frosch has joined #openttd.dev
13:40:23 *** DorpsGek sets mode: +v frosch
13:40:26 <frosch> hmm, i am comparing it to ScriptGoal::New
13:41:13 <frosch> either we should add multiple functions to ScriptGoal instead of using the GoalTpe enum
13:41:21 <frosch> or the news function should use a similar enum
13:42:59 <frosch> ScriptSotryPAge::NewElement also uses an enum
13:45:38 <frosch> functions using "tiles" seem to be named "Location" in most cases, instead of "Position"
13:46:41 <frosch> possibly, instead of adding new funtions, we can extent the old functions, and provide a compatibility thingie in the compat scripts
13:49:37 <Alberth> goaltype-like approach would work too
13:51:55 <frosch> i think i prefer extending the existing function with parameters, and adding a wrapper in the compat_*.nut files
13:52:25 <frosch> also, ScriptStoryPage::UpdateElement looks weird
13:52:36 <frosch> it updates the reference id, but not the type
13:53:16 <frosch> though i do not see a way to fix that in a compatible way
13:54:53 <Alberth> k, will change it, and see what happens :)
14:51:16 <Alberth> should the call still silently drop the reference if it is not valid?
14:52:20 <Alberth> hmm, doesn't make much sense I guess, the text will still talk about that reference
14:54:09 <frosch> problem is that scripts to not really notice when a reference becomes invalid
14:54:38 <frosch> a industry may close just in the moment between the script scanning all industries and updating the news
15:07:20 <Alberth> indeed, but should it skip publishing in such a case, or publish anyway?
15:08:09 <Alberth> it doesn't make a lot of sense, so perhaps not
15:08:18 <frosch> i believe industry closure deletes news referencing to it
15:08:34 <frosch> so, i guess ottd should drop new items with invaild references
15:08:50 <frosch> that way the behaviour is the same if the industry closes 1 tick before/after adding the news item :p
15:09:25 <Alberth> if (!IsValidTile(p2)) return CMD_ERROR; <-- it checks the reference in the command
15:09:40 <Alberth> and refuses to publish it thus
15:10:22 <frosch> ah, so it even tells the script in the return value :)
15:10:42 <Alberth> assuming the referenced thing is mentioned in the news, that would fail too
15:10:52 <Alberth> haven't checked what happens there
15:11:08 <frosch> in the past ottd crashed :p
15:11:34 <frosch> since scripts and since strings from scripts are stored in the save, there are "<invalid thingie>" fallbacks everywhere
15:14:22 <Alberth> doesn't seem to do anything special with invalid references in the parameters
15:18:41 <Alberth> well, since the news system is rejecting it anyway, let's reject the message without ever reaching the cmd code.
15:46:28 <Alberth> should GSController.GetVersion return a 1.5 version if you have eg 1.4 compatibility enabled?
15:49:09 <frosch> why not, returning the script's own value from Info.GetAPIVersion makes no sense
15:49:29 <frosch> i have a terrible typing day today :)
15:55:13 <frosch> oh, also, the 1.4 compatibility does not disable the new 1.5 functions
15:55:20 <frosch> i believe some scripts check the version
15:55:29 <frosch> to use new functions or fall back to older ones
15:55:41 <frosch> but you probably would have to ask zuu about that :)
15:58:34 <Alberth> assuming that code actually works :p
15:59:34 <frosch> yeah, the compat scripts are funny :p
15:59:57 <frosch> copying a native-function-reference into some placeholder name
16:00:17 <frosch> and then redefining it with something new, which calls the real one again
16:00:23 <Alberth> functions are just first citizens
16:02:11 <Alberth> thus if you check the actual program version, you have to consider the compatibility setting into consideration as well to know what to call :)
16:04:35 <Alberth> I'll ask Zuu some time :)
17:09:24 <Alberth> should be took a whole day :p
21:14:39 *** Alberth has left #openttd.dev
continue to next day ⏵