IRC logs for #openttd on OFTC at 2018-09-03
            
00:10:26 <mloc> what type is routeManager.m_townRouteArray?
00:11:14 <mloc> fair warning I'm not in any way knowledgeable about the OpenTTD codebase
00:17:41 *** HerzogDeXtEr1 has joined #openttd
00:17:45 <Samu_> it's squirrel
00:18:25 *** HerzogDeXtEr has quit IRC
00:18:31 <Samu_> basically, I wanna remove the [i]
00:18:40 <Samu_> from the m_townRouteArray list
00:18:50 <Samu_> remove an index
00:19:04 <Samu_> but not break it for the for cycle :(
00:20:33 <Samu_> routeManager.m_townRouteArray.remove(i);
00:20:40 <Samu_> gonna try it, lol
00:21:27 <Samu_> what could possibly go wrong!
00:30:33 *** Stimrol has joined #openttd
01:10:15 *** chomwitt has quit IRC
01:20:46 *** Progman has quit IRC
01:28:08 *** HerzogDeXtEr1 has quit IRC
01:40:39 <Samu_> i dont understand arrays
01:43:27 <peter1138> Why?
01:45:41 <Samu_> how do i remove the slot itself!
01:45:53 <Samu_> not the value it was there :(
01:47:10 <Samu_> i dont understand the difference between tables and arrays
01:48:14 <Samu_> array.remove(idx) removes the value at the position ‘idx’ in the array
01:48:24 <Samu_> what exactly is removed
01:48:52 <Samu_> what about the idx? is it removed?
02:02:28 <peter1138> Why don't you test it if you don't understand?
02:17:57 <Samu_> im trying to test it right now
02:20:48 <Samu_> i don't really understand what's happening under the hood in an array
02:21:33 <Samu_> it's still keeping track of the correct number of m_townRouteArray
02:21:42 <Samu_> just not on the current for cycle
02:21:46 <Samu_> but on the next
02:22:29 <Samu_> I could probably say that "it werks"
02:22:47 <Samu_> does what I want it to do
02:23:03 <Samu_> remove dead routes from the array
02:34:10 *** KouDy has quit IRC
02:34:42 <Samu_> ok enough coding for today, I'm off to bed
02:49:35 *** Samu_ has quit IRC
03:40:36 *** mloc has quit IRC
04:38:12 *** Flygon has joined #openttd
05:29:56 *** KouDy has joined #openttd
05:35:42 *** haudrauf has quit IRC
05:37:08 *** haudrauf has joined #openttd
06:57:35 *** Wacko1976 has joined #openttd
07:08:03 *** nielsm has joined #openttd
07:08:43 *** APTX| has quit IRC
07:09:46 *** APTX has joined #openttd
07:17:45 *** agentw4b has quit IRC
07:38:17 *** Wacko1976 has quit IRC
07:41:46 *** nielsm has quit IRC
07:51:31 *** Supercheese has joined #openttd
08:42:14 *** KouDy has quit IRC
08:44:10 *** KouDy has joined #openttd
08:58:52 *** sla_ro|master has joined #openttd
09:23:34 *** Supercheese has quit IRC
09:23:55 *** Supercheese has joined #openttd
09:23:59 *** Samu has joined #openttd
09:43:07 *** andythenorth has joined #openttd
09:43:10 *** andythenorth has left #openttd
09:49:23 <Samu> testing a bunch of LuDIAI Afterfix's with is_friendly turned on, let's see if they build stations far from each other as I intended
10:45:09 *** Supercheese has quit IRC
10:55:31 <DorpsGek_II> [OpenTTD/OpenTTD] ghisvail commented on issue #6873: Jukebox not working in the flatpak version https://github.com/OpenTTD/OpenTTD/issues/6873#issuecomment-418047892
10:57:49 <peter1138> Samu, so while you are iterating an array, you usually can't remove items from the same array.
10:58:42 <peter1138> The usual method is to iterate the array and add the indices of the items you want to delete to second array. They you go through that array, removing from the first array, and then just clear the 2nd array.
10:59:13 <peter1138> There may be other simpler methods though, I'm not familiar with sq.
11:35:31 *** Progman has joined #openttd
11:37:00 <milek7_> maybe usual interating from end?
11:46:39 <Samu> oh, hi
11:46:42 <Samu> i fell asleep
11:47:08 <Samu> iterate from the end to the beginning?
11:49:30 <Samu> indexes are from 0 to 10, so if i start from 10 to 0 and i find that 6 is to be removed, I remove 6, and it can still iterate to the previous one, without issue?
11:50:55 <Samu> milek7_:
11:53:52 <Samu> for (local i = routeManager.m_townRouteArray.len() - 1; i >= 0, --i) {
11:53:55 <Samu> like this?
11:56:09 <Samu> or do as peter1138 say, but what if I find multiple indexes how exactly would that work
11:58:36 <peter1138> I guess the remove would be simpler in reverse as well.
12:01:47 <Samu> ok, thx will test anyway
12:26:40 *** KouDy has quit IRC
12:38:06 *** HerzogDeXtEr has joined #openttd
13:30:11 *** KouDy has joined #openttd
14:10:02 *** chomwitt has joined #openttd
14:19:33 *** andythenorth has joined #openttd
14:19:35 <andythenorth> o/
14:21:13 <Samu> Just medled with the TownManager.nut for the first time
14:21:58 <Samu> trying to understand how LuDi code handles town pairs like they're just 1 entity
14:26:41 *** Laedek has joined #openttd
14:43:44 <andythenorth> @seen danmack
14:43:44 <DorpsGek> andythenorth: danmack was last seen in #openttd 2 weeks, 5 days, 18 hours, 21 minutes, and 22 seconds ago: <DanMacK> LOL
15:24:42 *** KouDy has quit IRC
15:44:55 <Samu> peter1138: https://paste.openttdcoop.org/pwp2v1qoc
15:44:57 <Samu> lines 2-7
15:45:00 <Samu> is that ok?
15:45:11 <Samu> or milek7_
15:46:14 *** nielsm has joined #openttd
16:01:43 *** Wacko1976 has joined #openttd
16:33:08 *** KouDy has joined #openttd
16:44:44 *** KouDy has quit IRC
17:01:46 *** sla_ro|master has quit IRC
17:19:51 *** andythenorth has quit IRC
17:29:01 *** WWacko1976-work has quit IRC
17:29:33 *** andythenorth has joined #openttd
17:37:57 <Samu> I'm having trouble with && and || again grr
17:39:56 <nielsm> ah got a build working on fedora linux, and even music playback via extmidi/timidity
17:40:28 <nielsm> (I'm not impressed with the quality of freepats, they sound strange)
17:42:52 <peter1138> Samu, && = and, || = or. Nothing tricky about them.
17:42:58 *** Wormnest has joined #openttd
17:43:21 <Samu> HALP https://paste.openttdcoop.org/pgbxqhdnq trying to simplify it
17:43:55 <peter1138> && - both sides need to be true, || - either side (or both) can be true
17:44:29 <peter1138> when mixing && and || you NEED to use extra parenthesis
17:46:06 <peter1138> And also why do you test for IsStationTile on both sides of the or?
17:46:18 <Samu> because i am failing to simplify it
17:46:21 <Samu> i see wrong behaviour
17:46:43 <peter1138> I can't really decipher what you are intending to test for.
17:47:08 <peter1138> Ah, there's a comment :p
17:47:28 <peter1138> So...
17:47:37 <nielsm> start by splitting it into multiple statements
17:47:49 <nielsm> if (!AITile.IsStationTile(tile)) continue;
17:48:02 <nielsm> (don't do further checks if it isn't a station tile)
17:48:27 <nielsm> if (AITile.GetOwner(tile) != AICompany.ResolveCompanyID(AICompany.COMPANY_SELF)) return true;
17:48:46 <Samu> oki
17:48:47 <nielsm> (condition fulfilled if it's someone else's station)
17:49:01 <nielsm> if (AITile.GetOwner(tile) == AICompany.ResolveCompanyID(AICompany.COMPANY_SELF) && !AIStation.HasStationType(AIStation.GetStationID(tile), AIStation.STATION_AIRPORT)) return true;
17:49:28 <nielsm> you really don't need to combine everything into a single huge conditional, it just becomes harder to read
17:50:31 <nielsm> anyway, I need to debug the midi playback on non-windows because it can play the DOS version music (mpsmidi/catmidi) now but not the windows version music (smf .gm files)
17:51:06 <nielsm> I think I uncovered some time ago it does some wrong path manipulation somewhere
17:53:11 <Samu> gonna try this
17:53:14 <Samu> if (AITile.IsStationTile(tile) && (AITile.GetOwner(tile) != AICompany.ResolveCompanyID(AICompany.COMPANY_SELF) || !AIStation.HasStationType(AIStation.GetStationID(tile), AIStation.STATION_AIRPORT))) {
17:53:19 <Samu> if it still fails I'll do the split
17:54:53 <andythenorth> so did we finish 16 cargos in/out? o_O
17:55:03 <andythenorth> or did we get caught up on spec agony?
17:56:46 <nielsm> nobody's discussing the spec
17:57:02 <nielsm> the only thing I'm waiting on before calling it done is that all aspects of it actually get tested
18:00:40 *** KouDy has joined #openttd
18:01:52 <andythenorth> ok so if iirc, I/someone needs to patch nml for updated prop 28
18:01:57 <andythenorth> https://github.com/OpenTTD/OpenTTD/pull/6867#issuecomment-412638554
18:03:07 <Samu> If I am a friendly AI that builds bus stations and airports and I'm looking for a place to place my bus station, I don't want to place it near any of my competitors, or near my other bus stations
18:03:25 <Samu> but i could place near my airports
18:04:27 <Samu> that thing returning true means the place is bad
18:05:23 <Samu> is that actually doing what I ask'
18:11:14 *** frosch123 has joined #openttd
18:32:40 *** Wacko1976 has quit IRC
18:37:28 *** andythenorth has quit IRC
18:41:32 *** sla_ro|master has joined #openttd
18:53:20 *** Flygon has quit IRC
18:55:47 *** Gja has joined #openttd
18:58:24 <DorpsGek_II> [OpenTTD/OpenTTD] nielsmh opened pull request #6889: MIDI search path fixes https://github.com/OpenTTD/OpenTTD/pull/6889
18:58:56 *** gelignite has joined #openttd
18:59:57 *** Wacko1976 has joined #openttd
19:09:24 *** Wolf01 has joined #openttd
19:10:06 <Wolf01> o/
19:13:03 *** GroovyNoodle has joined #openttd
19:18:35 *** andythenorth has joined #openttd
19:19:25 *** Compu has joined #openttd
19:28:27 *** Wacko1976 has quit IRC
19:35:49 <andythenorth> on my holiday
19:35:51 <andythenorth> I read a book
19:38:10 *** gelignite has quit IRC
19:40:47 <Wolf01> I said: 4 holiday weeks, I'll start to read the neverending story... never started
19:41:49 <andythenorth> my book was about trains :P
19:44:18 *** Wacko1976 has joined #openttd
19:46:24 *** gelignite has joined #openttd
20:06:52 *** tokai|noir has joined #openttd
20:06:52 *** ChanServ sets mode: +v tokai|noir
20:06:53 *** slahhc has joined #openttd
20:11:53 <Samu> if (AITile.IsStationTile(t) && (AITile.GetOwner(t) != AICompany.ResolveCompanyID(AICompany.COMPANY_SELF) || !AIStation.HasStationType(AIStation.GetStationID(tile), LuDiAIAfterFix.cargoClass == AICargo.CC_PASSENGERS ? AIStation.STATION_BUS_STOP))) {
20:11:58 <Samu> big line
20:12:18 <Samu> now for the case of airport
20:13:16 <Samu> looking for a place to place my airport, i don't want to place it near any of my competitors, or near my other airports
20:13:22 <Samu> should work
20:13:51 <Samu> getStationID(t)
20:13:52 *** tokai has quit IRC
20:13:53 <Samu> must fix
20:16:25 <Samu> oops
20:16:28 <Samu> if (AITile.IsStationTile(t) && (AITile.GetOwner(t) != AICompany.ResolveCompanyID(AICompany.COMPANY_SELF) || !AIStation.HasStationType(AIStation.GetStationID(t), LuDiAIAfterFix.cargoClass == AICargo.CC_PASSENGERS ? AIStation.STATION_BUS_STOP : AIStation.STATION_TRUCK_STOP))) {
20:16:32 <Samu> fixed
20:16:59 <Samu> it needed to be bigger!
20:17:23 <slahhc> chater
20:18:48 <slahhc> who are you talking to?
20:19:21 <Wolf01> Noone, he writes here what he does
20:19:54 <Samu> yes... sorry
20:20:01 <Wolf01> Teddy bear programming, but with the whole chatroom
20:20:33 <slahhc> whats the code to get infinit money?
20:20:40 *** Thedarkb has joined #openttd
20:20:51 <Wolf01> Ctrl+shift+C or some other weird combination
20:23:12 <slahhc> im not chating with you anymore
20:25:06 <Samu> testing AI vs AI, I see nearly 0 airports, seems that it's a bit too friendly, they null each other the chances of building an airport
20:25:16 <Samu> :(
20:26:25 <Samu> i want it to behave friendly, but not too friendly :( how am I reach mid-term ?
20:28:02 <nielsm> build up an anger-meter and when it passes some threshold relieve some anger by being unfriendly
20:29:13 <slahhc> you need the AI to let the player think hes got a chance of making it, you need to find the sweet spot for maximizing human frustration
20:30:55 <slahhc> that always makes them come back for more
20:30:58 <Samu> i coult try checking how much is produced by the town
20:31:06 <Samu> and how much is being transported
20:35:27 *** slahhc has quit IRC
20:38:47 <Samu> the way the code is written, it feels like LuDiAI had more than 1 coder even before me
20:49:00 *** Thedarkb has quit IRC
20:49:32 *** Wacko1976 has quit IRC
21:00:53 *** Thedarkb has joined #openttd
21:14:35 *** Thedarkb has quit IRC
21:16:48 *** Gja has quit IRC
21:27:56 *** ToBeFree has joined #openttd
21:32:09 *** ToBeFree has quit IRC
21:47:20 *** gelignite has quit IRC
21:57:06 <DorpsGek_II> [OpenTTD/OpenTTD] nielsmh merged pull request #6889: MIDI search path fixes https://github.com/OpenTTD/OpenTTD/pull/6889
21:57:07 <DorpsGek_II> [OpenTTD/OpenTTD] nielsmh pushed 2 commits to master:
21:57:07 <DorpsGek_II> - Fix: Check the search paths for standard MIDI files (by nielsmh)
21:57:08 <DorpsGek_II> - Fix: Better "temp" path for decoded MPSMIDI files when source filename has no path separators (by nielsmh)
21:57:08 <DorpsGek_II> https://github.com/OpenTTD/OpenTTD/compare/4b0b4e06435b...bb086f92403a
21:57:30 <andythenorth> :)
21:57:51 <nielsm> https://0x0.st/svAz.png <- who will get number 23000 ?
21:58:08 <nielsm> and how insignificant will it be? :D
22:03:52 <andythenorth> oooo
22:04:09 *** HerzogDeXtEr has quit IRC
22:04:33 *** KouDy has quit IRC
22:14:56 *** sla_ro|master has quit IRC
22:17:46 *** KouDy has joined #openttd
22:20:41 *** GroovyNoodle has quit IRC
22:28:53 <Samu> testing another way to decide wether to build airports
22:29:04 <Samu> if (AITile.IsStationTile(t) && (AIStation.HasStationType(AIStation.GetStationID(t), AIStation.STATION_AIRPORT) || AITile.GetOwner(tile) != AICompany.ResolveCompanyID(AICompany.COMPANY_SELF) && AIController.GetSetting("is_friendly"))) {
22:29:32 <Samu> nearby_station = true;
22:30:01 <Samu> oopps
22:30:20 <Samu> AITile.GetOwner(t), not tile
22:42:23 *** nielsm has quit IRC
22:46:41 <Wolf01> 'night
22:46:55 *** Wolf01 has quit IRC
22:57:33 *** andythenorth has quit IRC
23:00:31 <Samu> darn it :(
23:01:04 <Samu> a station that is tile walked has influence in dictating if a station is airport
23:01:37 <Samu> no wonder I wasn't seeing many airports
23:01:46 <Samu> the ai station spreads like a cheater
23:05:01 <Samu> even if it would find a bus station in the tile, it would only check if that station had an airport even if the airport was station spreaded past the search radius :(
23:05:23 <Samu> thus would not build the airport
23:06:00 <Samu> it wasn't really checking if the tile was already belonging to an airport
23:06:07 <Samu> bah, what can I do :(
23:09:12 <Samu> i've been doing this wrong all along
23:11:30 *** frosch123 has quit IRC
23:21:21 <Samu> this is gonna be much harder to do for road station tiles than airport tiles
23:21:42 <Samu> but at least I got an idea how to solve this issue
23:26:32 *** Thedarkb has joined #openttd
23:54:11 *** glx has joined #openttd
23:54:11 *** ChanServ sets mode: +v glx