IRC logs for #openttd on OFTC at 2017-12-29
⏴ go to previous day
00:00:33 <m3henry> I've been tightening up SmallVector<T,S> and I've noticed that the rationale stated in the file "Simple vector class that allows allocating an item without the need to copy this->data needlessly." isn't something it does, and the only advantage it has over std::vector is the ability to set the allocation policy.
00:19:45 *** Eddi|zuHause has joined #openttd
00:25:55 *** Thedarkb has joined #openttd
01:01:59 *** m3henry_ has joined #openttd
01:16:01 *** Thedarkb has joined #openttd
01:41:01 *** ToBeFree has joined #openttd
01:54:48 *** ToBeFree has joined #openttd
02:41:32 *** Eddi|zuHause has joined #openttd
03:12:28 *** ATMunn is now known as Guest685
05:16:06 *** HerzogDeXtEr has joined #openttd
06:09:11 *** PressureLine has joined #openttd
06:09:40 <PressureLine> <3 drinking on a weekday
08:15:41 *** sla_ro|master has joined #openttd
09:00:34 *** andythenorth has joined #openttd
09:56:26 *** tokai|noir has joined #openttd
09:56:26 *** ChanServ sets mode: +v tokai|noir
10:44:25 *** Progman has joined #openttd
10:56:34 *** Progman has joined #openttd
11:19:49 <Borg> I need to understand how I can check for specific industry.. in IndustryList
11:29:57 *** andythenorth has joined #openttd
11:55:40 <Borg> I cant wrap myself in that GS....
12:09:04 *** Celestar has joined #openttd
12:18:18 *** m3henry has joined #openttd
12:27:43 *** Celestar has joined #openttd
12:38:22 <Borg> luicky... standard lame debugging options.. works in GS too
13:32:35 *** Alberth has joined #openttd
13:32:35 *** ChanServ sets mode: +o Alberth
13:38:51 <m3henry> I've been looking at SmallVector<T, S> some more and I've noticed some potential issues
13:40:46 <m3henry> The destructor requires that the contained type is trivially destructible to be safely called at any time, however there are uses of Smallvector which contain non-trivially destructible types
13:41:57 <m3henry> ErasePreservingOrder(uint, uint) requires that the contained type is trivially movable (which is fortunately the case for all uses of that method)
13:43:14 <Alberth> never seen that function :)
13:44:40 <m3henry> Putting a static_assertion on the container for std::is_trivially_destructible<T>::value would be one option, but breaks some uses, alternatively, ensuring the destructor for all remaining elements would prevent a potential resource leak
13:45:10 <m3henry> Alternatively there is std::vector
13:46:45 <m3henry> Not entirely sure what be the best option
13:49:19 <Alberth> don't know about is_trivially_destructible at all
13:52:06 <m3henry> is_trivially_destructible means that the underlying memory can be deallocated without calling the destructor
13:52:38 <m3henry> for the particular type T
13:53:34 *** Gustavo6046 has joined #openttd
13:53:46 <LordAro> Alberth: brace yourself, you're entering the world of template metaprogramming :)
13:53:49 <Alberth> I would say that switching to standard constructs is more useful than trying to make custom constructs safer
13:54:35 <Rubidium> except that I remember getting away from such a construct because it slowed some highly used function (in drawing IIRC) down by a few factors
13:54:58 <Rubidium> just because it kept copying memory around like crazy
13:55:58 *** m3henry has joined #openttd
13:56:15 <Alberth> you got the comment by Rubidium ?
13:57:42 <Alberth> (13:54:35) Rubidium: except that I remember getting away from such a construct because it slowed some highly used function (in drawing IIRC) down by a few factors
13:57:42 <Alberth> (13:54:58) Rubidium: just because it kept copying memory around like crazy
14:00:59 <m3henry> Ah yes, ErasePreservingOrder is never used anywhere in the project
14:01:12 <m3henry> oh no, it is, in the last compiled file
14:02:04 <m3henry> But RefitOptions are trivially move assignable, so there's no issue with its use there
14:05:50 <m3henry> The rationale stated in the file description for SmallVector seems a little odd "Simple vector class that allows allocating an item without the need to copy this->data needlessly."
14:07:23 <m3henry> Is that referring to The allocation policy S being set large enough so that reallocations are unlikely
14:15:42 <Alberth> you are aware that the project runs since 2004, and lots of people have contributed code, and left again, right?
14:16:22 <m3henry> I'm just willing to put in a few hundred hours to make it easier for future developers to modify the project
14:16:23 <Alberth> ie, no idea, I studied the SmallVector interface two times or so, and that's it
14:16:49 <Alberth> you already know way more than I do
14:17:10 <andythenorth> definitely more than I do :)
14:17:19 <Alberth> but you may want to start with the more harmless uses
14:18:11 <Rubidium> m3henry: IIRC it was that you first allocate the memory on stack and then copy that to the vector, instead of just getting a pointer from the stack with the memory address to write the data to
14:19:28 <Rubidium> but to be brutally honest, it's all vague and fuzzy as it's quite a while ago for me
14:21:16 <m3henry> But yeah, I'd rather not start proposing large changes to the project without first talking about it to gain an idea of what solutions would be most acceptable
14:23:22 <Rubidium> it might also be that the code that used that is gone by now, but I have no clue
14:23:53 <m3henry> It's heavily used it would seem
14:28:45 <Borg> m3henry: thats kinda strange what u say
14:29:50 <Borg> m3henry: delete value <- this is not trival dealloc... destructor will be called if necessary
14:30:07 <Borg> but.. I might be wrong ;) I got rusty in C++
14:31:23 <m3henry> Ah, the implementation of SmallVector<T,S> uses malloc()/free() rather than new/delete
14:32:15 *** Thedarkb has joined #openttd
14:32:26 <Borg> nice abomination mix I see here ;) mixing malloc() vs new is bad
14:32:50 *** mindlesstux has joined #openttd
14:32:52 <Alberth> c++ also has malloc :p
14:33:05 <Borg> of course it has.. but as I said.. mixing those 2 is bad idea
14:33:22 <Alberth> but it's a 300K program converted from C to modern C to C++ in a deade
14:33:24 <m3henry> free doesn't do any destruction of objects deallocated by a call to it, it just makes the memory available to the heap
14:33:36 <Borg> Alberth: ahh :) didnt know it...
14:33:55 <Borg> Alberth: well.. git grep -F malloc
14:34:06 <m3henry> delete and delete[] destroy the object[s] and then make the memory available to the heap
14:34:25 <Alberth> I know it uses malloc, and I don't see the problem, as long as you use it consistently
14:34:49 <Alberth> and are aware of the differences, of course
14:35:03 <m3henry> I was clarifying for Borg
14:35:30 <Borg> m3henry: thank you :) but no need to.. I know the basics
14:35:46 <Alberth> I agree you wouldn't write it in mixed new and malloc if you write a new program, but 300K lines isn't easily converted
14:36:34 <Alberth> and there is code in there that hasn't been touched in ages
14:36:38 <Borg> anyway! OpenTTD time.. time to play w/ my very first simple GS!
14:37:37 <m3henry> And with smart pointers and containers, using new is rarely warrented
14:42:12 <m3henry> I suppose what I'm really asking is, should I invest time in tightening up SmallVector, or moving instances to use std::vector?
14:42:22 <LordAro> Alberth: from machine code to C, as well
14:43:01 <Alberth> making new obsolete is relatively recent
14:43:09 <Alberth> LordAro: fair enough :)
14:43:28 <Alberth> I'd start with the non-time critical cases
14:43:53 <LordAro> Alberth: bits of openrct2 looked far too familiar to refute ottd's origins anymore
14:44:33 <Alberth> afaik the decoders used openttd as source of inspiration
14:44:44 <m3henry> That sounds like move to std::vector then
14:44:57 <Alberth> so it would be logical to see bits of openttd in it
14:44:58 <LordAro> m3henry: the latter, imo
14:45:25 <Alberth> m3henry: for the non-time critical cases, I see no objection to a move to std::vector, do you?
14:45:51 *** sim-al2 has joined #openttd
14:46:04 <Alberth> no idea how many would remain then
14:46:47 <m3henry> Between std::vector and std::array, custom contiguous containers seem moot
14:47:33 <m3henry> I have no idea how many tens of thousands of hours have gone into ensuring they are optimized and as tight as possible
14:54:28 <LordAro> technically, it depends on your usecase
14:54:38 <LordAro> but i'd imagine ottd covers none of those :)
14:56:55 *** m3henry has joined #openttd
15:11:54 *** Celestar has joined #openttd
15:18:06 *** m3henry_ has joined #openttd
15:43:43 *** m3henry_ has joined #openttd
15:48:44 <Borg> guys, is that me.. or I cannot find rag_signals_density in config options in GUI anymore?
15:48:57 <Borg> drag_signals_density I mean
15:49:28 <Eddi|zuHause> in the signal gui, probably?
16:17:39 *** andythenorth has joined #openttd
16:45:13 <Borg> why this doesnt work in GS:
16:55:45 *** andythenorth has joined #openttd
16:58:41 <Alberth> difference between entry creation and assignment of existing entry
16:58:47 <Alberth> and yeah, it's ugly :)
17:00:43 <Borg> loooks good.. GRF works.. GS works :)
17:00:44 <andythenorth> FIRS 3 was 900 commits so far
17:00:47 <Borg> no... need to find players ;)
17:00:52 <andythenorth> whatever that means
17:10:58 <andythenorth> should I release FIRS 3?
17:11:00 *** Wormnest has joined #openttd
17:13:28 *** m3henry_ has joined #openttd
17:29:18 *** m3henry_ has joined #openttd
17:29:58 <andythenorth> so is that tacit consent?
17:30:03 <andythenorth> or tacit refusal? :P
17:44:35 *** Gustavo6046 has joined #openttd
17:46:12 <Borg> who here said.. that stockpiling is.. bad... ?
17:48:50 <andythenorth> I have...opinions :P
17:49:14 <Borg> kinda? nah.. I love it ;]
17:49:22 <Borg> makes production smoother..
17:49:33 <Borg> Of course it depends on GRF I guess
17:49:57 <Borg> Ive done my own stuff here.. and Prod Industries adjust production smoothly.. based on transported ratio + stockpiles
17:50:19 <Borg> so no cry when u start chain from source.. ;) not much is gonna be wasted
17:50:26 <supermop> andy prefers the stockpile a few tiles away to give an excuse for various vehicles to carry the stuff around the industry?
17:51:04 <andythenorth> is it stockpiling + rejection?
17:51:10 <andythenorth> (acceptance limits)
17:51:15 <andythenorth> or just a fixed processing rate?
17:51:27 <Borg> stockpiling + rejection.. and processing rate is not fixed
17:51:38 <andythenorth> yeah I dislike stuff that messes up the network :D
17:51:43 <andythenorth> and make GS goals impossible
17:52:33 <Alberth> make 3.0.0 before next year!
17:52:39 <Borg> I wonder how it can interferre with GS goals..
17:52:53 <andythenorth> I did try cargo rejection in FIRS, but it was quickly removed :)
17:53:06 <Borg> andythenorth: why? :) complains?
17:53:11 <Borg> also.. I use temporary cargo reject...
17:53:16 <Alberth> "give factory X lots of cargo in little time"
17:53:18 <Borg> so.. its dumped.. but no payment ;D
17:53:44 <Borg> so.. its funny to see how overloaded factory gives u no profit or even costs! if you have transfers
17:53:53 <Alberth> "make X money by bringing cargo to Y factory in little time"
17:54:18 <andythenorth> so it doesn't stop accepting at station?
17:54:39 <andythenorth> stopping acceptance messes with cdist
17:55:03 <Borg> yeah.. also would be annoying to me.. to get info that cargo is not accepted w/o serious reason
17:55:11 *** m3henry_ has joined #openttd
17:55:26 <Alberth> I'd just introduce a delay in giving output, process "current waiting input / 10" and give that as output
17:55:58 <Alberth> means you get what you provide, but not instantly
17:56:07 <Borg> Alberth: nah.. cargo drop is instant
17:56:15 <Borg> cargo output is not... so it should not mess w/ simple target
17:56:19 <Alberth> cargo drop is, cargo output is not
17:56:30 <Borg> yep.. so if you have cargo output GS.. then yes
17:56:42 <andythenorth> it's not a problem
17:56:49 <andythenorth> my prejudices aren't golden rules :P
17:57:01 <Alberth> it can't, GS has no influence on output of industries
17:57:28 <Alberth> we fork andy, and change him :)
17:57:49 <Alberth> hmm, perhaps better fork firs 3 :p
18:05:44 <m3henry_> If I wish to submit a fix which closes an issue, should I request closure of the issue after adding the patch in a comment?
18:10:27 <Alberth> just mention that it fixes the issue
18:44:22 <Borg> I reduced distance between signals to 6 tiles...
18:44:29 <Borg> looks and plays better.. but I feel... bad.
18:47:01 <Alberth> openttd is not a simulation of reality :)
18:47:40 <m3henry_> Fair enough, I was just wondering if I'd missed something when fixing FS#6642
18:47:53 <Borg> but anything below that.. is profanation. imo..
18:49:13 <Alberth> slightly longer than the train length seems best to me, but others disagree :)
18:49:52 <Borg> well.. in my case its not an option ;D as I can have 14 tiles long trains here and there
18:50:03 <Borg> but on curves. calcs were annoying
18:50:19 <Borg> w/6 are much better to perfome.. counting to 5.. and next semaphore
18:52:00 <LordAro> m3henry_: looks fine, you just have to get someone to notice now
18:55:46 <m3henry_> If it gets left along for a week I'll prod <insert name to prod>
19:01:29 <LordAro> m3henry_: why wait? Alberth is right here? :p
19:06:15 * m3henry_ checks if this is the cmd for this
19:19:58 *** mindlesstux has joined #openttd
19:45:39 *** andythenorth has joined #openttd
20:25:10 * Wolf01 is counting lego parts from the last order
20:27:55 *** sla_ro|master has joined #openttd
21:13:37 *** Gustavo6046 has joined #openttd
21:48:43 <Wolf01> Just finished counting
21:49:49 <Wolf01> I miss 1 really common part (a technic pin, 39 instead of 40, I needed 27 of them) but I have 1 more of the new quarter round tiles :P
22:19:39 *** Breckett has joined #openttd
22:29:48 *** sim-al2 has joined #openttd
22:42:19 <Wolf01> It seem I started a constructive discussion for NRT in the forum
22:43:31 <Samu> bah, my poe character died
23:04:51 *** Guest722 has joined #openttd
23:06:25 <Guest722> question: I'm playing UK v3 scenario with Japanse v3.3 trainset but I don't have multi-carriages for the Shenkansen
23:07:22 <Guest722> I tried the trainset add-on but that had version 3.1 orso and gives a conflict
23:07:31 *** Thedarkb has joined #openttd
23:09:21 *** Guest722 is now known as pietje
23:18:58 *** Gustavo6046 has joined #openttd
23:22:47 *** Gustavo6046 has joined #openttd
23:23:47 *** ZexaronS has joined #openttd
23:27:18 <pietje> has anyone played the UK v3.04a4 scenario? Which trainset works the best?
23:46:52 *** mindlesstux has joined #openttd
23:51:23 *** mindlesstux has joined #openttd
continue to next day ⏵