IRC logs for #openttd on OFTC at 2019-03-27
⏴ go to previous day
00:00:08 <peter1138> Then we don't care.
00:00:16 <peter1138> debug == not optimized.
00:01:23 <Eddi|zuHause> drac_boy: the "standard" scheme always allowed for extensions
00:02:03 <peter1138> If there's a performance regression in release build, then we can discuss it.
00:02:20 <Samu> do I create a PR? I guess not
00:02:26 <Samu> will leave it to m3henry
00:02:51 <peter1138> 22:45 <@LordAro> Samu: you can pull request that change, if you like
00:03:57 *** Gustavo6046 has joined #openttd
00:04:06 <Samu> it will be fixed in another manner, from what I could gather, so pointless
00:04:45 <LordAro> but that might take some time
00:04:55 <peter1138> LordAro, better do it ourselves... this one's being awkward.
00:05:10 <peter1138> But I'm going to bed.
00:15:30 *** Gustavo6046 has joined #openttd
00:58:23 <Samu> im doing a small experiment
00:58:45 <Samu> AIs in 1.8.0 seem to fastforward faster
00:59:19 <DorpsGek_II> [OpenTTD/OpenTTD] LordAro opened pull request #7422: Fix #7421: Don't (directly) dereference std::vector::end() in SmallMap https://git.io/fjUin
01:00:24 <drac_boy> sorry was a little busy .. but hmm .. I guess that makes sense but I still don't see why he shouldn't just use the letter N instead .. oh well its his own grf so meh :)
01:29:44 *** tokai|noir has joined #openttd
01:29:44 *** ChanServ sets mode: +v tokai|noir
01:40:13 *** Smedles has joined #openttd
01:41:04 *** Wormnest has joined #openttd
01:42:01 <Samu> ScriptTile::GetCargoProduction is the slowest function of all that valuator
01:42:09 <Samu> the most important one, the one that actually matters
01:44:04 <Samu> Orthogonal tile area intersects...
01:49:22 *** Smedles has joined #openttd
02:08:57 <Eddi|zuHause> there defintely were animals, in FIRS, maybe also ECS
02:09:22 <Eddi|zuHause> also, ISR stations
02:09:37 <Samu> OthogonalTileArea::Intersects is slow, plz buff
02:11:05 <utack> thank you Eddi|zuHause i will see!
02:12:07 *** Thedarkb-X40 has joined #openttd
02:13:15 <Samu> maybe I shouldn't use intercontinental airports :|
02:14:26 <utack> Eddi|zuHause you were right, there is a duck and a chicken at least :)
02:23:35 <Samu> this area intersection is ... intersecting with industries tile area
02:23:38 <Samu> for all industries... omg
02:24:02 <Samu> and I'm making airports in towns, even
02:24:17 <Samu> but it has to loop over all industries, for some reason
02:25:06 <Samu> line 529 station_cmd.cpp
02:26:46 <Samu> so, if I create a map with no industries, I am expecting this to be faster, let me try
02:37:33 <Samu> GetNearestTown is now the new 66%
02:44:02 <Samu> wasn't kdtree implemented?
02:55:34 <Samu> who was the kdtree implementer?
03:13:31 *** Supercheese has joined #openttd
04:18:01 *** Supercheese has joined #openttd
05:40:53 *** Saqeram[m] has joined #openttd
05:55:20 *** Maarten has joined #openttd
06:09:18 <cHawk> longtime lurker, early player of Transport Tycoon for dos. OpenTTD has done an amazing job. I love you guys!
06:10:39 <Samu> Im off to bed, good night
06:57:35 <DorpsGek_II> [OpenTTD/OpenTTD] PeterN approved pull request #7422: Fix #7421: Don't (directly) dereference std::vector::end() in SmallMap https://git.io/fjUMz
07:04:02 <peter1138> Queued. I'm sure it's not.
07:10:43 <peter1138> 01:25 < Samu> line 529 station_cmd.cpp
07:18:10 <peter1138> Hmm, do we have non-square airports?
07:31:52 <DorpsGek_II> [OpenTTD/OpenTTD] PeterN merged pull request #7422: Fix #7421: Don't (directly) dereference std::vector::end() in SmallMap https://git.io/fjUin
07:31:58 <DorpsGek_II> [OpenTTD/OpenTTD] PeterN closed issue #7421: Can't dereference value-initialized vector iterator https://git.io/fjUKS
07:58:51 <DorpsGek_II> [OpenTTD/OpenTTD] PeterN closed issue #6189: Vehicle Groups: parent group should count total number of vehicles in subgroups https://git.io/fjUDJ
07:58:52 <DorpsGek_II> [OpenTTD/OpenTTD] PeterN closed issue #5977: Vehicle Groups: improve error message when group hierarchy fails https://git.io/fjUDU
08:41:00 *** kiwitree has joined #openttd
08:50:26 *** andythenorth has joined #openttd
08:55:01 <andythenorth> is it lunch time?
08:57:04 <planetmaker> drive time or trip time... see ya Friday :)
09:01:11 <DorpsGek_II> [OpenTTD/OpenTTD] PeterN requested changes for pull request #7424: Add: Kdtree for AirportGetNearestTown https://git.io/fjUDz
09:04:16 *** HerzogDeXtEr has joined #openttd
09:35:47 <DorpsGek_II> [OpenTTD/OpenTTD] JGRennison commented on issue #6618: Incorrect size bounds checks in vehicle viewport hash scan in ViewportAddVehicles https://git.io/fjUyI
09:53:39 <DorpsGek_II> [OpenTTD/OpenTTD] JGRennison commented on pull request #7366: Add: List recently executed commands in crashlog output. https://git.io/fjUy2
12:10:08 *** gelignite has joined #openttd
13:07:12 *** sla_ro|master has joined #openttd
13:33:45 <Samu> I found the big reason why my AI was stutterfesting
13:34:00 <Samu> it's on line 529 station_cmd.cpp
13:35:24 <Samu> the 2nd big reason was getting Airport Noise
13:35:39 <Samu> and I created a PR for that, the kdtree thing
13:36:16 <peter1138> Yes, I responded to that.
13:36:44 <Samu> can you take a look on cargo production around industries for me? :p
13:52:32 <DorpsGek_II> [OpenTTD/OpenTTD] SamuXarick commented on pull request #7424: Add: Kdtree for AirportGetNearestTown https://git.io/fjU7y
13:55:28 <Samu> uhm, okay, I failed at explaining
13:59:57 <DorpsGek_II> [OpenTTD/OpenTTD] SamuXarick commented on pull request #7424: Add: Kdtree for AirportGetNearestTown https://git.io/fjU5L
14:17:32 <Samu> how do I make heliports so noisy so noisy that I can't place them in the smallest town ever?
14:20:04 <Samu> i meant the biggest town ever
14:21:27 <Samu> ugh, looks like I can't assert, grr
14:27:37 <Samu> assert(AirportGetNearestTownForAllTowns(as, it) == AirportGetNearestTownKdTree(as, it));
14:30:27 <Samu> 65535 ought to be enough noise
14:34:27 <Samu> damn towns always have a min noise of 3
14:34:42 <Samu> heliports always getting away with i
14:36:32 <Samu> for some reason, I can't assert(t != NULL);
14:36:57 <Samu> so i made it into a continue
14:41:42 <Samu> I notice const AirportSpec *as isn't used anymore
14:59:05 <peter1138> I... hadn't noticed that either :p
15:00:34 <Samu> well, it didn't assert anymore, so...
15:03:36 <Samu> oh, as to why it prefers town with lowest index
15:03:51 <Samu> it's so that it could match assert(AirportGetNearestTownForAllTowns(as, it) == AirportGetNearestTownKdTree(as, it));
15:04:00 <Samu> but that's a bad comment
15:04:15 <peter1138> I know why it prefers lowest index.
15:04:33 <peter1138> Do you know why it prefers lowest index?
15:05:49 <Samu> because the old method also preferred it
15:06:00 <peter1138> Why did the old method prefer it?
15:07:07 <Samu> because it was iterating from the lowest index to highest index?
15:11:53 <peter1138> So focus your behaviour comment on that, not some meaningless "assert foo == bar"
15:19:23 <Pikka> aww, simyoulater didn't appreciate my "iron vole" title
15:24:02 <peter1138> Oh the split-topic thing.
15:25:14 *** andythenorth has joined #openttd
15:33:48 <Samu> i dont know how to comment this
15:35:00 <peter1138> Let's see what monstrosity you came up with.
15:35:34 <DorpsGek_II> [OpenTTD/OpenTTD] SamuXarick commented on pull request #7424: Add: Kdtree for AirportGetNearestTown https://git.io/fjUFp
15:37:34 *** Wormnest has joined #openttd
15:43:55 <peter1138> Oh. You know what...
15:43:59 <peter1138> Noise level isn't saved anyway.
15:44:09 <peter1138> So you really don't need to replicate that behaviour.
15:47:18 <Samu> im trying to figure out why t can be NULL at times
16:01:37 <Samu> does the iterator really need to be copied?
16:04:57 <Eddi|zuHause> if i want to introduce the dreaded R-word to the discussion: sometimes a big city's demands for airports should allow to override the noise level requirement for a small nearby town
16:05:43 <peter1138> Samu, currently yes, because it's used again.
16:07:03 <peter1138> Eddi|zuHause, sure, but this change is meant to be just an optimization, not a feature change.
16:07:22 <Eddi|zuHause> when did that ever stop me? :p
16:08:58 <Samu> it was already described after all that it would prefer the lowest index
16:09:17 <peter1138> Hmm, I didn't notice that comment :p
16:09:23 <peter1138> Well, maybe you should keep the behaviour.
16:09:39 <peter1138> Just drop that last commit.
16:09:54 <Samu> still need to remove the @param as
16:09:59 <peter1138> And yeah, if it already says "town with lower index is returned" then don't worry about the comment.
16:10:26 <peter1138> What's the performance benefit you saw?
16:10:34 <peter1138> (Hard figures, not relative, please)
16:12:22 <Samu> with industries and valuators.... about 15 ms avg
16:12:36 <Samu> with industries... about 8 ms
16:12:55 <Samu> without industries... 2 ms
16:13:24 <Samu> without industries and that fix in the code... 1 ms
16:14:44 <Samu> FOR_ALL_INDUSTRIES is my next target
16:16:24 <peter1138> I mean the performance benefit of that chance.
16:16:26 <Samu> I tested using my own AI
16:17:24 <Samu> will try with TIC TOC thing, maybe?
16:18:03 <peter1138> With 12000 towns or so?
16:18:36 <peter1138> Industries don't affect AirportGetNearestTown
16:19:07 <Samu> forgot you don't care about that
16:19:34 <LordAro> there's no way measurements of <5ms are stable enough to draw any conclusions from
16:19:40 <Samu> Get Cargo Production around tiles iterates over all industries, the main stutter cause
16:19:47 <LordAro> unless you're measuring them hundreds (or better, thousands) of times
16:20:50 <peter1138> Samu, I can improve that easily, if you want to wait.
16:21:13 <_dp_> is there a way to make mouse feel the same in fullscreen as in windowed with sdl driver?
16:21:27 <_dp_> I used SDL_MOUSE_RELATIVE=0 but it seems broken now :(
16:22:31 <peter1138> Samu, update that existing PR and I've got another (minor) improvement to PR.
16:22:55 <Samu> speaking of mouse, yesterday I had a weird mass popups about an assert related to mouse cursor
16:23:31 <Samu> it felt like I was visiting a broken site
16:23:32 <peter1138> I never bothered optimising GetProductionAroundTiles because it was a GUI-only thing, but I guess as the AI uses it as well, that matters.
16:24:10 <Samu> always poping up error windows
16:24:30 <Samu> had to kill visual studio in the task manager
16:56:38 <peter1138> Yeah? Don't bother :p
17:00:20 <Samu> hah, it's actually slower on smaller maps
17:04:43 <Samu> 4096x4096, about 12k towns, no industries
17:04:53 <Samu> and no valuators on thos
17:07:26 <peter1138> Slower on smaller maps often means "unnoticable is still unnoticable"
17:14:11 <Samu> voronoi would be faster, right?
17:16:10 <peter1138> Well, how much slower are you talking?
17:24:00 *** synchris has joined #openttd
17:25:41 *** Progman has joined #openttd
17:32:48 <Samu> brb, let me put a small map
17:37:17 <Samu> gonna try the average 256 x 256 or 256 x 512
17:42:01 <peter1138> Yeah but doing what?
17:45:05 <Samu> iterating over ... uhm,, wait, i better upload v10
17:46:22 <peter1138> Yes. That's just a map size. What are you actually DOING.
17:47:03 <_dp_> communicating with Samu is slower than ever for sure xD
17:47:18 <peter1138> It's bizarre isn't it?
17:52:18 <Samu> then line 955 or line 956, it's one of them, is the 2nd lowest, the case we're testing here
17:53:00 <Samu> there are no industries on these tests, i'm testing on maps without them
17:56:06 <Samu> up to below 2048x2048 the kdtree is slower, past 2048x2048, it is faster
17:56:17 <Eddi|zuHause> <_dp_> is there a way to make mouse feel the same in fullscreen as in windowed with sdl driver? <-- what do you mean?
17:56:19 <peter1138> That doesn't make sense.
17:56:42 <peter1138> Map size is not particularly relevant, but number of towns is.
17:56:46 *** Supercheese has joined #openttd
17:57:01 <DorpsGek> Samu: Error: invalid syntax (<string>, line 1)
17:57:46 <_dp_> Eddi|zuHause, when I switch to fullscreen mouse gets much slower, feels very awkward :(
17:58:07 <Eddi|zuHause> slower as in acceleration?
17:58:16 <Eddi|zuHause> or drawing of the pointer is choppy?
17:58:30 <_dp_> Eddi|zuHause, moves slower
18:00:02 <_dp_> Eddi|zuHause, SDL_MOUSE_RELATIVE=0 helps but it seems to interfere with gnome somehow
18:00:06 <Samu> and then the glorious 4096x4096 result with the most relevant gains
18:00:09 <Eddi|zuHause> resolution change?
18:03:05 <Samu> i really should stop testing stuff in 4k maps first
18:03:15 <Samu> it was the first thing I did
18:03:49 <_dp_> Eddi|zuHause, same on any resolution
18:03:57 <_dp_> Eddi|zuHause, it's a gnome issue I guess
18:04:19 <Eddi|zuHause> yeah, i'd look in gnome settings
18:04:20 <_dp_> Eddi|zuHause, seems to intercept mouse events as if there is top panel and dock
18:04:50 <Eddi|zuHause> i don't use gnome, so i can't help you there
18:06:40 <DorpsGek_II> [OpenTTD/OpenTTD] SamuXarick commented on pull request #7424: Add: Kdtree for AirportGetNearestTown https://git.io/fjUhE
18:07:49 *** HerzogDeXtEr has joined #openttd
18:08:11 <DorpsGek_II> [OpenTTD/OpenTTD] nielsmh commented on pull request #7424: Add: Kdtree for AirportGetNearestTown https://git.io/fjUhz
18:15:22 <Samu> you mean the borders nielsm ?
18:16:35 <nielsm> I mean instead of calculating nearest town to 100 tiles and taking the lowest distance, just calculate nearest town the the one single tile in the center of the airport area
18:16:42 <nielsm> it's 100 times less work
18:16:58 <nielsm> (assuming a 10x10 tile airport size)
18:18:14 <Samu> i was thinking about something similar, but for the perimeter tiles
18:18:15 <Eddi|zuHause> that would allow large airports in a lot more places, i think
18:18:27 <_dp_> ok, installing nvidia drivers fixed the mouse issue
18:18:34 <_dp_> I forgot it's using nouveau by default
18:18:49 <nielsm> yeah searching just the corner tiles of the tile area bounding box could be another option perhaps?
18:19:27 <Eddi|zuHause> non-rectangular areas might not have a "corner"?
18:19:35 <nielsm> but at least the interior tile should not be relevant, unless you're demolishing an entire town centre and replacing the entire town with airport
18:19:56 <nielsm> Eddi|zuHause: hence why I said tile area _bounding box_
18:20:38 <Eddi|zuHause> that sounds like a step backwards
18:20:41 <_dp_> or it didn't... weird, seemed fine at first :p
18:22:03 <Eddi|zuHause> _dp_: just a random thing: does enabling/disabling "full animation" change anything?
18:23:56 <Eddi|zuHause> nielsm: if we ever get around to adding state machines, i would expact such things to appear
18:25:36 <Eddi|zuHause> nielsm: but i'd be primarily worried about things like diagonal airports, where the "bounding box corners" are really far away from the actual airport
18:27:23 <Eddi|zuHause> nielsm: i know we joked a lot about "vision" lately, but that's exactly the point where you need a vision to not introduce these arbitrary limitations
18:30:29 <nielsm> otherwise, keep the original algorithm, but limit the number of towns considered to those inside a bounding box of candidates
18:30:54 <nielsm> isn't there a strict limit to the distance to town sign where airport noise is considered?
18:31:19 <Eddi|zuHause> not that i know of
18:31:39 <_dp_> Eddi|zuHause, weird stuff, sometimes it's broken sometimes it's fine, and sometimes it switches to wrong resolution %)
18:34:42 <peter1138> Samu, so, are you using a debug build by any chance?
18:35:08 <Samu> no, those tests were on release x64
18:39:09 <Samu> there is a DiagonalTileIterator in the code
18:41:58 <peter1138> Urgh, regression fail :/
18:42:16 <peter1138> Now, is that because my test it wrong now, or wrong before?
18:42:30 <_dp_> btw, getting closest town for each tile in area can be done significantly faster than just querying k-d tree for each tile independently
18:44:37 *** supermop_work has joined #openttd
18:49:39 <Eddi|zuHause> yeah, i imagine if you know the bucket for one tile, you can quickly check if the neighbouring tile is in the same bucket
18:50:00 <peter1138> Ok, regression fails because it was wrong before :p
18:50:45 <Eddi|zuHause> "just because you've done something for years, doesn't mean you've been doing it correctly"
18:51:26 <peter1138> That means this codechange: becomes a fix:
18:56:12 *** andythenorth has joined #openttd
19:05:18 *** supermop_work_ has joined #openttd
19:06:34 <nielsm> Eddi|zuHause: basically the same pattern as the other four types of viewport signs
19:08:08 <Eddi|zuHause> nielsm: since it's not actually my patch, i was a bit lost on trying to decipher that stuff
19:10:44 <Samu> im experimenting the perimeter stuff
19:10:46 <Samu> if (IsInsideMM(TileX(cur_tile), TileX(it), TileX(it + delta_x) + 1) || IsInsideMM(TileY(cur_tile), TileY(it), TileY(it + delta_y) + 1)) {
19:10:57 <Samu> don't know if this is the correct checking
19:11:11 *** supermop_work__ has joined #openttd
19:12:43 *** supermop_work has joined #openttd
19:14:00 <Samu> how do i get the max X and max Y allowed?
19:18:12 *** supermop_work_ has quit IRC
19:18:43 <Samu> TileX(min(it + delta_x, MapMaxX())) + 1)
19:20:12 *** supermop_work__ has quit IRC
19:21:07 <peter1138> I have a Samu problem.
19:21:16 <peter1138> I can't come up with a nice concise commit message.
19:21:45 <Samu> oh you're asking to a terrible person for that
19:22:39 *** supermop_work_ has joined #openttd
19:25:25 <peter1138> This is a fix from your comment last night.
19:25:51 <peter1138> 01:25 < Samu> line 529 station_cmd.cpp
19:26:08 <DorpsGek_II> [OpenTTD/OpenTTD] PeterN opened pull request #7426: Fix: Incorrect display of industry production around tiles. https://git.io/fjUj9
19:26:40 *** supermop_work__ has joined #openttd
19:29:37 *** supermop_work has joined #openttd
19:31:30 <peter1138> Samu, so that might be quicker.
19:33:12 *** supermop_work_ has quit IRC
19:33:46 <peter1138> But it should also be correct now.
19:33:52 <peter1138> Hence the regression change.
19:35:44 *** frosch123 has joined #openttd
19:36:56 *** supermop_work__ has quit IRC
19:37:11 <Samu> IsInsideMM(TileY(cur_tile), TileY(it), min(TileY(it) + delta_y, MapMaxY()) + 1)
19:38:47 <Samu> TileY(it) + delta_y VERSUS MapMaxY()
19:38:54 <Samu> it gets the minimum of both
19:39:20 <Samu> then adds +1 because IsInsideMM is [ , )
19:39:25 *** supermop_work has joined #openttd
19:45:59 <DorpsGek_II> [OpenTTD/OpenTTD] PeterN opened pull request #7427: Codechange: Distance between town and airport has already just been found, so use it. https://git.io/fjTeL
19:46:14 <peter1138> Er, well, No 7427, I guess.
19:46:25 <peter1138> 18:46, I ought to get ready for trail biking.
19:46:53 <peter1138> Samu, please test #7426 and #7427 (preferably together...)
19:49:06 <nielsm> btw my tip for testing multiple patches together: make a new branch from master, then merge (don't bother with rebase) both to-test branches into that branch
19:49:17 <nielsm> makes for the easiest cleanup afterwards
19:50:07 <Samu> my IsInsideMM test is not working damn it :p
19:50:08 <glx> cherry-pick works too if there's one commit per PR :)
19:50:31 <Samu> i'm so terribad, and all I want is the perimeter tiles
19:50:39 <peter1138> Also, maybe other people here can test and review those two PRs? :-)
19:50:59 <Samu> apparently, I'm getting all tiles
19:51:11 <Samu> the test is useless like that lol
19:52:09 <peter1138> You need the dimensions of the tilearea.
19:52:41 <Samu> AirportSpec is back in action
19:53:54 *** supermop_work_ has joined #openttd
19:53:57 <peter1138> You need the start tile, and the x & y, and then add 1 to TileX(tile) and subtract... 2 (probably) from x.
19:54:29 <peter1138> AirportPerimeterTileIterator? :p
19:55:52 <peter1138> You can get that from the iterator (before you use it)
19:55:53 <Samu> or at least I assume all airport tables start tile is 0, 0
19:55:57 *** gelignite has joined #openttd
19:56:12 <peter1138> But you should be predetermining these before the loop.
19:56:27 <peter1138> I don't see why layouts would not start at 0, 0
19:56:52 <glx> would be highly unlogical to not start at 0,0
19:57:17 <peter1138> Hmm, well, I guess I better go.
19:57:35 <peter1138> I gave Samu 10 minutes to quickly test my two PRs for performance but he didn't bother cos he's stuck. I love it.
19:57:45 <Eddi|zuHause> can layouts have negative coordinates?
19:58:02 <Eddi|zuHause> because 0,0 might not be part of the layout for diagonal stuff
19:58:16 <Samu> i will test later, visual studio doesn't let me change branch atm, and yeah I'm stuck
19:58:41 <Eddi|zuHause> (i think we had that discussion a few weeks ago with industries)
19:59:42 <peter1138> Eddi|zuHause, andy complained it was not centered, so I made it centered, then he said it wasn't actually any better.
20:00:06 <glx> in the spec "Offsets counted from the northernmost tile of the airport, specifying the position of the current tile. Both are taken as signed integers, but cannot go negative except the special case mentioned below."
20:00:16 <glx> and negative is only for clearance checks
20:01:09 *** supermop_work has joined #openttd
20:02:21 <Eddi|zuHause> the problem with diagonal airports will be that the (0,0) origin point will be quite far from the actually built airport
20:02:45 <Eddi|zuHause> (and i'm assuming that also will be a problem with the station sign)
20:03:30 <Eddi|zuHause> so i think it would be beneficial to allow moving the origin point away from (0,0)
20:04:20 <Eddi|zuHause> industries have the additional problem that you don't see the layout size
20:05:43 <peter1138> Well, it's possibly to offset the origin but at the point where Samu is, it would already have been applied.
20:05:58 <Eddi|zuHause> also, andy's industry problem might have been overlapping with the water class issue
20:06:03 *** supermop_work_ has quit IRC
20:14:41 *** supermop_work_ has joined #openttd
20:17:07 *** supermop_work__ has joined #openttd
20:18:26 <Samu> i hope that is the perimeter
20:23:30 <Samu> now I hope it's also correct
20:24:37 *** supermop_work_ has quit IRC
20:25:13 *** m3henry has joined #openttd
20:27:31 <Samu> grr, i'm forced to commit damn it
20:32:44 <Samu> assert(kdtree == forall);
20:40:21 <Samu> no asserts so far, so im gonna assume it's "working"
20:42:13 *** supermop_work has joined #openttd
20:47:34 *** supermop_work_ has joined #openttd
20:49:48 *** supermop_work__ has quit IRC
21:03:15 *** andythenorth has joined #openttd
21:03:41 <Samu> about 7426, I thought that was a feature
21:05:51 <Samu> a change like that will surely affect competitive servers
21:10:03 <DorpsGek_II> [OpenTTD/OpenTTD] SamuXarick commented on pull request #7424: Add: Kdtree for AirportGetNearestTown https://git.io/fjTvy
21:12:15 *** andythenorth has joined #openttd
21:14:16 *** supermop_work has joined #openttd
21:21:17 *** supermop_work_ has quit IRC
21:37:22 *** supermop_work_ has joined #openttd
22:01:11 *** rocky11384497 has joined #openttd
22:20:44 <Samu> #7246 results in about 1/4 of the time
22:21:04 <Samu> was averaging 800 ms, now it's about 220
22:28:38 *** supermop_work has joined #openttd
22:30:21 *** stormcone has joined #openttd
22:31:27 <Samu> #7247 results aren't noticeable... seems to be equal to master
22:32:30 <Samu> let me recheck what my AI do
22:32:51 <stormcone> I am trying to update my personal openttd "patch pack" after the SmallVector replacement, but i have some problem with the SmallMap's Erase function
22:35:11 <stormcone> I am that familiar with C++, but now I am at the point where I would like to know whether is the function working as it is intended?
22:35:46 <Eddi|zuHause> can you be more specific?
22:36:06 *** supermop_work_ has quit IRC
22:37:47 <stormcone> I have a SmallMap, from I trying to delete an element like: map.Erase(key);
22:37:53 <frosch123> there are two methods. one which takes a "Pair*"-iterator, one which takes a key value
22:38:19 <stormcone> but I get a quite long compiling error
22:38:40 <LordAro> can't help you without a) the code b) the error
22:38:47 <frosch123> hmm, oh, i agree, that ERase is weird
22:38:57 <frosch123> it says it takes a key, but acutally it uses a value-pair
22:39:33 <LordAro> Eddi|zuHause: i've activated the centre node :>
22:39:39 <stormcone> i think the main problem from the error log is: error: no match for ‘operator==’
22:39:50 <stormcone> (operand types are ‘SmallPair<Vehicle*, bool>’ and ‘Vehicle* const’)
22:39:51 <Eddi|zuHause> LordAro: i haven't tried yet since last time...
22:40:00 <stormcone> { return *__it == _M_value; }
22:40:15 <LordAro> Eddi|zuHause: i tried after managing to create a portable oxygenator
22:40:21 <Eddi|zuHause> LordAro: i was testing a theory involving the glowing orbs you find around, but wasn't getting anywhere with it
22:40:32 <LordAro> and finding that they're completely useless as they drain *all* the power
22:40:38 <frosch123> Erase(const T &key) must be unused in ottd code. it does something different than before, and it kind of makes no sense :p
22:40:42 *** andythenorth has joined #openttd
22:41:01 <stormcone> so I rewrite it for myself, but I wanted to be sure, whether that the code in the repo is correct or not
22:41:14 <LordAro> stormcone: if it's a map of your own creation, i'd recommend just switching to use std::map instead :)
22:41:16 <Samu> peter1138, I think you made a mistake here: mindist = UINT_MAX - add; // prevent overflow
22:41:34 <Eddi|zuHause> LordAro: i wasn't at that point yet. it was either looking around on the planet for another piece of processed scrap, or flying to another planet to get iron
22:41:53 <Samu> you want to reuse mindist, but you start all over instead
22:42:15 <LordAro> stormcone: maybe you should try converting it anyway :p
22:42:29 <LordAro> unless m3henry gets there first
22:43:05 <frosch123> it compares a pair with a key, which never compiles, so the function must be unused
22:43:54 <LordAro> Eddi|zuHause: mm, i think i'm a bit ahead of you then :)
22:43:55 <Eddi|zuHause> "delete erase" is a strange phrase... it might be one of those recursions that destroy the universe :p
22:44:19 <Eddi|zuHause> LordAro: it's not like i'm progressing fast at 6fps anyway
22:44:32 <stormcone> i modified it, so now uses it's own find() to find a pair, and then using the erase(pair) function to actually delete the item
22:44:33 <Samu> or i dunno what i'm looking at t.t
22:46:18 <stormcone> okay, so should i make a pr about it? or what are you planning to do with that function? :)
22:46:31 <LordAro> frosch123: confirmed, no compile issues if i remove the function
22:47:10 <LordAro> stormcone: PR fixing it would be lovely. long term SmallMap will be removed in favour of std::{unordered_,}map, but not sure how long that will be
22:48:05 <frosch123> LordAro: "long term" would mean "flat_map" :p
22:49:35 <LordAro> frosch123: you're thinking longer term than me :p
22:50:08 <LordAro> depends what sort of performance is required for the particular usages, i imagine :p
22:51:05 <Samu> about my perimeter check, what happens if the town is inside the perimeter
22:51:52 <Samu> and another town is just next door to one of the sides
22:52:07 <Samu> it would get the wrong town, right?
22:54:31 <Eddi|zuHause> Make The Map Round Again
22:55:11 <DorpsGek_II> [OpenTTD/OpenTTD] stormcone opened pull request #7428: Fix #7165: SmallMap::Erase(key) does not work correctly https://git.io/fjTUY
22:56:29 <stormcone> btw thank you for the help :)
23:05:39 <Eddi|zuHause> i'm not sure i understood the difference between the old and the new code
23:07:05 <Samu> TownID ScriptAirport::GetNearestTown
23:07:45 <Samu> AIs could be dumb enough to call this in a place where a town is inside the box
23:07:56 <Samu> openttd code doesn't seem to do this though
23:20:56 <Samu> i thought kdtree was fast
23:28:44 <Samu> AIAirport.GetNearestTown(AIBase.RandRange(alltiles), AIAirport.AT_INTERCON);
23:31:43 <peter1138> Ah yes, 7427 is barely noticable, but does eliminate a pointless loop.
23:31:47 <Samu> wow microsoft edge doing popups about microsoft services... :(
23:31:55 <peter1138> Just not as expensive as I was thinking.
23:32:11 <peter1138> 7426... 1/4 the time? Interesting.
23:33:09 <peter1138> 20:05 < Samu> a change like that will surely affect competitive servers
23:33:36 <Samu> yeah, those that run against the clock
23:33:40 <peter1138> Which bit did you think was a feature?
23:34:07 <peter1138> It was wrong since the new station catchment rules.
23:34:10 <Samu> 1 tile difference is all that matters for a station getting 1 or 2 coal mines
23:34:13 <_dp_> wait a sec, what change? :)
23:34:24 <Samu> faster start vs slower start
23:35:41 <_dp_> as long as it doesn't lag who cares
23:35:57 <peter1138> Samu, the change was already made
23:36:24 <peter1138> this bit of code is only used for displaying in the ui (and by AIs to find produced cargo)
23:37:01 <peter1138> So this function would have said a station at a tile could receive cargo from an industry, but actually it won't
23:37:38 <peter1138> But I think you misunderstand it :-)
23:40:39 <_dp_> is this all about non-rect catchment?
23:41:06 <_dp_> how is it even relevant to company start
23:42:12 <peter1138> I don't know what Samu is talking about :-)
23:42:16 <_dp_> well, I guess if you start with pax and your rv station extensions now get sligtly less area for your train station...
23:42:26 <_dp_> but I'm switching all to 4 tile catchment anyway
23:43:37 <peter1138> _dp_, modified catchment off? nice.
23:44:22 <_dp_> peter1138, yeah, realistic catchment or whatever is it called
23:44:37 <m3henry> I think I give up on Nuking SimpleTinyEnum, too many use cases need the loose typing
23:44:43 <_dp_> having them different was kinda silly anyway on competitive servers
23:45:09 <peter1138> non-rect catchment makes it less "useful" anyway
23:45:58 <_dp_> peter1138, you mean need more extending stations now?
23:46:16 <_dp_> peter1138, for 7 tile stations doesn't matter :p
23:47:20 <Samu> now i need to assert stuff
23:48:32 *** rocky11384497 has joined #openttd
23:53:57 <Samu> waiting for an assert, afk
23:54:42 <Samu> perhaps i should test more than just Intercontinental
23:54:51 <Samu> nevermind, it just asserted
23:55:04 <Samu> ---------------------------
23:55:04 <Samu> ---------------------------
23:55:04 <Samu> Assertion failed at line 2257 of d:\openttd\openttd github\openttd\src\station_cmd.cpp: forall == kdtree
23:55:04 <Samu> ---------------------------
23:55:07 <Samu> ---------------------------
23:55:35 <DorpsGek_II> [OpenTTD/OpenTTD] PeterN commented on pull request #7426: Fix: Incorrect display of industry production around tiles. https://git.io/fjTkL
23:56:48 <m3henry> Of course, I cant use std::unique_ptr, as `#include <memory>` gets lost, probably due to some macro clash
23:57:20 <Samu> i wasn't meant to copy paste this much
23:58:09 <LordAro> m3henry: ...well you should probably resolve that...
23:59:26 <Samu> testing without perimeter now, brb
continue to next day ⏵