IRC logs for #openttd on OFTC at 2023-08-31
⏴ go to previous day
01:15:30 *** Deep3D has quit IRC (Ping timeout: 480 seconds)
01:22:52 *** Wormnest has quit IRC (Quit: Leaving)
01:41:37 *** HerzogDeXtEr has quit IRC (Read error: Connection reset by peer)
02:09:06 *** debdog has quit IRC (Ping timeout: 480 seconds)
03:06:26 *** D-HUND has quit IRC (Ping timeout: 480 seconds)
07:08:52 <peter1139> This is the age of the train.
07:13:47 *** HerzogDeXtEr has joined #openttd
07:36:20 <peter1139> Shame the old adverts are ruined by association.
07:40:06 <peter1139> > see the comment in-game for a more detailed explanation.
07:40:11 <peter1139> Is a bit weird in a PR?>
07:40:27 <peter1139> Ahh, that makes more sense.
07:41:35 <truebrain> not sure why nobody actually fixed this issue over the last few months .. so many people pointed it out, yet nobody made a PR 😛
07:42:50 <peter1139> I think it was coming up with a clean way to do it. Your way is... not clean, but seems a reasonable workaround in the circumstances.
07:44:05 <truebrain> yeah, one can also address all the places where we should save but don't .. but in the end, anything after MainLoop should either not be there, or be in some construct like this 😄
07:46:15 <andythenorth> was it Variants?
07:46:57 <peter1139> truebrain, preview tag useful in this case?
07:47:16 <truebrain> I tested it locally, but if you want to test it yourself, that is never a bad idea ofc 😄
07:47:19 <peter1139> (I don't know how to test emscripten builds otherwise...)
07:47:31 <truebrain> just slap the preview tag on it, and it will give you one in a few minutes 🙂
07:48:00 <truebrain> never hold back slapping the preview tag on any PR 😄
07:57:12 <truebrain> `"Failed to download base graphics; the game cannot start.<br/><br/>Check your Internet connection and reload to try again.`
07:57:20 <truebrain> bit weird to show that error, but I don't know any better 😦
07:59:19 <ahyangyi> andythenorth: What about cities
07:59:41 <alfagamma_0007> There's a setting for it
07:59:48 <alfagamma_0007> in jgrpp at least
07:59:52 <alfagamma_0007> idk about vanilla
08:01:05 <andythenorth> ahyangyi: what about them? 🙂
08:03:40 <ahyangyi> Treat cities as regional centers even if they aren't the largest towns
08:05:10 <peter1139> Hmm, hungry. Bit early for lunch.
08:05:47 <truebrain> bit better worded, I think.
08:11:25 <andythenorth> ahyangyi: yes, cities can be prioritised when capitals are chosen
08:16:10 <ahyangyi> My question is whether using cities alone is good enough
08:17:51 <andythenorth> ahyangyi: no, because it's a player setting
08:17:57 <andythenorth> so it wouldn't be reliable
08:17:59 <truebrain> there, that should clean up emscripten a lot 😄
08:18:30 <truebrain> I hope you don't mind I added some to your work _glx_ .. it has been on my todo to remove the OpenGFX package from a weird place in our infra for a while now 🙂
08:19:27 <ahyangyi> andythenorth: Why not, a player could also set the year to 1700 and see now available vehicles, but it doesn't mean vehicle newGRFs need to fix that situation
08:21:37 <andythenorth> I don't have a compelling answer to that 🙂
08:21:57 <andythenorth> you're correct, but I think tying GS logic to the player's city setting is unwise
08:29:58 <ahyangyi> On a second thought I think I understand your concern
08:42:11 <peter1139> > Editor: Format On Save
08:48:43 <andythenorth> custom bridgehead / build on tunnels anyone?
08:50:52 <peter1139> I had a patch for the first one.
08:56:20 *** ChanServ sets mode: +v tokai
08:58:01 <andythenorth> can do this, so eh, "flat bridge" 😛
09:02:41 <peter1139> Reall what you want is bridges and tunnels without bridge/tunnel heads.
09:08:34 <andythenorth> "that escalates quickly"
09:11:11 * LordAro elevates andythenorth 5m
09:11:40 <andythenorth> we can have a map array per height layer, right? 😛
09:11:52 <andythenorth> maybe each height layer gets a thread?
09:12:15 <xarick> hi, I'm getting errors when building openttd on visual studio
09:12:28 <alfagamma_0007> Let's build a supercomputer to play Openttd
09:15:21 <peter1139> Install nlohmann_json with vcpkg.
09:26:22 <LordAro> incidentally, it's not entirely clear what's supposed to be installed to get breakpad support - archlinux package google-breakpad doesn't appear to contain the right cmake file
09:30:27 <peter1139> "unofficial-breakpad", which is presumably not the same as "google-breakpad"
09:31:03 <peter1139> Debian has nothing match for it.
09:33:48 <LordAro> unusual that arch wouldn't have anything either
09:36:16 <peter1139> Trousers and jumper weather :/
09:41:02 <truebrain> The only reliable source for breakpad I could find is vcpkg
09:41:16 <truebrain> Which annoyingly adds the "unofficial" part
09:41:22 <truebrain> It is also why it is optional
09:41:51 <truebrain> Still looking if we can't embed / vendor it, but Google software is very annoying to embed
09:42:32 <truebrain> So on arch, Google breakpad will most likely work if you remove the unofficial part in the cmake files 🙂
09:44:59 <xarick> vcpkg install nlohmann-json
09:45:08 <xarick> didn't work, it installed a bunch of stuff
09:45:16 <xarick> but visual studio still doesn't build
09:45:46 <LordAro> crystal ball is broken, "didn't work" is not helpful to us
09:46:25 <Timberwolf> Is there any way to figure out what label a particular cargo ID has for a switch chain? e.g. if I wanted to have a different station rating for OIL_, regardless of what ID it has in the user's newgrfs.
09:47:59 <Timberwolf> I tried `switch(FEAT_CARGOS, SELF, switch_xyz, cargo_label)` but when the NML docs say "no variables", they mean it :D
09:48:57 <peter1139> Probably the wrong triplet for vcpkg... I always needed something-static.
09:49:49 <Timberwolf> Ah. `cargotype()` function looks interesting. /me -> explore.
09:50:42 <peter1139> The point of labels is they will map to the correct ID, so I'm not sure what you are doing :)
09:51:20 <peter1139> (Other than making great videos again)
09:52:28 <alfagamma_0007> I had a question though
09:52:28 <alfagamma_0007> What are breakpad and nholmann-json used for?
09:54:28 <peter1139> xarick, use the correct triplet, that you used for the other vcpkg dependencies.
09:55:05 <peter1139> "x64-windows-static" I would imagine.
09:55:12 <Timberwolf> peter1139: Tnanks :) - what I'm trying to do is override the station rating calculation, but have a different calculation for cargo which has stations provided by an industry which can be built at sea (e.g. base game oil, FIRS fish/sand/stone)
09:57:21 <peter1139> Hmm, finding "what cargos are provided by an industry at sea level" seems awkward.
09:57:23 <Timberwolf> This would be easy if I had some way to go `OIL_: switch_custom_rating; FISH: switch_custom_rating; switch_normal_rating;` but I suspect I have one of those unexpected use cases :)
10:04:37 <peter1139> Hmm, I see, so Station Rating callback runs on the cargo rather than the station, so would normally be defined by the industry/cargo set. But you're trying to override that. Hmm.
10:05:00 <Timberwolf> Yes, I'm doing things which should not be done again :D
10:09:32 <peter1139> Perfect. However, I don't know the answer :(
10:32:03 <truebrain> okay, so, what next, hmmm
10:49:44 <talltyler> Timberwolf doing interesting things again? Subscribe me to your newsletter!
10:56:05 <peter1139> Maybe NML does things weirdly, but I don't think you need to switch on the cargo type, you need to assign the callback via action 3 -- the action 3 ID used here is the cargo ID.
10:56:21 <peter1139> Of course, getting that ID is still the issue.
11:02:00 <Timberwolf> Yeah, I got the action 3 stuff, it's just being able to ascribe a meaning to the ID (outside of the default fixed IDs for PASS, MAIL, GOODS, FOOD
11:02:33 <truebrain> why is andythenorth not using the admin port for debugging? You can send arbitrary objects to the admin port from a GS?
11:03:19 <truebrain> 5 GSes actually make use of it, although 1 has it in the code but disabled .. so I guess 4 😛
11:08:06 <peter1139> Hmm, action 3 ids are not mapped, so it needs to be the literal id. Which means if you could look up the id, you need to use action 6 to apply it.
11:08:09 <andythenorth> These are good questions
11:12:48 <peter1139> Breakfast/salad time!
11:12:54 *** virtualrandomnumber has joined #openttd
11:12:55 <peter1139> (Although I did eat half a biscuit)
11:13:07 *** virtualrandomnumber has quit IRC ()
11:15:45 <truebrain> now the question of all questions .. can I write a unittest for this ..
11:15:51 <truebrain> Rb will be so proud if I can 😛
11:21:57 <Rubidium> depends on what this is... if it's about the crash handler working, then I do not think that can be unittested as the crash handler jumps out of the unit test management code
11:23:36 <truebrain> although I do get ` SIGSEGV - Segmentation violation signal` 😄
11:23:39 <truebrain> but that is not intentional
11:28:06 <truebrain> hmm ... I would like to intercept a function in a test
11:28:12 <truebrain> can I just define the original one as weak? 😄
11:37:09 <peter1139> Ah, Format On Save does a proper number on OpenTTD code :D
11:37:29 <truebrain> you can set it to only format that what you have changed
11:37:33 <truebrain> that sometimes minimizes the impact
11:39:43 <truebrain> `[Squirrel] Compile error: Error test:1/19: expected '='`
11:39:52 <truebrain> why does it expect a `=`? NOBODY KNOWS!
11:40:48 <truebrain> ah, right, Squirrel has this weird table syntax
11:50:09 <truebrain> okay ... now why does the Pool iterator not find my freshly created instance ...
11:51:28 <truebrain> because it is not in the pool .. interesting ..
11:54:25 <truebrain> ah, `new` operator is important 😄
11:56:41 <truebrain> meh; still need to modify the code slightly so I can hook into functions to test things (trying to test the admin port)
11:57:19 <truebrain> so either I have to make `NetworkAdminGameScript` weak, or make `SendGameScript` virtual (first is a function, second a method)
11:59:31 <truebrain> Rubidium: did you gave it any thought already how we were going to hook into our code for more integration testing? (in this case I am testing a Squirrel snippet to result in the right call into OpenTTD itself)
12:27:06 <andythenorth> truebrain: "Preach brother"
12:28:04 <andythenorth> actually I fixed it for you
12:28:45 <truebrain> owh, wauw .. this Squirrel -> JSON isn't really actually unsurprisingly all that good
12:28:50 <truebrain> it very easily sends broken JSON
12:29:09 <andythenorth> one day a WASM, or something
12:31:29 <truebrain> `GSAdmin.Send({test = GSAdmin});` sends out `{ `
12:31:47 <truebrain> yeah, I was replacing it with nholmann, but to make sure I don't add any regression, I was first adding unittests for the current implementation
12:31:53 <truebrain> so we can actually see I didn't break anything
12:31:56 <truebrain> but the current is broken 😄
12:36:19 <truebrain> `Program received signal SIGILL, Illegal instruction.`
12:47:54 <andythenorth> could we have 'clone single vehicle' in depot?
12:48:08 <andythenorth> I often want to make a train a few wagons longer 😛
12:48:16 <andythenorth> buy menu is faff 😛
12:49:44 <truebrain> Pfew, fix is easy. Silly bug. Who knew, testing helps! 😛
13:19:59 <truebrain> There, that is what I was refering to Rubidium; I asume you are proud of me adding unittests for such a simple fix 😛
13:33:49 <truebrain> I might make it a bit simpler, and only test MakeJSON .. hmm
13:36:48 <truebrain> but that was what I was actually doing
13:37:09 <truebrain> now to do the same for the way back, but I have had enough of this for one day 😛
13:39:49 <truebrain> meh; I really don't like 11250 .. will see how it looks like if I just test MakeJSON ..
14:14:52 <peter1139> What's not to like?
14:55:24 <Rubidium> TrueBrain: I didn't think too much about larger scale integration tests for now. For the unit tests I mostly thought about tests for "pure" functions (those that do not touch global state). For larger scale tests you probably need to use interfaces in some manner, so I'm not sure whether that's something we want to add
14:57:05 <Rubidium> also, in 11250 I assume a "not" too many in this part of the description: "added test-cases to proof it is not functioning as we expect"
15:02:32 <truebrain> You still understand what I mean 😛
15:03:02 <truebrain> Rubidium: Yeah, okay. I will change it into a real unit test instead of this integration test I was building. Tnx 🙂
15:08:58 <Rubidium> this is definitely a fringe thing with respect to testing. I was pondering whether it makes sense to split the Send function up into a part that does all the error checking, and then one function that returns a tuple with std::optional<std::string> and the return code, and the current Send function just calls that and performs the actual send to the network. That would at least remove the network bit
15:09:04 <Rubidium> from the test. Though mocking that is way simpler, than getting the Squirrel environment running. On the other hand, I reckon that in the long run the functionality to set up a Squirrel environment in an unit test is something that needs to be coded once and can be reused for each subsequent test
15:33:43 *** gelignite has joined #openttd
15:55:09 <truebrain> I just hate testing in C++ .. they made it unneededly more complicated 😛
15:57:09 <truebrain> let's first do this .. and keep this PR to actually fix the bug
16:23:15 <truebrain> I totally and utterly forgot how the Squirrel stack works 😄
16:25:35 <_glx_> luckily you don't have to play with the stack for the fix 🙂
16:25:50 <truebrain> but the manual is clear enough, so that helps
16:27:08 <_glx_> that's the only part where the manual is clear 🙂
16:31:35 *** gelignite has joined #openttd
16:38:33 <truebrain> sometimes I really wonder how things work, when looking over the code ..
16:38:38 <truebrain> for example how we address the Squirrel stack
16:38:52 <truebrain> I just can't believe there aren't bugs related to it 😛
16:39:59 <truebrain> (sometimes we address the index with positive index, sometimes with negative .. seemly a bit random 😛 )
16:40:25 <truebrain> most likely it also depends on who was writing that piece of code, but alas
16:52:18 <truebrain> okay, I now have a much better method of unittesting .. already a bit of boilerplate for more Squirrel testing, but still located in a single file, as .. well .. there are no others yet 😄
16:58:01 <truebrain> now I also spotted there was a AdminPort -> Squirrel .. let's see if I can test that too somehow ...
17:03:40 <_glx_> oh nice manual parsing of the string
17:06:47 <_glx_> especially the integer values
17:08:07 <truebrain> one is not like the rest
17:08:58 <_glx_> the first one includes "-" for negative values
17:09:14 <alfagamma_0007> andythenorth: Going into the shadow realm?
17:12:49 <_glx_> not sure about `-` without any digits
17:14:02 <_glx_> (atoi() should return 0 in this case)
17:16:12 <truebrain> so I am converting the JSON to a Squirrel table .. as that is what it does. But to make sure it is what we expect, I also compile a piece of Squirrel, and compare those two results with each other 😛
17:16:15 <truebrain> hopefully this works 😄
17:16:53 <_glx_> like send json from squirrel and send it back to squirrel ?
17:17:41 *** beratsj has quit IRC (Quit: User went offline on Discord a while ago)
17:19:20 <_glx_> oh you manually fill a squirrel table
17:20:17 <truebrain> as painful as the otherway, so that is okay, honestly
17:20:32 <truebrain> just modling the stack to do what I want is a bit tricky 😄
17:21:06 <_glx_> yeah with things auto removed by squirrel and things you have to remove manually
17:22:18 <truebrain> I am just not sure that in Squirrel something like `{ test = 1 } == { test = 1 }` is actually equal
17:24:09 <truebrain> that seems to be the case
17:25:38 <_glx_> SQVM::IsEqual() compares types then raw values
17:27:49 <truebrain> `ObjCmp` suggests it should work .. so maybe something else is not what I expect, but how to debug that, hmmm
17:30:16 <_glx_> it doesn't do ObjCmp if types are the same
17:31:33 <truebrain> owh, lol, I pop'd the table from the stack ... such mistakes are so easily done 😄
17:31:59 <truebrain> I was compare the root table with the JSON table
17:33:08 <truebrain> hmm .. I guess these tables don't have `_delegable` set
17:33:14 <truebrain> so it falls back to a pointer compare now
17:33:44 <truebrain> `SQOBJECT_DELEGABLE`
17:33:47 <truebrain> hmm, no, they are delegable
17:34:50 <truebrain> and yes, the squirrel `==` is silly .. `sq_cmp` does it better .. and for some fucked up reason, yes, they are different
17:39:17 <truebrain> okay, a table by default has no `cmp` delegate function
17:41:15 <truebrain> `(table : 0x5558FA0DA500)` .. I see that the `tostring()` is also very useful
17:42:23 <truebrain> so how to check if the result is correct, in a not-very-annoying way .. hmm
17:42:55 <truebrain> converting it back to a JSON string .. but that feels really bad ...
17:50:41 <_glx_> I guess comparing tables is not something expected 🙂
17:51:58 <truebrain> booleans don't work, lol
17:52:51 <truebrain> `sq_pushinteger` instead of `sq_pushbool`
17:56:34 <truebrain> lol, and you can't feed empty tables ... not going to fix that 😛
17:56:40 <truebrain> we do that during conversion 🙂
18:01:38 <truebrain> there, now that are proper unittests! 😄
18:24:47 <truebrain> tomorrow I will finish that PR. Now really seen enough of this stuff 😛
18:40:50 <alfagamma_0007> All hail Andy for his decade old python templating tutorial for nml
18:50:10 <andythenorth> people still read that? 😮
18:50:17 <andythenorth> it wasn't even the best way 😛
19:14:05 <ahyangyi> andythenorth: Because forking Iron Horse is better? 😛
19:21:25 <_glx_> coding like andy is rarely the best idea 🙂
19:22:41 *** Smedles_ has joined #openttd
19:24:30 <andythenorth> someone has to do it
19:25:50 *** Smedles has quit IRC (Ping timeout: 480 seconds)
19:46:06 *** gelignite has quit IRC (Quit: Stay safe!)
20:03:44 <andythenorth> let's write some more GS
20:21:39 *** Flygon has quit IRC (Quit: A toaster's basically a soldering iron designed to toast bread)
20:32:27 *** Wolf01 is now known as Guest1374
20:38:34 *** Guest1374 has quit IRC (Ping timeout: 480 seconds)
21:23:34 *** keikoz has quit IRC (Ping timeout: 480 seconds)
21:31:20 *** Wolf01 has quit IRC (Quit: Once again the world is quick to bury me.)
21:40:57 *** HerzogDeXtEr has quit IRC (Read error: Connection reset by peer)
22:10:58 *** APTX has quit IRC (Quit: Farewell)
22:39:09 <locosage> ahyangyi: grf-py ftw! 🤭
22:42:04 <locosage> maybe I should write a tutorial 😅
continue to next day ⏵