Config
Log for #openttd on 18th August 2018:
Times are UTC Toggle Colours
00:01:19  *** Supercheese has quit IRC
00:45:30  *** KouDy has quit IRC
00:50:50  *** KouDy has joined #openttd
00:57:00  *** keoz has quit IRC
00:59:42  *** HerzogDeXtEr has quit IRC
01:02:51  *** snail_UES_ has joined #openttd
01:04:20  *** Thedarkb-T60 has quit IRC
01:19:35  *** Flygon has joined #openttd
01:50:50  *** Samu has quit IRC
02:00:00  *** KouDy has quit IRC
02:07:23  *** Flygon has quit IRC
02:48:00  *** Mazur has quit IRC
02:57:50  *** Mazur has joined #openttd
03:02:40  *** glx has quit IRC
03:08:47  *** rocky113844 has joined #openttd
03:12:15  *** haudrauf has quit IRC
03:13:31  *** haudrauf has joined #openttd
03:28:31  *** KouDy has joined #openttd
03:32:12  *** KouDy has quit IRC
03:42:29  *** KouDy has joined #openttd
04:48:04  *** HeyCitizen_ has joined #openttd
04:53:28  *** HeyCitizen has quit IRC
04:54:57  *** Gustavo6056 has joined #openttd
04:59:56  *** Gustavo6046 has quit IRC
05:09:43  *** cHawk has quit IRC
05:10:46  *** The_Saladman has quit IRC
05:36:59  *** HeyCitizen has joined #openttd
05:38:50  *** HeyCitiz- has joined #openttd
05:39:04  *** snail_UES_ has quit IRC
05:43:18  *** HeyCitizen_ has quit IRC
05:45:03  *** HeyCitizen has quit IRC
06:18:36  *** Gja has joined #openttd
06:23:45  *** Gja has quit IRC
06:37:26  *** tokai has quit IRC
06:38:02  *** tokai has joined #openttd
06:38:02  *** ChanServ sets mode: +v tokai
06:50:46  *** Compu has joined #openttd
06:55:50  *** andythenorth has joined #openttd
07:01:11  *** cHawk has joined #openttd
07:03:53  <andythenorth> o/
07:21:03  *** sla_ro|master has joined #openttd
07:41:19  *** HerzogDeXtEr has joined #openttd
08:27:35  *** mocniak has quit IRC
08:34:15  *** sla_ro|master has quit IRC
08:39:53  *** keoz has joined #openttd
08:53:35  *** Stimrol has quit IRC
08:58:10  *** Wacko1976 has joined #openttd
09:00:33  *** Stimrol has joined #openttd
09:04:11  *** Thedarkb-T60 has joined #openttd
09:09:00  *** haudrauf has quit IRC
09:13:16  *** haudrauf has joined #openttd
09:14:24  *** Progman has joined #openttd
09:28:34  *** Wolf01 has joined #openttd
09:28:49  <Wolf01> o/
09:33:30  *** Maraxus has joined #openttd
09:42:07  *** synchris has joined #openttd
09:49:46  *** sla_ro|master has joined #openttd
09:51:12  *** frosch123 has joined #openttd
11:01:25  *** agentw4b__ has joined #openttd
11:02:01  *** Samu_ has joined #openttd
11:02:13  <Samu_> hi
11:03:39  <Samu_> I found a bug in WrightAI
11:03:55  <Samu_> any chances it will be fixed?
11:04:43  <LordAro> probably not
11:04:54  <Samu_> the bug is at line 263 main.nut
11:05:07  <Samu_> this.SellAirports(i);
11:05:17  <Samu_> that i is expected to be a vehicleID
11:05:28  <Samu_> but it's providing a stationID instead
11:06:33  <Samu_> that will make wrightai unable to remove the airport, or even remove the wrong airport
11:10:47  <Samu_> there is no vehicles at all at that point
11:10:58  <Samu_> so, i'm not really sure how to handle this bug
11:11:23  <Samu_> he found a station with no vehicles, and the only way to remove the airports is by providing a vehicleID
11:17:29  <Samu_> this.route_1.GetValue(i)
11:17:49  <Samu_> this brings up the tileindex of the airport
11:18:12  <Samu_> i is the vehicle ID
11:18:26  <Samu_> what if I don't have the vehicleID
11:18:39  <Samu_> how do I retrieve the tileindex from this.route_1?
11:19:36  <Samu_> this.route_1.HasValue
11:19:40  <Samu_> does that exist?
11:20:56  <Samu_> GetItemGivenValue?
11:22:57  <Samu_> RemoveValue (int64 value)
11:23:35  <Samu_> this might be it
11:26:16  *** Wormnest has joined #openttd
11:26:42  <Samu_> Wormnest: hi
11:26:49  <Samu_> are you familiar with wrigthai?
11:26:49  *** keoz has quit IRC
11:27:10  <Wormnest> Hi Samu
11:27:20  <Wormnest> Well a little bit but it´s a long time ago
11:27:44  <Samu_> have u come with a bug where it is trying to remove empty airports but it's using the wrong ID?
11:29:19  <Wormnest> No idea, as I said it´s a long time ago
11:35:10  <Samu_> how do I get the location of an airport if the airport is joined with another station (bus stop in this case)?
11:35:25  *** andythenorth has quit IRC
11:35:39  <Samu_> when I get the location of the station, I get the bus stop tile
11:35:48  <Samu_> if I remove that tile, the airport isn't removed :/
11:35:53  <Samu_> bah
11:41:04  <Samu_> gonna try to grab it by the hangar
11:41:05  <Samu_> brb
11:43:16  <Samu_> nah, I need to know the exact top corner of the airport location
11:43:28  <Samu_> can't use hangar location :(
11:44:22  <Wormnest> Have you looked in SuperLib for a useful function
11:47:54  <Samu_> doesn't use superlib :(
11:48:23  <Wormnest> Well you can copy the function from Superlib:
11:48:27  <Wormnest> function _SuperLib_Airport::GetAirportTile(station_id)
11:48:55  <Wormnest> As long as the licenses are compatible that is of course
11:51:28  <Samu_> no idea if they are
11:51:34  <Samu_> ludiai says gpl 2.0
11:53:26  <Wormnest> SuperLib is the same so that´s fine
11:55:37  <Samu_> I found it in superlib
11:55:48  <Samu_> nice, it needs a tilelist just to grab the top corner
12:20:02  *** andythenorth has joined #openttd
12:20:45  <Samu_> thx Wormnest, this fixed it!
12:21:44  <Samu_> this.route_1.RemoveValue(airport_tiles.Begin()); I hope this is doing what I think it does
12:21:54  <Samu_> this.route_2.RemoveValue(airport_tiles.Begin()); I hope this is doing what I think it does
12:21:59  <Samu_> 1 and 2
12:23:02  <Samu_> removes all items, in this case, all vehicleids that have the airport top corner tile as the value
12:30:28  *** keoz has joined #openttd
12:34:42  <Samu_> LuDiAI vs LuDiAI AfterFix, that's how I called it
12:34:51  <Samu_> let's see who wins
12:35:38  *** chomwitt has joined #openttd
12:37:44  *** Thedarkb-T60 has quit IRC
12:41:27  <Samu_> strange, LuDiAI is still doing better
12:44:55  <Samu_> I see why
12:45:57  <Samu_> LuDiAI stops at 500 road vehicles, doesn't have to manage that many road vehicles
12:46:17  <Samu_> more time for handling aircraft
13:09:27  *** Thedarkb-T60 has joined #openttd
13:16:04  *** Maraxus has quit IRC
13:22:53  <Samu_> https://imgur.com/Nlq4mjA
13:23:03  <Samu_> overtook it for the first time
13:27:09  <Samu_> it's unfair, LuDiAI builds airports that doesn't use them
13:28:21  <Samu_> there's less room for airports for the fixed version
13:28:40  <Samu_> interesting paradigm
13:29:26  <LordAro> well of course if you run them both at the same time it's not a fair test
13:29:32  <LordAro> they're competing for the same resources
13:31:15  <Samu_> maybe the map needs to be really big
13:31:20  <Samu_> gonna try 2k map
13:31:27  <LordAro> why would that help?
13:31:34  <LordAro> they use the same logic for deciding where to build
13:31:54  <Samu_> because LuDiAI leaves airports behind, unused, so i need more towns
13:32:07  <Samu_> not sure if this would fix anything, but...
13:32:14  <LordAro> well why are you trying it then?
13:32:15  <Samu_> solve*
13:32:57  <LordAro> the new version will try to build airports at exactly the same town
13:38:13  <Samu_> something else I find it weird
13:38:33  <Samu_> LuDiAI uses big planes on small airports, causing many crashes
13:38:52  <Samu_> my fixed version only uses small planes on small airports, with much much less crashes
13:39:02  <Samu_> and still... by brute force, the big planes win
13:40:12  <Samu_> LuDiAI doesn't sell / renew old planes
13:40:16  <Eddi|zuHause> that's how evil corporations work. lost profits not outweighing the cost of crashes?
13:41:12  <Samu_> my fixed version sells old vehicles, doesn't exactly renew though
13:41:23  *** sim-al2 has quit IRC
13:41:41  <Eddi|zuHause> just use autorenew
13:41:42  <Samu_> if it sold the last vehicle on that route, it also sells the airports
13:42:33  <Samu_> i'm unsure i can use autorenew, because the road part of the code is already renewing manually
13:43:08  <Samu_> it's handling road vehicles pretty different than air vehicles
13:44:57  <Samu_> LuDiAI crashed, the index len does not exist?
13:45:05  <Samu_> must investigate
13:46:17  <Samu_>         for(local i = 0; i < m_townRouteArray.len(); ++i) {
13:56:03  <Samu_> what is len supposed to be?
13:57:18  <LordAro> something for determining the length of an array, i imagine
13:57:33  <Samu_> isn't that Count()?
13:57:38  <LordAro> usually
13:59:29  <Samu_>     constructor() {         m_townRouteArray = [];
13:59:30  *** Thedarkb-T60 has quit IRC
14:01:38  <Wolf01> Bye
14:01:39  *** Wolf01 has quit IRC
14:04:04  <Samu_> i'm unsure how to fix this, will need help
14:04:35  <Samu_> https://paste.openttdcoop.org/pyxd59mk8
14:04:47  <Samu_> the crash happened at line 65
14:05:49  <LordAro> oh ok, it's not an AIList, so it is supposed to be using len()
14:09:12  <Samu_> i'm looking at line 22, return null, and I'm wondering if it should be return 0?
14:09:49  <LordAro> it is a bit unusual to return 2 different types
14:10:01  *** Sacro has quit IRC
14:10:08  <LordAro> but i don't know what value it should actually return
14:10:54  <Samu_>             if (routeResult) {
14:11:14  <Samu_> essentially if (1) {
14:11:20  <Samu_> or if (null) {
14:11:50  <LordAro> null is usually falsy, 1 is usually truthy
14:13:47  <Samu_> darn, i should have used restart command
14:13:58  <Samu_> now i dunno if i'm able to replicate the crash
14:15:26  <Wormnest> If it crashed at line 65 then m_townRouteArray must have been null I think
14:16:12  <Samu_> ah, i got a crash report posted about this same problem https://www.tt-forums.net/viewtopic.php?f=65&t=82685&sid=f2c236839d44d16a88d26f5e4298945b
14:16:18  <Samu_> nice of me
14:19:06  *** snail_UES_ has joined #openttd
14:30:02  *** keoz has quit IRC
14:32:11  *** Thedarkb-T60 has joined #openttd
14:35:09  <Samu_> can't reproduce the darn crash :(
14:56:08  *** Gja has joined #openttd
14:57:45  *** Gja has quit IRC
14:57:55  <Samu_> ok, i think i know where the crash originates
14:58:18  <Samu_> when ludiai gets 501 road vehicles, which is over his max of 500
14:59:01  <Samu_>             if(MAX_TOWN_VEHICLES == routeManager.getRoadVehicleCount() - 1) {                 routeManager.m_townRouteArray[i].sendLowProfitVehiclesToDepot();             }
14:59:21  <Samu_> MAX_TOWN_VEHICLES is 500
14:59:27  <Samu_> if (500 == 501 - 1)
14:59:51  <Samu_> he wants to maintain is max of 500 vehicles
15:00:02  <Samu_> and not exceed it
15:01:22  <Samu_> this crash is probably unable to happen on my version because I raised MAX_TOWN_VEHICLES to 5000
15:01:39  <Samu_> as long as openttd max road vehicles is 5000, the ai would never get 5001 road vehicles
15:03:41  <Samu_> but i'd still like to know how to fix it
15:05:30  *** Thedarkb-T60 has quit IRC
15:05:33  <LordAro> i imagine it wants a >= somewhere
15:09:24  <Samu_>                     (AIVehicle.GetProfitLastYear(vehicle) < (highestProfitLastYear() / 6))) {
15:09:55  <Samu_> problem seems to be highestProfitLastYear()
15:10:14  <Samu_> it should be m_townRouteArray[i].highestProfitLastYear()
15:10:24  <Samu_> if I'm reading this correctly
15:10:49  *** snail_UES_ has quit IRC
15:12:30  <Samu_> or maybe not :(
15:12:54  <LordAro> what is the error message?
15:13:05  <LordAro> the error message should be pointing you at where the problem is
15:13:47  <Samu_> routeManager.highestProfitLastYear() perhaps
15:14:17  <Samu_> the error is https://www.tt-forums.net/viewtopic.php?f=65&t=82685&sid=f2c236839d44d16a88d26f5e4298945b
15:15:11  <LordAro> right, so it's very clear what the error message is
15:15:18  <LordAro> well, not very clear
15:15:20  <LordAro> but clear enough
15:15:51  <LordAro> i.e. the object that calls 'len' does not have that method attached to it
15:16:24  <LordAro> since we've already determined that len must exist on a list object, it can't actually be a list object
15:16:35  <LordAro> why that is is what you've got to work out
15:17:11  <Samu_> replace highestProfitLastYear()  with routeManager.highestProfitLastYear()
15:17:17  <Samu_> is that it?
15:17:30  <Samu_> (AIVehicle.GetProfitLastYear(vehicle) < (highestProfitLastYear() / 6))) {
15:17:34  <Samu_> at here
15:17:36  <LordAro> i feel like you didn't read a single word of what i just said
15:17:38  <LordAro> try again
15:17:44  <Samu_> eh ok let me try
15:22:58  <Samu_> the object that calls len
15:23:35  <Samu_> highestProfitLastYear() is the object?
15:23:47  <Samu_> or is it m_townRouteArray
15:23:50  <Eddi|zuHause> that's why i have an ignore list, to protect my sanity
15:23:54  <LordAro> the latter
15:24:05  <LordAro> highestProfitLastYear is a function
15:24:11  <LordAro> (or a function call, depending on context)
15:24:12  <Samu_> doesn't have that method attached to
15:25:54  <Samu_> must attach a method?
15:26:20  <LordAro> that's a bit of a bad explanation, i'll give you that one
15:26:35  <Samu_> routeManager.highestProfitLastyear() - there I attached it :o
15:27:04  <LordAro> right, so highestProfitLastYear is a function method "attached" to routeManager
15:27:11  *** KouDy has quit IRC
15:27:16  <LordAro> so what is len?
15:28:25  <LordAro> (i want you to answer this, so show that you're actually learning something)
15:28:31  <LordAro> to show*
15:28:36  <Gustavo6056> Hey, bros! Who remember me?
15:28:45  <Gustavo6056> remembers*
15:30:04  <Samu_> len, i'm not sure, it keeps track of the built routes .
15:30:05  <Samu_>     function buildRoute(buildManager, cityFrom, cityTo, cargoClass)
15:30:17  <Samu_> local route = buildManager.buildRoute(cityFrom, cityTo, cargoClass);
15:30:24  <LordAro> stop pasting code and think about it
15:30:26  <Samu_> m_townRouteArray.append(route);
15:30:50  <Samu_> is the number of routes it has appended?
15:31:10  <LordAro> i was speaking in a more general sense, but close enough!"
15:31:12  <LordAro> -"
15:31:37  <Samu_> if you say it's using null
15:31:48  <Samu_> it would mean     m_townRouteArray = null;
15:31:54  <Samu_> it can't be null
15:31:57  <Samu_> they exist already
15:32:05  <LordAro> are you sure about that?
15:32:14  <Samu_> yes
15:32:27  <Samu_> or no?
15:32:39  <LordAro> what happens if highestProfitLastYear is called before the constructor?
15:32:58  *** smoke_fumus has joined #openttd
15:34:14  <Samu_> m_town_RouteArray = null?
15:34:24  <Samu_> m_townRouteArray = null
15:34:45  <Samu_> there is no len?
15:34:51  <LordAro> :)
15:36:26  <Samu_> but they exist already, ludiai is now trying to remove the least profit vehicles from his routes
15:36:42  <LordAro> if i'm remembering my squirrel correctly, you can call methods with and without the class instance
15:36:54  <LordAro> which is rather confusing
15:38:25  *** Sacro has joined #openttd
15:43:08  <Samu_> here's the other function https://paste.openttdcoop.org/pyzhscwft
15:43:28  <Samu_> line 23
15:44:15  <LordAro> not sure i can help you significantly further, play around, add some debug print statements, see what you find
15:44:48  <Samu_> it's a function on Route.nut calling another from RouteManager.nut
15:45:50  <Samu_> im trying now to replicate the crash, but not sure how to make it trigger
15:46:23  <Samu_> just know that it got to get 501 vehicles
15:46:41  <Samu_> and be running that part of the code in that exact moment
15:49:48  <Samu_> the sum of the cargo waiting must also be more than 150
15:51:17  <Samu_> the vehicle must also be older than 2 years
15:53:40  <Samu_> very hard conditions to get it to trigger
15:53:59  <Samu_> must have not sold a vehicle in the last 2 months
15:56:50  *** KouDy has joined #openttd
15:58:26  <Samu_> routeManager.m_townRouteArray[i].sendLowProfitVehiclesToDepot();
15:58:38  <Samu_> the array exists!
16:00:41  <Samu_> gonna try increase the chances by creating BIIIG CITIES on start up
16:02:14  <Samu_> oh crap, the cpu usage deal
16:07:15  <Samu_> reduced the max vehicles to 150, let's see if i can make it happen
16:07:22  <Samu_> quckly
16:08:59  <Wormnest> I would add a check for m_townRouteArray == null and if it is write a debug msg
16:09:45  <Samu_> aha, got a crash!
16:10:11  <Samu_> mister white got 151 vehicles and crashed
16:10:35  <Samu_> meanwhile I found some other with 152 and didn't crash, then again the function requires an exact match of 151
16:10:45  <Samu_> this seems more buggy than I first thought
16:14:49  <Samu_> (AIVehicle.GetProfitLastYear(vehicle) < (routeManager.highestProfitLastYear() / 6))) {
16:14:55  <Samu_> restesting with this change
16:18:43  <Samu_> the index routeManager does not exist :(
16:18:50  <Samu_> became worse
16:22:14  <Samu_> LuDiAIAfterFix.routeManager.highestProfitLastYear()
16:22:24  <Samu_> i have to pass the darn routeManager around
16:22:33  <Samu_> just dunnot how, yet
16:25:05  <Samu_>         routeManager = RouteManager();
16:25:11  <Samu_> so I see
16:25:29  *** agentw4b_ has joined #openttd
16:27:40  <Samu_> sorry :( doesnt work
16:28:36  <Samu_> I'll never learn
16:31:43  <LordAro> not if you refuse to learn the basics
16:32:55  *** agentw4b__ has quit IRC
16:38:35  *** agentw4b__ has joined #openttd
16:39:29  *** agentw4b___ has joined #openttd
16:40:53  <Samu_> trying something else
16:40:56  <Samu_>         for(local i = 0; i < routeManager.m_townRouteArray.len(); ++i) {
16:44:56  <Samu_> the index routeManager doesn't exist :(
16:45:03  <Samu_> fake news
16:45:07  <Samu_> it exists :(
16:45:20  *** agentw4b____ has joined #openttd
16:45:42  <LordAro> routeManager is not the same as RouteManager
16:46:10  *** agentw4b_ has quit IRC
16:46:55  *** agentw4b__ has quit IRC
16:47:40  *** agentw4b_ has joined #openttd
16:48:19  <Samu_> there is a constructor in main.nut with routeManager = RouteManager();
16:48:38  <Samu_> I want to get it
16:49:32  <Samu_> there can be only 1
16:50:23  <Samu_> all route operations are being done into 'routeManager'
16:50:35  <Samu_> so it's on this one i got to get the array from
16:50:43  <Samu_> but I can't seem to reach it
16:52:49  *** agentw4b___ has quit IRC
16:53:25  *** agentw4b____ has quit IRC
16:59:28  *** Gja has joined #openttd
17:00:18  *** Thedarkb-T60 has joined #openttd
17:14:40  *** Thedarkb-T60 has quit IRC
17:30:41  *** Thedarkb-T60 has joined #openttd
17:33:37  *** glx has joined #openttd
17:33:37  *** ChanServ sets mode: +v glx
17:47:51  <Samu_> i managed to do it
17:48:12  <Samu_> not with the best approach though, but will suffice for now
17:51:57  *** Gja has quit IRC
18:05:34  *** tokai|noir has joined #openttd
18:05:34  *** ChanServ sets mode: +v tokai|noir
18:12:34  *** tokai has quit IRC
18:17:09  <Samu_> routeManager.m_townRouteArray[i].sendLowProfitVehiclesToDepot(routeManager);
18:17:46  <Samu_>                     (AIVehicle.GetProfitLastYear(vehicle) < (highestProfitLastYear(routeManager) / 6))) {
18:18:08  <Samu_>         for(local i = 0; i < routeManager.m_townRouteArray.len(); ++i) {
18:18:17  <Samu_> and thus, the routeManager was passed around
18:18:24  <Samu_> :)
18:19:03  <Samu_> because I don't know how to do it the right way
18:21:36  <peter1138> ew at "for("
18:23:30  <Samu_> I would prefer to access it directly
18:24:05  <Samu_> but nevermind. it works, it's what matters for now
18:46:57  *** gelignite has joined #openttd
18:54:34  *** Maraxus has joined #openttd
18:57:06  *** andythenorth has quit IRC
19:10:53  *** andythenorth has joined #openttd
19:14:20  *** Thedarkb-T60 has quit IRC
19:15:04  *** KouDy has quit IRC
19:18:11  *** iSoSyS has joined #openttd
19:20:55  *** sla_ro|master has quit IRC
19:49:39  *** KouDy has joined #openttd
20:12:31  *** andythenorth has left #openttd
20:23:05  *** sim-al2 has joined #openttd
20:38:34  *** Maraxus has quit IRC
20:39:07  *** frosch123 has quit IRC
20:39:22  *** gelignite has quit IRC
20:56:22  *** synchris has quit IRC
20:58:37  *** agentw4b__ has joined #openttd
21:02:50  *** agentw4b_ has quit IRC
21:14:47  *** Thedarkb-T60 has joined #openttd
21:41:35  *** smoke_fumus has quit IRC
22:30:40  *** Wacko1976 has quit IRC
22:42:49  *** ToBeFree has joined #openttd
22:51:42  *** Wacko1976 has joined #openttd
22:52:17  *** Wacko1976 has quit IRC
22:52:42  *** Wormnest has quit IRC
23:01:37  *** HerzogDeXtEr has quit IRC
23:43:34  *** chomwitt has quit IRC
23:49:48  *** Progman has quit IRC

Powered by YARRSTE version: svn-trunk