IRC logs for #openttd on OFTC at 2024-10-16
⏴ go to previous day
01:44:39 *** akimoto has joined #openttd
02:09:29 *** debdog has quit IRC (Ping timeout: 480 seconds)
02:10:02 *** akimoto has quit IRC (Remote host closed the connection)
02:28:44 *** Wormnest has quit IRC (Quit: Leaving)
02:52:06 *** gnu_jj_ has joined #openttd
02:55:34 *** gnu_jj has quit IRC (Ping timeout: 480 seconds)
03:06:59 *** D-HUND has quit IRC (Ping timeout: 480 seconds)
05:55:13 *** reldred has joined #openttd
05:55:19 <reldred> nearly home time though
05:57:42 <reldred> the question is, will i eat take out sushi for dinner for the *third* night in a row
05:58:03 <reldred> autistic eating patterns
05:58:05 <andythenorth[d]> it's a pattern
05:58:40 <andythenorth[d]> so the chances of changing the cargo class names in NML?
05:58:43 <andythenorth[d]> probably very low
05:58:50 <andythenorth[d]> nobody will want to approve that 😛
05:59:03 <andythenorth[d]> I guess I'll just write my own mapping in FIRS compile 😛
05:59:42 <andythenorth[d]> anml, vgtbl, mnrl
05:59:58 <reldred> why isn't my lte module here yet.
06:00:04 <reldred> i only ordered it from china yesterday
06:04:55 <andythenorth[d]> setting bit 14 for *every* FIRS non-food cargo eh?
06:05:22 <andythenorth[d]> that "Notes" column will be so...something
07:53:43 <reldred> I broke my tism eating streak, pizza place was doing $15 off if you spend $30
07:54:38 <reldred> so I've now got a half and half pizza I'll eat over the next two days (aspirational), a garlic bread, and a 1.25L coke zero that will sit in the fridge and never get drunk because I generally try and avoid caffeine after midday
08:02:03 <LordAro> office had a power outage at 1am and hasn't come back :(
08:02:54 *** Smedles has joined #openttd
08:16:26 <andythenorth[d]> hmm new vehicle prop, `required_cargo_classes`?
08:16:32 <andythenorth[d]> OR or AND though? 😛
08:19:52 <andythenorth[d]> if we're adding new bit definitions anyway
08:20:05 <andythenorth[d]> then what historical vehicles / cargos do is [whatever they do]
08:20:19 <andythenorth[d]> callback better than a prop, allows arbitrary predicates
08:20:26 <andythenorth[d]> but caching and stuff 😦
08:21:17 <andythenorth[d]> callback would make looky-likes easy
08:21:44 <andythenorth[d]> cargo is beans: vehicle refits [GRAI, MAIZ, WHEA] -> return refit allowed
08:21:56 <andythenorth[d]> as well as class stuff
08:23:37 <andythenorth[d]> oof, "someone" would abuse labels for "not-quite-classes"
08:24:02 <andythenorth[d]> like "LONG" for all long steel, lumber, logs
08:25:53 <peter1138> `usbhid 1-4.2:1.0: can't add hid device: -22` RIP keyboard 😦
08:28:19 <peter1138> Hmm, what happened to all the supplies of decent keyboards.
08:35:40 *** mindlesstux has joined #openttd
08:39:05 <ahyangyi> Are you sure it's not a problem in your USB port?
09:03:52 <peter1138> No, it's a problem with the absolutely tiny bit of tea that got spilt on the keyboard.
10:20:34 <xarick> how do you get Map::LogX() calculated if you only know the Map::SizeX()?
10:46:25 <xarick> i fail at making a lambda function
10:47:50 <ahyangyi> Google tells me `std::bit_width`
10:49:28 <LordAro> ahyangyi: luckily that's what we have ;)
10:57:20 <peter1138> For me the question should be answered with "why?"
10:59:20 <ahyangyi> In general I agree with you, but the need to calculate the integer log2 is so common that I don't bother asking why.
11:13:04 *** herms61 has quit IRC (Ping timeout: 480 seconds)
11:27:59 <kuhnovic> With Xarick "why" is usually a legit question 😉
11:36:36 <peter1138> Like, Map::LogX() exists, why would you need to calculate it.
11:52:52 <kuhnovic> Why on earth is `myDeque = {}` faster than `myDeque.clear()` ... (at least on windows it is)
11:53:36 <Borg> its not necessary faster. it just might that delay is elsewhere (GC) :)
11:56:00 <_jgr_> The implementations of deque vary quite a lot between the different compilers
11:56:35 <_jgr_> In general it's not something to use for high performance
11:57:21 <LordAro> ooh, clang does something very weird
11:57:27 <kuhnovic> Well, YAPF use it in the node list 😛 ...
11:57:48 <LordAro> it actually seems to get rid of the other function
12:04:49 <_jgr_> kuhnovic: YAPF is only using it as an allocator so it doesn't matter that much there
12:06:38 <kuhnovic> Allocator? It's using it to store the nodes in the node list, which is manipulated quite a bit. So it could definitely make a difference.
12:07:38 <kuhnovic> Yesterday I was looking into weather I can let YAPF use static storage instead of using large amounts of stack memory like it does now. I was doing some before-and-after performance comparison and noticed this.
12:08:54 <kuhnovic> Whipped up a quick google benchmark, seems to confirm what I saw in openttd. But again, Windows / MSVC, could be vastly different with other compilers.
12:10:19 <_jgr_> The deque is used to store nodes, but once they're allocated, lookups are done using the hash table and the deque isn't involved at all
12:12:28 <kuhnovic> Ah that's what you mean, yes that is true
12:14:30 <_jgr_> Is reserving static storage any better than using the stack?
12:16:02 <_jgr_> I don't think it uses so much that there's any risk of running out of stack
12:18:55 <kuhnovic> VS is showing me warmings about high stack usage by yapf
12:19:40 <kuhnovic> It's mainly the open and closed hashmaps in the nodelist IIRC
12:21:30 <_jgr_> Ah, I replaced those already in my branch. Might be a good excuse to use a better hash table implementation.
12:22:28 <kuhnovic> I tried to replace them with std::unordered_map at some point, but the performance difference was quite noticable (and not in a good way)
12:22:41 <kuhnovic> But there are of course many alternatives
12:22:58 <_jgr_> std unordered_map is not very good in general
12:24:18 <kuhnovic> The good thing about it is you get it out of the box, but that's about it:P
12:26:52 <kuhnovic> But I have found a way to let YAPF work with just one map instead of two, I want to explore that first. It's kind of pointless to keep both an open _and_ a closed list, because if a node is closed it will never be reopened. As long as your heuristic function is both admissible and consistent, but that's something we check for already.
12:39:40 <peter1138> deque would be nicer if you could specify the block size to be used.
12:42:15 <andythenorth[d]> was it lunch?
12:44:41 <andythenorth[d]> hmm if cargos had AND NOT
12:44:48 <andythenorth[d]> we could just have one bit for food grade
12:45:35 <andythenorth[d]> I suspect that making it even more complicated....would be wise?
12:46:35 <andythenorth[d]> we could have a new column in the wiki cargo page
12:46:38 <andythenorth[d]> and more notes
13:02:19 *** telk5093 has joined #openttd
13:14:12 <peter1138> We probably don't validate that the font name in the configuration is UTF-8.
13:18:24 <peter1138> Hmm, or we do. Invalid characters get converted to `?` for me.
13:25:28 <peter1138> Yeah, we knew at the time 🙂 Would've been fixed for 14.2 but we didn't do one.
13:26:03 <_glx_> I think the crash happens when filling survey data
13:26:36 <_glx_> since the same function is used to fill crashlog and "font": "crashed while gathering information"
13:29:30 <peter1138> Yeah, we don't due the TryExecute() stuff when filling the survey.
13:35:42 <_glx_> dump says it's during baseset scan
13:40:44 <peter1138> That's "one way" to get rid of `m_`-prefixed stuff 😉
13:41:18 <peter1138> (I have some patches that touch YAPF but this one was easily separated and not related any more)
13:56:10 <peter1138> This may be something that unique_ptr or shared_ptr can handle but that requires... deeper changes.
14:43:47 *** Wormnest has joined #openttd
15:22:24 <Borg> or Cargo types are absolutly completly broken for GRFver<7
15:22:56 *** herms61 has joined #openttd
15:25:19 <peter1138> What problem are you encountering?
15:25:35 <Borg> really I dont get why do I have to use TypeA in Cargo Opt callback
15:25:45 <peter1138> You shouldn't be using GRFver<7.
15:25:51 <Borg> I did RTFS.. and it looks I should NOT
15:26:02 <Borg> peter1138: yeah.. I will rewrite it to newer.. but not yet
15:26:17 <Borg> I did massive cleanup within last 3 days..
15:26:28 <peter1138> Don't waste your time.
15:26:37 <peter1138> Use a cargo translation table and be done.
15:26:49 <Borg> okey.. so its indeed broken?
15:26:52 <peter1138> I mean, don't waste your time making it work the old way. There's reasons new ways were made.
15:27:00 <_glx_> it's not broken, it's old
15:27:01 <peter1138> It's not broken, it's just very inflexible.
15:27:16 <Borg> peter1138: thats not the issue here for now..
15:27:39 <Borg> Pre-version 7 uses the 'climate dependent' ID in callbacks and properties, i.e. cargo is the cargo ID
15:27:42 <Borg> if (grffile->grf_version < 7 && !usebit) return cargo;
15:28:00 <peter1138> Honestly, don't use pre-version 7.
15:28:13 <Borg> usebit is false, called from newgrf.cpp
15:28:25 <Borg> peter1138: if I switch to grfv8 whole thing explode I guess
15:28:37 <Borg> I need to have it kinda working
15:28:41 <Borg> do commit.. and then keep rewritting
15:28:57 *** herms61 has quit IRC (Quit: Ping timeout (120 seconds))
15:29:04 <Borg> if I cant get the answer.. Ill fix it empiricaly.
15:29:14 <Borg> because I did switched to TypeA and it works now.. cargo is accepted
15:29:21 *** herms61 has joined #openttd
15:29:35 <Borg> but.. I dont really understand why..
15:31:17 <Borg> -- Cargos: Livestock + Wheat (or Fruit + Maize)
15:31:17 <Borg> ! * 02 0A 63 gb ci2 vs FF 03
15:31:29 <Borg> it should really work with just 04 and 06
15:31:41 <Borg> where that bloody OD comes from.. no clue
15:33:17 <Borg> accepts_cargo[] array in Industry is CargoID
15:33:29 <Borg> so its very basic ID from cargo_types.h
15:33:44 <Borg> this is passed to callback..
15:34:00 <peter1138> CargoID is translated
15:34:02 <Borg> because its climated depended
15:34:08 <peter1138> accepts_cargo is not climate dependent.
15:34:32 <Borg> now I need more RTFS :D for Action0 and Action3 cargo
15:35:03 <peter1138> I don't know what "gb ci2 vs" means though.
15:35:08 <peter1138> So I don't know what your action2 is doing.
15:35:37 <Borg> I made wrapper to not work directly on bytes in NFO :)
15:36:02 <Borg> grfix.rb generates .nfo from .src
15:36:16 <peter1138> Oh so you put extra layers on top, no wonder I don't know.
15:36:30 <Borg> yeah.. because w/o that .NFO is baarely managable
15:36:37 <Borg> w/ that layer.. you can read it pretty much directly
15:36:52 <Borg> just looking up variables.. global variables.. etc
15:36:53 <peter1138> Is there such a thing as a variadic action 2?
15:37:11 <Borg> hold on. I probably spelled it wrong
15:37:19 <peter1138> Variational is not Variadic.
15:37:52 <peter1138> But your layer is hiding what variable you are looking at.
15:38:35 <Borg> easier to remember gb vs 81 :)
15:38:45 <_glx_> variable is ci2 (callback info 2)
15:39:16 <Borg> I dont need to remember its 18... I know there are 2 callback info variables.. ci1 and ci2
15:39:24 <_glx_> we know them as var10 and var18 😉
15:39:27 <Borg> that constatly lookup up Global Variables
15:39:37 <Borg> oh :) if you have SO good memory.. cudos for you
15:40:00 <_glx_> and var0C for callback number
15:40:09 <peter1138> So are you implementing CBID_INDUSTRY_PROD_CHANGE_BUILD?
15:40:37 <peter1138> Oops, I meant CBID_INDUSTRY_INPUT_CARGO_TYPES
15:41:06 <Borg> peter1138: im implementing Callback 3D (Opt out of accepting cargo)
15:41:17 <Borg> and it works now correctly. when I used oD
15:41:21 <peter1138> In this case the return value is passed for translation and does not have usebit set.
15:41:42 <Borg> peter1138: I still cannot find place in code where CargoID is translated
15:41:51 <Borg> but nevermind.. it probably is because it works
15:41:56 <Borg> so now Im worried about this
15:42:17 <peter1138> Use grfv8 and a translation table and it just works.
15:42:35 <Borg> -- Properties for Cargos (custom rating calc)
15:42:35 <Borg> ! * 00 0B 01 0B 00 $cp*11
15:42:35 <Borg> -- Set callback for Cargos
15:42:36 <Borg> ! * 03 0B 0B 00 01 02 03 04 05 06 07 08 09 0A 00 CC 00
15:42:48 <Borg> peter1138: yeah. once it will work :) Ill move to grfv8
15:43:13 <Borg> but this part I will dig myself :) thanks
15:44:26 <peter1138> in master, the place in code where CargoID is translated is `industry_cmd.cpp:1888`
15:44:52 <peter1138> :1926 for output cargos.
15:44:57 <peter1138> Just for these callbacks that is.
15:45:28 <peter1138> For the static properties they are translated when loading.
15:45:36 <peter1138> But callbacks are more... runtime.
15:46:52 <Borg> yeah.. Ill focus on them first
15:53:46 <peter1138> As this is an industry set, is it defining cargos too?
15:59:25 <Borg> its BSPI grf.. Im just extending support for Arctic and Tropic
16:00:11 <Borg> static ChangeInfoResult CargoChangeInfo(uint cid, int numinfo, int prop, ByteReader *buf)
16:01:28 <Borg> hmm so cargo_type.h vs cargotype.h
16:06:36 *** gelignite has joined #openttd
16:07:10 <Borg> so it seems I should use always TypeA ID.. except few places for vehicles
16:08:24 <Borg> yep. Action 0 sorted out.. needs type A
16:10:05 <Borg> okey, lets apply fixes and test :)
16:56:02 <xarick> I can't reliably create this function, even though I want to force the current assumed behaviour from release TileAdd
16:56:02 <xarick> `inline TileIndexDiffC ToTileIndexDiffC(TileIndexDiff tid)
16:56:02 <xarick> /* how is TileAdd supposed to differentiate between -42,-80 and 22,-81? Both give you the same TileIndexDiff */
16:57:29 <xarick> seems that I'm missing something obvious
17:10:16 *** Wormnest has quit IRC (Ping timeout: 480 seconds)
17:48:39 <pickpacket> A 1024x1024 map is big... My Coleman Count airplanes take 290 days one way diagonally, at 475km/h
17:49:07 <pickpacket> That's a bit more than 3.3 million km
17:53:59 *** Wormnest has joined #openttd
18:00:23 <pickpacket> What's the circumference of the Earth?
18:02:17 <andythenorth[d]> so what am I doing about cargo classes? 😛
18:02:20 <andythenorth[d]> making dinner?
18:06:18 <ahyangyi> express dinner, refrigerated dinner, powderized dinner, oversized dinner or special dinner?
18:07:03 *** banhmarie has joined #openttd
18:11:13 <pickpacket> Rubidium: 40 million melons?
18:11:46 <ahyangyi> circumference of the earth is melons?
18:14:33 <Rubidium> pickpacket: no, 40 megameters
18:15:14 <Rubidium> why wouldn't I use the appropriate SI units and prefixes?
18:16:22 <wensimehrp> Dinner is cook child rice
18:17:46 <andythenorth[d]> so...can we automatically set cargo class bit 14 if bit 13 isn't set?
18:18:00 <andythenorth[d]> just really don't fancy the wiki cargo page update
18:18:10 <andythenorth[d]> the notes column is going to get evil
18:18:38 <andythenorth[d]> TBH....that whole page
18:22:57 <pickpacket> Rubidium: You never know on the internet! Anyone can be an American!
18:24:38 <pickpacket> 40 million metres... So 40,000 km. That's a little less than 3,306,000 km
18:31:07 <andythenorth[d]> does bananas parse grfs for the metadata about contents?
18:31:22 <andythenorth[d]> I did look in the repo, but maybe not correctly 😛
18:33:33 <peter1138> LordAro can cycle 3,306,000km in a year.
18:34:15 <andythenorth[d]> curious if we can just read all the known cargos and their classes
18:34:44 <pickpacket> peter1138: That'll get him from Wrindborough to Prudhattan. Or at least would if he was flying! Biking through all that terrain is most assuredly a much longer route
18:35:07 <peter1138> As long as there are bacon buttie stops along the way.
18:36:06 <pickpacket> We'll think and pray for that
18:36:44 <andythenorth[d]> looks like newgrf.py enumerates features and how often used
18:38:01 <peter1138> How does CHashTableT compare to unde
18:38:35 <peter1138> Hmm, "pop" looks a bit non-map-related.
18:43:35 <_jgr_> It's fairly easy to turn CHashTableT into a wrapper around a hash table type without changing its interface much
18:48:49 <peter1138> Personally I'd rather not leave an old wrapper lying around.
19:13:35 *** Wormnest has quit IRC (Ping timeout: 480 seconds)
19:19:07 <xarick> is this what I should be looking at?
19:19:47 <xarick> I'm in the rabbit hole
19:25:51 <andythenorth[d]> so did anyone write a full python newgrf reader? 😛
19:26:09 <andythenorth[d]> does grf-py do that?
19:26:36 <andythenorth[d]> we have all the relevant grfs on bananas 😛
19:40:45 <andythenorth[d]> I am kind of just at 'why?'
19:45:13 *** Wormnest has joined #openttd
19:54:16 <xarick> oh snap, add by diag dirs
19:55:02 *** Borg has quit IRC (Quit: leaving)
19:57:33 <xarick> yeah, I give up, i wasted 3 days on this TileAdd stuff and got nowhere yet
19:57:58 <andythenorth[d]> I spent 7 days on grf cargo classes xarick 🙂
19:58:03 <andythenorth[d]> for zero change so far
19:58:16 <andythenorth[d]> entertainment value: high
20:06:40 <xarick> static_cast<auto> doesn't work
20:15:46 <peter1138> Reimplementing all the game mechanics, sounds fun.
20:16:05 <peter1138> Or is Minecraft more client-side than I imagine...
20:17:10 <truebrain> Both. It is weird how much is done client-side, but the server also needs to replicate it
20:17:46 <truebrain> (I once wrote my own Python MC server, as, why not 😛 )
20:18:20 <peter1138> I wrote a Minecraft server in C, but that was in 2010 when it was the simple fixed world.
20:18:56 <johnfranklin> this server is about lunch, not dinner. as I was told.
20:21:48 <johnfranklin> no, 2010 was already infdev and alpha.
20:24:12 <peter1138> The old classic 0.30.
20:25:37 *** gelignite has quit IRC (Quit: Stay safe!)
20:46:54 *** HerzogDeXtEr has quit IRC (Read error: Connection reset by peer)
20:51:06 <xarick> binary '*': no global operator found which takes type 'TileIndex' (or there is no acceptable conversion)
21:03:12 <_glx_> xarick: yes you're not supposed to multiply TileIndex
21:03:39 <_glx_> that's why it's a StrongType, to prevent stupid stuff
21:14:08 <xarick> ``` TileIndexDiff diff = TileOffsByDiagDir(m_exitdir);
21:14:08 <xarick> diff *= m_tiles_skipped;
21:14:08 <xarick> m_new_tile += diff;```
21:16:06 <xarick> the TileAdd usage in IsNeighborRoadTile is funny
21:19:14 <andythenorth[d]> hmm train prop 0x29 is weird (non-refittable cargo classes)
21:19:36 <andythenorth[d]> 'non_refittable_cargo_classes" in NML
21:19:53 <andythenorth[d]> although maybe I have OCPD
21:20:03 <xarick> anyways, I can't get this part of the code to assert
21:20:17 <andythenorth[d]> I can omit classes from prop 0x29 list, and they'll still be non-refittable anyway
21:20:28 <andythenorth[d]> it's more like `disallowed_classes`
21:21:11 <andythenorth[d]> the prop for excluded labels is `cargo_disallow_refit` in NML
21:21:51 <andythenorth[d]> and 0x2D is `List of never refittable cargo types`
21:21:57 <peter1138> case 0x28: // Cargo classes allowed
21:21:57 <peter1138> _gted[e->index].cargo_allowed = buf.ReadWord();
21:22:09 <peter1138> case 0x29: // Cargo classes disallowed
21:22:09 <peter1138> _gted[e->index].cargo_disallowed = buf.ReadWord();
21:22:19 <andythenorth[d]> yeah ok, so the spec is misworded
21:22:32 <andythenorth[d]> src = actual spec
21:22:57 <xarick> guys, can I replace all instances of TileAdd(a, b) with a + b? To avoid the assert:)
21:23:14 <xarick> it's an unreliable assert
21:23:36 <xarick> and then remove TileAdd
21:28:07 *** Flygon has quit IRC (Read error: Connection reset by peer)
21:30:05 <xarick> shoot myself in the foot?
21:33:21 *** keikoz has quit IRC (Ping timeout: 480 seconds)
21:35:53 *** nielsm has quit IRC (Ping timeout: 480 seconds)
21:44:38 *** Wolf01 has quit IRC (Quit: Once again the world is quick to bury me.)
21:51:34 *** ChanServ sets mode: +v tokai
21:58:31 *** tokai|noir has quit IRC (Ping timeout: 480 seconds)
continue to next day ⏵