IRC logs for #openttd on OFTC at 2024-10-17
            
00:24:36 <peter1138> Nice, Ogg Opus sound effects working again, just in time for me to disable annoying sound effects.
02:13:08 *** Wormnest has quit IRC (Quit: Leaving)
02:51:16 *** gnu_jj has joined #openttd
02:53:24 *** herms61 has quit IRC (Quit: Ping timeout (120 seconds))
02:54:09 *** herms61 has joined #openttd
02:54:24 *** gnu_jj_ has quit IRC (Ping timeout: 480 seconds)
03:00:21 *** herms61 has quit IRC (Remote host closed the connection)
03:02:13 *** godbed has joined #openttd
03:02:24 *** godbed_ has joined #openttd
03:03:57 *** herms61 has joined #openttd
03:05:46 *** D-HUND has quit IRC (Ping timeout: 480 seconds)
03:05:46 *** debdog has quit IRC (Ping timeout: 480 seconds)
04:11:15 *** keikoz has joined #openttd
04:47:19 <DorpsGek> [OpenTTD/OpenTTD] eints-sync[bot] pushed 1 commits to master https://github.com/OpenTTD/OpenTTD/commit/ae4a723889be7c40a62730672c55dde674f0828f
04:47:20 <DorpsGek> - Update: Translations from eints (by translators)
06:21:25 *** godbed_ has quit IRC (Quit: http://quassel-irc.org - Chat comfortably. Anywhere.)
06:27:05 *** godbed is now known as debdog
06:44:35 *** Flygon has joined #openttd
07:04:16 *** HerzogDeXtEr has joined #openttd
08:02:14 <peter1138> Oh, right, this is the keyboard that has a de-bounce issue on the enter key 😦
08:19:58 <ahyangyi> andythenorth[d]: Is that real or someone wrote a joke on wiki?
08:32:49 <DorpsGek> [OpenTTD/OpenTTD] PeterN commented on issue #12997: [Crash]: Game crashes when exiting the scoreboard when tycoon of the century if there is an AI player also active https://github.com/OpenTTD/OpenTTD/issues/12997
08:48:04 <andythenorth[d]> it's all real
08:48:15 <andythenorth[d]> it's unsurprising, cargos are hard
08:48:23 <andythenorth[d]> I've done the same things when FIRS was younger
08:51:11 <andythenorth[d]> authors redefine cargos against existing labels because....
08:51:11 <andythenorth[d]> - they forget to change the label
08:51:11 <andythenorth[d]> - don't know why they should
08:51:11 <andythenorth[d]> - to get vehicle refit support
08:51:11 <andythenorth[d]> - to get station cargo sprite support
08:51:43 <andythenorth[d]> OTIS redefines 'chemicals' as 'sewage' which is quirky, but Garry does have a significant head injury
09:11:48 <peter1138> Fenton!
09:14:07 <peter1138> https://cdn.discordapp.com/attachments/1008473233844097104/1296400845025574974/image.png?ex=671226df&is=6710d55f&hm=3c717a1e931005eb783dce9636f2c2657738c298e858b25d5fa66010768b8aed&
09:14:07 <peter1138> Neat
09:14:14 <andythenorth[d]> it is
09:30:02 <xarick> hui
09:32:19 *** Borg has joined #openttd
09:34:20 <Borg> peter1138: hey, maybe I should first move to GRFv7 ? and then if all right, to GRFv8 ?
09:34:38 <peter1138> Absolutely no point.
09:35:10 <Borg> im worried about that part (GRFv8 spec info):
09:35:13 <Borg> Various compatibility layers within the specs were removed to simplify writing NewGRFs resp. to remove arbitrary restrictions.
09:35:16 <Borg> E.g. the special meaning of 0xFF?? callback results was removed. Also all callbacks are 15bit callbacks now.
09:35:39 <Borg> I remember I had some troubles there..
09:36:27 <peter1138> Just change FF to 80
09:36:47 <Borg> you mean FFFF to 8000 ?
09:45:52 <peter1138> No, just the first FF of the callback result to 80.
09:50:02 <Borg> damn, complicated stuff.. probably more RTFS
09:50:13 <Borg> for now I use FFFF in production callbacks to mark them as done/fail
10:03:32 <peter1138> That will be a callback result of 0xFF still.
10:04:18 <peter1138> But industries are looking for a special result. Although it's a callback, it doesn't use the normal callback result stuff.
10:06:51 <peter1138> Basically it doesn't matter what your callback result value is, it will finish because it's not a production callback result.
10:07:02 <xarick> 0080?
10:31:57 <Borg> xarick: 00 80 if you want NFO code
10:32:09 <Borg> or \wx8080
10:32:13 <Borg> peter1138: ok
10:33:34 <peter1138> Oh, "first" is wrong then, I never considered if GRF is little or big endian.
10:33:53 <peter1138> (It's little-endian)
10:34:03 <Borg> yeah
10:34:25 <Borg> or \wx8000 :) I mean
10:34:30 <peter1138> Although if you're using \w then it is the right way around.
10:34:44 <Borg> yeah.. \wx8000 -> 00 80
10:34:56 <peter1138> To be equivalent, `\wxFFFF` is `\wx80FF`, I believe.
10:35:17 <Borg> hmm.. yeah, Ill check that later
10:35:24 <Borg> for now playing OpenTTD on Tropic
10:35:27 <Borg> testing stuff
10:35:50 <Borg> kinda worried.. 9 years passed and not yet single Random Production (double/half)
10:47:22 <xarick> I think i cracked TileAdd!
10:47:28 <xarick> gave it one more try
10:48:14 <Borg> :)
10:49:05 <xarick> ``` int sign = offset < 0 ? -1 : 1;
10:49:05 <xarick> int dxx = offset % (int)Map::SizeX();
10:49:05 <xarick> int xx = TileX(tile_from) + dxx;
10:49:05 <xarick> int dyy = offset / (int)Map::SizeX();
10:49:05 <xarick> if (xx >= (int)Map::SizeX() || xx < 0) dyy += sign;
10:49:06 <xarick> xx &= Map::MaxX();
10:49:06 <xarick> int yy = (TileY(tile_from) + dyy) & Map::MaxY();
10:49:08 <xarick> assert(TileXY(xx, yy) == Map::WrapToMap(tile_from + offset));```
10:52:34 <xarick> must test invalid offsets
10:59:45 <peter1138> There is no way to validate a TileIndexDiff that spans more than half the map.
11:01:40 <reldred> https://mastodon.social/@loubee/113319545753300111
11:16:13 <Borg> haha, no wonder why no double/half production events...
11:16:28 <Borg> wrong Var2 ID in callbacks...
11:16:34 <Borg> mistake every rewriting
11:19:54 <Borg> s/every/after/
11:24:46 <Borg> fixed! ;) (even happened)
12:20:36 <LordAro> reldred: aaah
12:42:47 <xarick> what happens when you divide a negative int with a uint
12:50:33 <xarick> oh wow, Copilot now remembers past conversations
12:50:39 <xarick> that's scary
12:51:24 <xarick> probably a good idea if I'm the only user of this computer
13:04:18 <peter1138> For ultimate safety you could disconnect yourself from the Internet.
13:32:57 <xarick> what's the difference between
13:33:10 <xarick> IsInsideMM and IsInsideBS
13:34:11 <xarick> not sure which one I use
13:34:14 <LordAro> have you read the documentation for those functions?
13:35:22 <xarick> i wanna check if x is < 0 || x >= MapSizeX()
13:35:33 <xarick> using IsInside
13:35:58 <LordAro> that's nice
13:37:06 <xarick> !IsInsideMM(x, 0, Map::SizeX())
13:38:37 <xarick> I'll try both
13:41:34 <xarick> they put out the same
13:41:40 <xarick> I'm so confused
13:42:14 <peter1138> Urgh, something something clangd is sitting there eating up CPU for HOURS 😒
13:45:31 <_glx_> IIRC MM min max, BS base size, so 0-xxx is the same for both
13:47:54 <peter1138> Yes, if the first value is 0, they are effectively the same.
13:48:33 <peter1138> MM(x, min, max) is equivalent to BS(x, min, max - min)
13:48:57 <peter1138> And they both cheat by using unsigned so that there's no need to test for < 0.
13:50:54 <xarick> supposing the first x coordinate is 50, it would do -32, 50, 256 vs -32, 50, 206
13:52:01 <xarick> okay IsInsideBS it is
13:53:07 <xarick> oh, IsInsideBS doesn't like TileIndex...
13:53:39 <Borg> can I somehow format strings in GS?
13:53:55 <Borg> "blebla"+tostring(num) crashed
13:55:36 <xarick> https://cdn.discordapp.com/attachments/1008473233844097104/1296471680406917172/image.png?ex=671268d7&is=67111757&hm=69170b3a377dd41c092d28bbe69aff3e303a63ab5860b792c8816378d47f7404&
13:55:36 <xarick> I present you the new `TileAdd`!
13:55:44 <xarick> PR?
13:57:30 <Borg> oh "bleble"+num works
13:57:30 *** Majorrek has joined #openttd
13:57:32 <Majorrek> siema
13:57:38 <Borg> Majorrek: english or burn
13:57:40 <Borg> ;)
13:57:52 <Majorrek> chat is online? xD
13:57:53 <Majorrek> wtf
13:58:42 <Borg> maybe you joined wrong channel?
13:59:16 <Majorrek> No, I'm looking for the Polish OpenTTD zone xD
14:00:12 <Borg> try #openttd.pl ?
14:02:07 *** Majorrek has quit IRC ()
14:04:13 *** nielsm has joined #openttd
14:08:59 <xarick> just realised TileIndex is uint
14:09:17 <xarick> tile + offset = always positive number
14:14:51 <xarick> that cheating made me realise I could further simplify this
14:14:53 <Rubidium> xarick: if I'm at tile 1,1 and pass tileindexdiff -2,0, does your new TileAdd assert? If not... don't bother...
14:15:15 <xarick> let me test
14:18:27 <xarick> does not assert
14:18:35 <xarick> came up with x = 255, y = 0
14:18:46 <xarick> it's valid
14:19:43 <Rubidium> no, it underflows and it is exactly the thing that the assertion in TileAdd should catch
14:20:04 <xarick> x underflowed
14:20:19 <xarick> made dy to add -1
14:20:40 <xarick> x corrected to 255, y = 1 + -1 = 0
14:22:07 <xarick> x = -1 & 255 = 255
14:25:10 <xarick> this is not TileAddWrap
14:25:14 <xarick> maybe you're confusing?
14:25:46 <LordAro> just stop
14:26:30 <kuhnovic> I think he did at least 3 times already
14:26:33 <xarick> it follows the behaviour of tile + offset
14:26:34 <kuhnovic> And then un-stopped
14:26:58 <peter1138> If it is to follow the behaviour of tile + offset, then there is no purpose to it.
14:28:06 <xarick> isn't it what it should be doing?
14:45:23 <xarick> funny stuff I just detected
14:50:47 <xarick> Using the same example rubidium provided, with original code:
14:50:47 <xarick> TileXY(x, y) with x = 4294967295, y = 1
14:50:47 <xarick> TileXY does 1 * Map::LogX() + 4294967295 = 256 + 4294967295 = 255
14:50:47 <xarick> I just removed the asserts for the x, y
14:51:26 <xarick> the result of TileXY became valid
15:02:54 <_glx_> It's not
15:10:31 <xarick> just tested brute forcing all offsets of all tiles on a 256*256 map, TileXY(x, y) matched Map::WrapToMap(tile + offset)
15:11:28 <xarick> though x and y are weird overflown values, the whole thing still passed this assert
15:12:02 <xarick> let me try with really bad offsets that end outside map
15:12:05 <xarick> brb
15:15:37 <xarick> it asserts
16:32:59 <xarick> what are you trying to fix?
16:36:08 <merni> good that you are asking yourself that
16:39:53 <xarick> in my opinion, [TileDiffXY](https://github.com/OpenTTD/OpenTTD/pull/12996/files#diff-6343dc379195882c780886f331b31f53e3bb113a25bafd10550c410904117eacR391-R392) asserts shouldn't be limited to -half to +half
16:43:49 <Rubidium> I can agree to that, but... when a special check variant of that function remains, then it should be able to check for under/overflows over the X-axis
16:51:48 *** akimoto has joined #openttd
16:53:44 <xarick> I dont think it's possible
16:55:13 <xarick> to determine y, it needs to know where x is within the x-axis or whether it over/underflown
16:58:12 <xarick> gonna test this:
16:58:12 <xarick> uint32_t x = (TileX(tile) + dx) & Map::MaxX();
16:58:12 <xarick> uint32_t y = (TileY(tile) + dy) >> Map::LogX();
16:58:43 <xarick> nop, fail
17:06:56 *** Markk has quit IRC (Ping timeout: 480 seconds)
17:09:59 *** Markk has joined #openttd
17:40:26 <andythenorth[d]> ha my cargo classes docs are a static compile 😛
17:40:50 <andythenorth[d]> containing classes, and example cargos and vehicles 😛
17:41:27 <andythenorth[d]> python script with a cargo<->class<->vehicle resolver 😛
17:41:39 <andythenorth[d]> just figured out I actually have to resolve the AND NOTs
17:44:10 <andythenorth[d]> everyone needs a hobby eh? 😄
17:46:42 <xarick> `uint32_t y = TileY(tile) + dy + (x >= Map::SizeX() ? (x &= Map::MaxX()) + abs(offset) / offset : 0);`
17:46:42 <xarick> smart coding?
17:51:09 <andythenorth[d]> xarick: maybe you should try a side gig, and write a python cargo <-> vehicle resolver using class props 😛
17:54:09 <andythenorth[d]> `cargo_cargo_class_mapping = {}`
17:54:18 <andythenorth[d]> most accurate name, looks weird 😛
17:58:07 <xarick> @rubidium is this acceptable?
17:58:07 <xarick> ``` int dx = offset % (int)Map::SizeX();
17:58:07 <xarick> int dy = offset / (int)Map::SizeX();
17:58:07 <xarick> uint32_t x = TileX(tile) + dx;
17:58:07 <xarick> uint32_t y = TileY(tile) + dy;
17:58:08 <xarick> y += x >= Map::SizeX() ? offset / abs(offset) : 0;
17:58:08 <xarick> x &= Map::MaxX(); // this makes the x assert to never fail
17:58:10 <xarick> assert(x < Map::SizeX());
17:58:10 <xarick> assert(y < Map::SizeY()); // this can still under/overflow
17:58:12 <xarick> assert(TileXY(x, y) == Map::WrapToMap(tile_from + offset));```
18:24:14 *** Wolf01 has joined #openttd
18:33:57 *** akimoto has quit IRC (Remote host closed the connection)
18:38:42 <xarick> I guess I rather post on the pr
18:45:34 <xarick> TileDiffXY is massively used everywhere in openttd....
18:45:42 <xarick> now I understand your worries
18:48:15 <xarick> I have a weird idea
18:49:09 <peter1138> Probably... use something other than TileDiffXY for large jumped.
18:49:38 <xarick> replace all occurrences of TileDiffXY with my altered version of TileAddXY which does not resort to using TileDiffXY but use tile x + x and tile y + y
18:49:52 <xarick> those can be asserted
18:50:29 <xarick> let me show my version of TileAddXY
18:51:06 <xarick> https://github.com/SamuXarick/OpenTTD/commit/3ea733316c24b642d0c1487b3c9281b4fa0012e3
18:54:31 <xarick> wow 95 matches
18:54:35 <xarick> of TileDiffXY
18:55:22 <xarick> first match
18:55:22 <xarick> `i->location.tile + TileDiffXY(1, 1)`
18:55:22 <xarick> becomes
18:55:22 <xarick> `TileAddXY(i->location.tile, 1, 1)`
18:55:41 <xarick> same with the other 94
19:01:06 <xarick> oh snap, not easily done :p
19:31:15 <locosage> andythenorth[d]: not sure what you mean by reader by grftopy is a full grf decompiler written in python
19:31:23 <locosage> though it may struggle with container version 1
19:51:24 <peter1138> Hmm, maybe.
20:07:28 <wensimehrp> locosage: It bugs when decompiling https://github.com/wensimehrp/wuse
20:08:12 <xarick> `tile_track += tile_delta ^ TileDiffXY(1, 1); // perpendicular to tile_delta` what is this magic doing?
20:10:02 <locosage> wensimehrp: it doesn't even compile xD
20:10:13 <locosage> can you send me the grf file? I'll take a look tomorrow
20:10:36 <xarick> tile_delta is a TileIndexDiff
20:12:32 <locosage> may need a newer python than I have
20:12:55 <locosage> ah, yeah, 3.9 doesn't have match
20:13:03 <locosage> I thought I had 3.10
20:13:49 <wensimehrp> I used 3.11
20:14:20 <xarick> is ^ an OR or a XOR in the calculator?
20:14:45 *** HerzogDeXtEr has quit IRC (Read error: Connection reset by peer)
20:18:31 <wensimehrp> That's factorial
20:19:18 <xarick> dang, I was hoping to eliminate all TileDiffXY's but it's starting to become hard
20:20:17 <wensimehrp> wensimehrp: 😄 not factorial
20:20:27 <andythenorth[d]> I'd kind of like Bananas to be able to list all seen cargo labels and classes
20:20:31 <andythenorth[d]> by grfid
20:20:34 <reldred> Not factorio
20:22:45 <wensimehrp> locosage: You can just remove the function that used it. I haven't touched that function yet
20:29:02 <xarick> why would you use TileDiffXY(0, 0) in terraform :p
20:36:17 <locosage> Well, I turned off pc already...
20:42:42 <andythenorth[d]> GPT came up with a totally unexpected and totally appropriate data structure for my templating 😛
20:42:47 <andythenorth[d]> how funny
20:44:08 *** Westie has joined #openttd
20:45:27 <andythenorth[d]> hmm how do I do OR NOT AND?
20:46:10 <andythenorth[d]> oh, per cargo
20:47:11 <andythenorth[d]> hmm not sure how to write that in python though 😛
20:50:59 <andythenorth[d]> need a flag or something in a loop
20:54:27 <xarick> ```inline TileIndex GetOtherShipDepotTile(Tile t)
20:54:27 <xarick> {
20:54:27 <xarick> return TileIndex(t) + (GetShipDepotPart(t) != DEPOT_PART_NORTH ? -1 : 1) * (GetShipDepotAxis(t) != AXIS_X ? TileDiffXY(0, 1) : TileDiffXY(1, 0));
20:54:27 <xarick> }```
20:54:27 <xarick> wow, I found smart code not by me
20:57:27 <andythenorth[d]> xarick: you didn't write my python yet though? 🙂
20:57:37 <DorpsGek> [OpenTTD/OpenTTD] JGRennison opened issue #13002: [Crash]: If a picker window is re-opened after changing to a game with a different GRF configuration https://github.com/OpenTTD/OpenTTD/issues/13002
20:59:16 <xarick> what the heck is `TileIndex(t)` in that return?
20:59:31 <peter1138> Convert Tile to TileIndex.
20:59:41 <xarick> oh
21:00:04 <xarick> because you can't use multiplication
21:00:12 <xarick> strongtype?
21:01:15 <Rubidium> xarick: there are places with 'tile + TileDiffXY(...)' constructs that do actually overflow..., so doing that's going to be a whole world of pain
21:06:12 <Rubidium> xarick: https://github.com/rubidium42/OpenTTD/commit/b3ccfc4e7165dd87538332c32d8cf622372353fd is the mess I made to figure that out... and yes, I know it asserts quite soon
21:06:14 <xarick> do you know where that happens?
21:06:29 <DorpsGek> [OpenTTD/OpenTTD] PeterN opened pull request #13003: Codechange: Simplify Station::train_station iteration when marking tiiles dirty. https://github.com/OpenTTD/OpenTTD/pull/13003
21:08:42 <peter1138> Rubidium: All those `int` → `TileIndexDiff` are worth having anyway?
21:10:14 <Rubidium> peter1138: definitely
21:17:16 *** keikoz has quit IRC (Ping timeout: 480 seconds)
21:20:45 <DorpsGek> [OpenTTD/OpenTTD] PeterN opened pull request #13004: Fix: ScriptTile::PlantTreeRectangle does not check that the end tile is in bounds. https://github.com/OpenTTD/OpenTTD/pull/13004
21:20:56 <peter1138> 🤷
21:25:03 <xarick> SetupFarmFieldFence
21:25:13 <xarick> TileIndexDiff diff = TileOffsByDiagDir(AxisToDiagDir(OtherAxis(DiagDirToAxis(side))));
21:25:13 <xarick> magic
21:30:27 <andythenorth[d]> was it nap time?
21:34:49 <andythenorth[d]> much enjoy, Goods cargo isn't Piece Goods class
21:34:53 <andythenorth[d]> definitely not confusing 🙂
21:35:50 <peter1138> Remember when renting TVs was a thing?
21:36:05 *** Borg has quit IRC (Quit: leaving)
21:36:28 <andythenorth[d]> yes
21:36:31 <andythenorth[d]> Radio Rentals
21:44:21 *** Wolf01 has quit IRC (Quit: Once again the world is quick to bury me.)
21:51:58 *** tokai|noir has joined #openttd
21:51:58 *** ChanServ sets mode: +v tokai|noir
21:52:56 <DorpsGek> [OpenTTD/OpenTTD] 2TallTyler approved pull request #13003: Codechange: Simplify Station::train_station iteration when marking tiiles dirty. https://github.com/OpenTTD/OpenTTD/pull/13003#pullrequestreview-2376378389
21:53:53 <xarick> tiiles
21:56:26 *** nielsm has quit IRC (Ping timeout: 480 seconds)
21:58:34 *** tokai has quit IRC (Ping timeout: 480 seconds)
21:59:25 <xarick> TileDiffXY removed!
22:01:08 <DorpsGek> [OpenTTD/OpenTTD] PeterN merged pull request #13003: Codechange: Simplify Station::train_station iteration when marking tiles dirty. https://github.com/OpenTTD/OpenTTD/pull/13003
22:02:21 <xarick> probably gonna assert somewhere <https://github.com/SamuXarick/OpenTTD/commit/b74c3090732e3aae5b6bba868b57277e39fdb94b>
22:04:05 <xarick> I see some places where over/underflow is expected... :p
22:04:09 <xarick> oh well
22:04:18 <xarick> okay bed time, cyas goodnight
22:37:36 *** Flygon has quit IRC (Read error: Connection reset by peer)