IRC logs for #openttd on OFTC at 2025-11-10
⏴ go to previous day
00:00:57 <xarick> why not _vals[i] = nullptr or something like that
00:17:03 <peter1138> The destructor is called because it's a reference-counted object. Destructing it reduces the counter. If it was just replaced by nullptr then the counter wouldn't get touched.
00:29:17 <_glx_> xarick: can't work, vargv is not real in squirrel2
00:34:51 <_glx_> but in squirrel3 it's valid
01:36:51 *** Flygon has quit IRC (Remote host closed the connection)
02:01:08 *** ChanServ sets mode: +v tokai
02:08:04 *** tokai|noir has quit IRC (Ping timeout: 480 seconds)
02:18:48 *** Wormnest has quit IRC (Quit: Leaving)
03:45:11 *** gnu_jj_ has joined #openttd
03:48:29 *** gnu_jj has quit IRC (Ping timeout: 480 seconds)
04:13:51 *** Beer has quit IRC (Quit: Leaving)
04:27:01 *** Zathras has joined #openttd
04:27:01 *** WormnestAndroid has quit IRC (Read error: Connection reset by peer)
04:27:02 *** WormnestAndroid has joined #openttd
04:28:20 *** Zathras_4 has joined #openttd
04:30:31 *** Zathras_11 has quit IRC (Ping timeout: 480 seconds)
04:41:13 <DorpsGek> - Update: Translations from eints (by translators)
05:55:17 *** jack_88271 has joined #openttd
07:01:50 *** WormnestAndroid has quit IRC (Remote host closed the connection)
07:01:56 *** WormnestAndroid has joined #openttd
07:06:23 <DorpsGek> - Add: summary for week 45 of 2025 (by OpenTTD Survey)
07:35:25 * andythenorth is hide_sprite in the spec
07:35:43 <andythenorth> or is it some nml construct?
07:39:16 <andythenorth> might be bit 0 in flags to advanced spritelayout
07:53:33 <andythenorth> if a tile isn't a water tile, what is it?
07:53:48 <andythenorth> 'ground' and 'terrain' are already keywords in use in my compile
08:00:22 <rito12_51026> andythenorth: dehydrated tile 😛
08:16:46 <andythenorth> hmm we don't have snow at tile height 1?
08:17:00 * andythenorth refactoring a complicated spritelayout with many conditionals
08:20:19 <rito12_51026> peter1138: It is still dropdown-item-as-button but the frame rect is drawn under the base items, as like in the DrawDropDownButton method.
08:20:19 <rito12_51026> Now the DropDownVRule class and aditional DropDownDivider aren't needed
08:24:25 <peter1138> Getting there, although spacing is a bit off.
08:27:52 <andythenorth> badges in advanced spritelayouts? 👀
08:27:59 <andythenorth> I have no idea "why?"
08:28:04 <andythenorth> just seems interesting
08:47:07 * andythenorth not sure, trying to figure it out
08:47:33 <andythenorth> it would be nice to show badge sprites on industry tiles, with some kind of extension of transparency settings
08:48:02 <andythenorth> to place them accurately, might need explicit handling in the spritelayout
08:52:40 <andythenorth> there's some old grf that has little icons on the tiles
09:06:19 <andythenorth> well, it might be better to split the spritelayouts for tiles built on land and tiles built on water
09:06:25 <andythenorth> and branch in the varact2 chain
09:07:18 <andythenorth> combining conditionals like 'is on water, and has snow' is too complicated
09:46:19 <LordAro> peter1138: wouldn't have it any other way though
09:48:16 <peter1138> If we were to draw badges on tiles in the viewport for some reason, we would definitely NOT want it to be controlled by the NewGRFs.
09:53:20 <andythenorth> seems it wasn't TTRS that had tile icons
09:54:25 <peter1138> Has a stickman on parks, for... reasons.
09:54:50 <peter1138> For buildings it has 3x5 pixel text, "CATHEDRAL", "FIRE", "HOSPITAL"
09:54:58 <locosage> badges in layouts kinda make sense
09:55:05 <locosage> like any kind of sprite reusal though
09:55:35 <peter1138> Badges are a GUI thing, not meant for the viewport.
09:56:00 <peter1138> If we were to include them in the viewport for a debug mode, or extra data mode, then it would be the game drawing them, and not require input from the NewGRF.
09:56:45 <locosage> logically viewport is part of gui too
09:58:56 <andythenorth> I looked down the rabbit hole of drawing them over ground sprite, but under building sprite
09:59:04 <andythenorth> hmm probably bad rabbits
09:59:25 <andythenorth> this is just idle nonsense, I'm not planning to add badges to FIRS tiles
10:00:02 <peter1138> Probably more useful is to show overlay cargo icons show acceptance/production.
10:00:59 <peter1138> Or if your industries have badges, display those.
10:01:06 <peter1138> Per tile is a bit much.
10:02:29 <locosage> yeah, acceptance/production icons per tile doesn't seem particularly convenient
10:03:04 <locosage> you know where it is though, on a minimap
10:05:29 <locosage> discord seems to be having trouble with an image for some reason
10:12:07 <andythenorth> some images missing for me also
10:12:42 <locosage> yeah, the last one should be working
10:16:15 <xarick> can we port vargv from squirrel 3 to openttd?
10:23:47 <peter1138> Judging from the comments last time, the example code was absolutely NOT something you should be trying to do.
10:26:38 <andythenorth> as far as I could tell, we're now trying to exploit specific Squirrel constructs to manually manage performance and memory in the OpenTTD client?
10:27:50 <andythenorth> will Horse compile faster if I learn how to micro-optimise python loops?
10:28:08 <andythenorth> in *some* languages, token length can be significant for performance
10:28:25 <andythenorth> should GS replace all token names with single characters?
10:31:46 <peter1138> xarick, the code example given was not given to you as an example to try. Do not bother.
10:35:41 <andythenorth> locosage: this is nice
10:35:46 <andythenorth> do you have a patchpack?
10:38:03 <locosage> that's citymania client ....
10:49:15 <rito12_51026> peter1138: Spaced out enough?
10:50:25 <peter1138> Rect coordinates are inclusive.
10:51:30 <peter1138> The buttons overlap horizontally, probably you are missing a -1.
10:51:57 <peter1138> E,g, `Rect.right` is Rect.left + width - 1.
10:51:57 <mmtunligit> ok so im installing the optional libraries that i never got around to the first time, and ive got almost all except for libcurl, would anyone know whic one fo these is the right package? i dont know which -dev is correct
10:52:02 <peter1138> E,g, `Rect.right` is `Rect.left + width - 1.`
10:52:27 <rito12_51026> no, they are included inside each other
10:52:40 <peter1138> rito12_51026, oh. Don't do that :)
10:53:23 <peter1138> Should be sort butto on the left, configure button on the right, and the sort type
10:53:45 <peter1138> Should be sort order button on the left, configure button on the right, and the sort type button filling in the remaining space.
10:55:54 <rito12_51026> uh, currently it is `DropDownCustomSelectedBGColour<DropDownAdditionalButton<DropDownIndent<DropDownString<DropDownIcon<DropDownAdditionalButton<DropDownSpacer<DropDownIcon<DropDownAdditionalButton<DropDownSpacer<DropDownListStringItem>>, true>, true, false>>>>>>>`
10:55:54 <rito12_51026> where the true is to draw at the end and false to make in narrower
10:59:51 <peter1138> At this point you probably want a single completely custom dropdown element, rather than trying to compose it from multiple parts.
11:00:16 <xarick> `list[item] = valuator_function.acall([this, item].extend(args));`
11:00:39 <xarick> i'm trying smart code, it's not working
11:01:17 <peter1138> xarick, do not even try it. You are not trying something that is going to help anything.
11:03:18 <xarick> extend doesn't return anything apparently
11:03:28 <peter1138> He's in write-only mode again.
11:07:36 <xarick> just attempting tricks to reduce opcodes
11:08:22 <peter1138> It was not a trick to reduce opcodes.
11:09:39 <xarick> I can't do better than this
11:10:47 <peter1138> mmtunligit, one of the libcurl4-.*-dev packages.
11:11:10 <mmtunligit> is there a meaningful difference between the flavors?
11:11:58 <peter1138> mmtunligit, it's kind of absurd that we get to choice which implementation...
11:12:35 <peter1138> Use the flavour that's installed already, I guess `dpkg -l | grep libcurl4`
11:13:19 <mmtunligit> ok, SSL it is than, thanks a bunch
11:57:17 <peter1138> rito12_51026, in fact, given the drop down window is only a window with some default logic, it may even be a better idea to implement a new custom dropdown window that has all the functionality as regular handlers, instead of hacking it into dropdown items.
12:00:09 <peter1138> (Not saying you should, but it could be done that way)
12:03:28 <rito12_51026> Fixed the buttons overlapping, so maybe not
12:08:41 <talltyler> (Just a rebase to fix the CodeQL action and pass CI)
12:11:44 <xarick> wondering if this will help getting rid of lists quicker
12:15:41 <kaji_kaede> Finally. Vibes-based code optimisation.
12:16:05 <peter1138> Instead of them just be destructed, you're now asking them to be cleared and reset to a usable state. And then destructed.
12:56:26 <andythenorth> maybe I should read about reference tracking
12:56:45 <andythenorth> is there not just some table of refs somewhere, and killing an object is just dropping the ref?
12:57:01 <andythenorth> and then if we're security minded, writing random data over that segment of memory?
12:57:20 * andythenorth imagines how computers works
13:07:56 <xarick> crap, i'm degrading my ssd for absolutely stupid tests
13:44:29 <xarick> floats are valid in squirrel
13:45:54 <_glx_> they are not valid for admin port
13:51:58 <xarick> i tried to make an optimization
13:52:09 <xarick> turned sorter_type into 1 byte
13:52:37 <xarick> class ScpirList 72 bytes -> 64 bytes
13:56:03 <xarick> > Your script made an error: parameter 1 has an invalid type 'bool'
13:56:03 <xarick> `list.Sort(AIList.SORT_BY_VALUE, AIList.SORT_ASCENDING);`
13:56:50 <LordAro> `enum SorterType : uint8_t` would be the better change
13:58:52 <xarick> nice it works! regression passes
14:00:55 <xarick> interesting, bool and uint8_t are both 1 byte
14:01:18 <_glx_> bool might be 1 byte on your platform
14:02:45 <_glx_> `bool — integer type, capable of holding one of the two values: true or false. The value of sizeof(bool) is implementation defined and might differ from 1. `
14:04:27 <peter1138> I left all script enum types as default in case of special script funkiness.
14:05:16 <peter1138> Or rather, "didn't touch them" when I did touch most other enum types.
14:05:46 <_glx_> yeah squirrel export script can be touchy
14:05:56 <peter1138> Sometimes they are almost the same as the native ones, and then they also have a magic -1, so it needs to be signed.
14:06:58 <_glx_> inside squirrel every number is SQInteger so int64_t
14:07:51 <xarick> int8_t also passed regression test
14:19:49 <_glx_> oh of course regression was failing with `: bool` ```Your script made an error: parameter 1 has an invalid type 'bool'
14:19:49 <_glx_> *FUNCTION [TestInit()] regression/main.nut line [65]
14:19:49 <_glx_> *FUNCTION [Start()] regression/main.nut line [2077]
14:21:14 <_glx_> all enums are considered integer when exporting
14:25:20 <jfkuayue> can not != cannot = can't
14:25:20 <jfkuayue> may not (this may not happen) != may not (you may not do this)
14:27:20 <_glx_> but the constants exported from enums are bool in case of `: bool`, while the functions using enum as parameter expect integer
14:28:53 <_jgr_> A bool does not logically make sense, even though there are currently only two values
14:56:38 *** toktik is now known as Guest30855
14:59:58 *** Guest30855 has quit IRC (Remote host closed the connection)
15:03:20 <LordAro> peter1138: and how well do you speak Portuguese? :p
15:03:36 <LordAro> wait, there's an extra u in there
15:03:54 <peter1138> I've lost it all since I went there a decade ago.
15:14:32 <peter1138> But actually, is that the call that erases everything in your lists?
15:15:59 <xarick> it erases all lists, and then clones new ones from the master array
15:16:08 <xarick> which have all items with value = 0
15:16:32 <xarick> valuate sets the value to whatever
15:19:43 <xarick> i'm trying to figure out where Valuate begins
15:20:43 <xarick> but with a hidden embedded squirrel code, it's harder for me to follow
15:26:51 *** kuka_lie has joined #openttd
15:33:42 *** toktik is now known as Guest30858
15:33:54 *** tokai has quit IRC (Ping timeout: 480 seconds)
15:36:32 *** Guest30858 has quit IRC (Remote host closed the connection)
15:38:48 *** ChanServ sets mode: +v tokai
15:54:47 *** yiffgirl has joined #openttd
15:54:47 <yiffgirl> peter1138: saw this on the developer updates channel and had a minor coughing fit from laughter lmao
15:55:11 <xarick> `SQOpsLimiter limiter(vm, _settings_game.script.script_max_opcode_till_suspend, "valuator function");` this cheat worked
15:56:38 <xarick> valuating the same number of items as it reset counterpart
15:57:08 <yiffgirl> peter1138: oh whoops sorry, forgot about the irc bridge again. it's "JP+ is pretty bad."
15:57:27 <peter1138> Ah... my lack of sugar-coating...
15:58:35 <xarick> im still wondering if there's a way to ruin it with custom valuator functions
15:58:58 <xarick> ie: valuate more items than reset
16:01:02 <xarick> hmm i see this might pose a problem
16:01:54 <xarick> while (true) list.Valuate(valuator_function); it would lock openttd
16:03:34 <_glx_> only the script is stuck, but openttd is not affected
16:04:40 <_glx_> and if the while(true) is inside a valuator the script is killed
16:06:10 <xarick> i don't think it would ever suspend, brb
16:08:40 <xarick> well neps, it worked apparently
16:11:33 <xarick> trying to simulate random varied work in the custom valuator
16:11:33 <xarick> ```function CustomValuatorFunction(item, instance)
16:11:33 <xarick> for (local i = 0; i < GSBase.RandRange(instance.valuate_counter));
16:11:33 <xarick> return instance.valuate_counter++;
16:14:13 <xarick> oops, this still happens lol
16:16:19 <_glx_> that's the main reason for SQOpLimiter
16:16:23 <peter1138> Loop conditions with side-effects, mmm.
16:16:42 <jfkuayue> je-pi-purasu izu puretthi baddo.
16:26:55 *** toktik is now known as Guest30860
16:29:53 *** Guest30860 has quit IRC (Remote host closed the connection)
16:33:47 *** Wormnest has joined #openttd
16:35:35 *** toktik is now known as Guest30862
16:42:56 *** Guest30862 has quit IRC (Ping timeout: 480 seconds)
16:47:03 *** toktik is now known as Guest30863
16:48:14 *** toktik is now known as Guest30864
16:49:39 *** Guest30863 has quit IRC (Remote host closed the connection)
16:50:40 *** Guest30864 has quit IRC (Remote host closed the connection)
16:51:36 <goddess_ishtar> it's always lunch somewhere
17:16:22 <xarick> i overestimated the amount of work
17:17:10 <xarick> valuate_counter can go up to 49 million in the case of 10000 lists
17:20:54 <xarick> `for (local i = 1; i < GSBase.RandRange(instance.valuate_counter); i = i << 1);`
17:23:16 <peter1138> Don't forget you are giving it a new random value for every iteration of the loop.
17:31:08 <xarick> now i dont think i'm giving enough amount of work that it can't be complete under 500/250000 ops
17:33:18 *** toktik is now known as Guest30867
17:35:38 *** Guest30867 has quit IRC (Remote host closed the connection)
17:43:14 <rito12_51026> peter1138: I think I'll change my mind, because badge filter dropdowns are already implemented as buttons for other windows and reimplementing them as dropdown items seems a bit pointless
17:44:59 <Borg> you can move it to the back if you want :)
17:45:29 <Borg> cloning works properly too.. :) I added check if train being cloned have rear engine directly after front or not..
17:45:48 <Borg> only 2 positions allowed for dualhead trains.. either right behind front loco.. or at end of train
17:47:26 <peter1138> I can't remember what problems were solved by the current restrictions...
17:51:16 <xarick> excessive cpu with 500 ops, but not with 250000 ops...
17:53:16 *** Wormnest has quit IRC (Ping timeout: 480 seconds)
17:55:54 <xarick> clearly I don't understand how all this works
17:59:01 <_glx_> excessive cpu with 500 ops, means a single valutation needs more than 500 ops
18:00:11 <_glx_> so it tries to valuate first item, fails, goes to sleep, retries first item, fails again, sees it was the same item as previous try, kills the script
18:01:39 <_glx_> that is when using suspendable PR
18:03:11 <xarick> this seems to work for some reason
18:03:41 <xarick> but it seems to iterate all items without repetition
18:05:40 <_glx_> but the tick itself will take between 500 and 1000 ops on first call
18:06:09 <_glx_> (if the max opcode is 500)
18:07:57 <xarick> it's cheating... i know
18:08:31 <_glx_> and it won't prevent repetition if the list is too big to be fully valuated in one call
18:09:07 <xarick> hmm how big must it be?
18:09:35 <_glx_> depends on the limit and the valuator
18:09:37 <xarick> my biggest list has 4472 items
18:10:08 <_glx_> for native valuators it's 5 ops per item
18:10:16 *** WormnestAndroid has quit IRC (Ping timeout: 480 seconds)
18:10:42 *** WormnestAndroid has joined #openttd
18:11:15 <xarick> let me try 100000 items
18:12:38 <xarick> oh... need to do special coding
18:23:50 <xarick> i must be doing something wrong
18:31:27 *** toktik has quit IRC (Remote host closed the connection)
18:34:09 *** toktik is now known as Guest30874
18:36:00 *** Guest30874 has quit IRC (Remote host closed the connection)
18:37:24 <peter1138> yiffgirl, btw, for me it's just an overwhelming and seemingly random list of different types.
18:45:53 <xarick> i pushed the valuator function to the limit
18:46:17 <xarick> 49999 would get excess cpu
18:46:33 <xarick> 49998 still do all the items without repeating
18:48:50 <xarick> the only question I have though... is it fair?
18:49:44 *** toktik is now known as Guest30876
18:52:13 *** Guest30876 has quit IRC (Remote host closed the connection)
18:59:50 <xarick> let me verify regression
19:02:13 <xarick> no more mismatching rand values
19:22:10 *** toktik is now known as Guest30879
19:29:51 *** Guest30879 has quit IRC (Ping timeout: 480 seconds)
19:30:30 *** toktik is now known as Guest30880
19:33:27 *** Guest30880 has quit IRC (Remote host closed the connection)
19:40:44 *** toktik has quit IRC (Remote host closed the connection)
20:08:07 <xarick> I just discovered `overdrawn_ops`
20:17:30 <_glx_> yes it's used, it's mainly for constructors and Valuate exceeding the allowed ops
20:28:06 *** toktik is now known as Guest30884
20:30:17 *** toktik is now known as Guest30885
20:30:50 <peter1138> Though I should look at the alignment thing.
20:31:06 *** Guest30884 has quit IRC (Remote host closed the connection)
20:37:46 *** Guest30885 has quit IRC (Ping timeout: 480 seconds)
20:37:47 *** WormnestAndroid has quit IRC (Read error: Connection reset by peer)
20:39:18 *** WormnestAndroid has joined #openttd
20:39:47 *** Wormnest has joined #openttd
20:44:27 <peter1138> TIL that the voice behind Leela is 71... although I guess it's been going long enough that she was only 45 at the start.
20:48:27 <rito12_51026> peter1138: It even looks better when it's done as regular handlers, instead of hacking it into dropdown items
20:50:31 <andythenorth> at some point...a window 😛
20:50:37 <andythenorth> which closes after selection, like bridges 😛
20:55:08 <peter1138> Okay, I see the problem with the existing list.
20:55:21 <peter1138> Probably won't matter than with rito12_51026's stuff, but I'll fix it anyway.
21:00:02 <peter1138> Oh, that's kinda unrelated :o
21:03:54 *** toktik has quit IRC (Remote host closed the connection)
21:05:25 *** Borg has quit IRC (Quit: leaving)
21:10:00 <peter1138> Those 14766 is required for 14768 to not crash, I guess.
21:34:27 *** toktik is now known as Guest30893
21:42:01 *** Guest30893 has quit IRC (Ping timeout: 480 seconds)
21:44:21 *** toktik is now known as Guest30894
21:49:54 *** toktik is now known as Guest30895
21:51:42 *** Guest30894 has quit IRC (Ping timeout: 480 seconds)
21:55:41 *** keikoz has quit IRC (Ping timeout: 480 seconds)
21:57:11 *** Guest30895 has quit IRC (Ping timeout: 480 seconds)
21:59:06 *** kuka_lie has quit IRC (Ping timeout: 480 seconds)
22:24:32 *** Wolf01 has quit IRC (Quit: Once again the world is quick to bury me.)
22:39:00 *** keoz has quit IRC (Ping timeout: 480 seconds)
22:43:00 *** toktik is now known as Guest30897
22:44:11 <xarick> I made a thing, but not sure I did it well
22:46:58 *** Guest30897 has quit IRC (Remote host closed the connection)
23:07:38 <_glx_> scripts can already read the setting via `[AI|GS]GameSettings.GetValue("script.script_max_opcode_till_suspend")` and only the player must change it
23:08:32 <_glx_> limit would be useless if scripts are allowed to touch it
23:49:51 *** Beer has quit IRC (Quit: Leaving)
continue to next day ⏵