Config
Log for #openttd.dev on 16th March 2013:
Times are UTC Toggle Colours
03:41:19  *** Dewin has joined #openttd.dev
05:56:39  *** Dewin has quit IRC
08:16:47  *** Meechmunchie has joined #openttd.dev
08:25:11  *** Alberth has joined #openttd.dev
08:25:11  *** ChanServ sets mode: +v Alberth
08:55:01  *** fonsinchen has joined #openttd.dev
08:55:01  *** ChanServ sets mode: +v fonsinchen
09:22:18  *** Meechmunchie has quit IRC
10:57:54  *** frosch123 has joined #openttd.dev
10:57:55  *** ChanServ sets mode: +v frosch123
11:47:50  *** Ristovski has joined #openttd.dev
11:57:05  <fonsinchen> I've changed the link graph internals again, providing more intuitive (and different) APIs for component handlers and the main game.
11:57:42  <fonsinchen> However, due to certain architectural decisions I cannot return references from operator* of Edge and Node iterators.
11:58:19  <fonsinchen> Instead a wrapper object which allows some operations on the real edge or node (provided as pointer) is returned as value.
11:58:56  <fonsinchen> That is somewhat against the spirit of operator* and it prevents an implementation of operator->.
11:59:26  <fonsinchen> So you cannot do i->DoSomething(), but only (*i).DoSomething()
11:59:51  <fonsinchen> Is such a thing acceptable by our coding standard?
12:00:53  <frosch123> i doubt there are many operator* in ottd :üp
12:01:11  <frosch123> anyway, personally i have implementend operator* without refercenes multiple times
12:01:25  <frosch123> with some wrapper class you can also implement -> btw.
12:01:53  <fonsinchen> Only works if I can actually return a pointer. However, as the object is a temporary, I can't.
12:01:59  <fonsinchen> (or shouldn't)
12:02:19  <frosch123> yes, thus the returned wrapper class has to contain a temporary copy
12:02:55  <fonsinchen> Of what? How would I do that?
12:03:02  <frosch123> class Foobar : public T { public: T* operator->() { return this; } };
12:03:08  <frosch123> instead of returning T*, return Foobar
12:03:14  <frosch123> as temprary object
12:03:32  <frosch123> which holds a temporary object of T
12:04:05  <frosch123> since -> is chained, using -> on your original class will chain into Foobar::->
12:05:39  <fonsinchen> So, FooBar is some iterator. FooBar::operator* would return a T, right?
12:06:06  <frosch123> no, Foobar is only  wrapper returned by your original operator->
12:06:24  <frosch123> you will never have access to it directly
12:06:36  <fonsinchen> ah, I see.
12:06:45  <frosch123> since you only get it via ooperator-> which immediately chains to T*
12:07:07  <fonsinchen> Thanks for the hint.
12:07:32  <frosch123> anyway, it's not too bad to just skip operator-> to force people to store the result of operator* locally to access members multiple times
12:07:48  <frosch123> instead of using -> and doing a temporary copy on every access
12:09:15  <fonsinchen> The compiler would optimize that out due to common subexpression most of the time.
12:09:52  <fonsinchen> At least I hope so. Otherwise the whole thing I'm doing there is a big hit on performance anyway ...
12:10:34  <frosch123> i would consider the decision that construction of a temporary object has no side effects very hard
12:10:41  <frosch123> so, i doubt it will optimise it
12:10:59  <frosch123> maybe if the object is POD
12:12:17  <fonsinchen> It doesn't do anything in its constructor.
12:13:54  <fonsinchen> The object consists only of pointers to the actual data, providing some methods for manipulating it.
12:14:36  <frosch123> well, check the disassembly in the debugger to be sure :)
12:14:44  <frosch123> if it is important
12:15:12  <frosch123> damn... where is the code to scroll the main viewport with cursor keys :o
12:16:01  <fonsinchen> Maybe I'll just profile the two versions against each other to see if there's a significant difference.
12:16:55  <frosch123> wow... there is a special _dirkeys
12:25:47  <Alberth> amazing what you find when look at random code :)
12:28:16  <frosch123> hmm, so i think i fixed fs#5504 :) except it's only for sdl and does not work for the keypad comma/delete key :)
12:28:24  <frosch123> is that good enough? :p
12:31:43  <frosch123> so, how to distinguish whether stuff wants to test for the delete key, or for the numpad-delete hotkey? :s
12:32:33  <frosch123> in the former case i want to map the key to ","/delete, in the latter case to something third
12:38:32  <fonsinchen> The delete key should be equivalent to numpad-delete if numlock is off.
12:38:50  <fonsinchen> otherwise it should be equivalent to comma.
12:41:24  <fonsinchen> You shouldn't be able to configure numpad-delete and "normal" delete or numpad-comma and "normal" comma separately, I think.
12:41:33  <fonsinchen> It will just confuse people.
12:50:28  <frosch123> i think sdl already solved the issue
12:50:43  <frosch123> it's just ottd which messes up the difference between characters and scancodes again
12:51:36  <frosch123> hotkeys go by scancode
12:51:43  <frosch123> textediting goes by character
12:52:04  <frosch123> while characters include stuff like enter and cursors
12:52:09  <frosch123> delete and insert
14:52:12  <fonsinchen> The branch with the new version of the link graph API is "linkgraph8", btw. It needs some polish, but the functionality is there.
14:52:16  <fonsinchen> bye
14:52:21  *** fonsinchen has quit IRC
18:43:22  *** DorpsGek changes topic to "OpenTTD Dev Channel || Latest SVN: r25088 || Logs: http://webster.openttdcoop.org/?channel=openttd.dev || Voice (talk-right) upon request via #openttd; make sure you are registered to NickServ before asking"
18:45:30  *** Meechmunchie has joined #openttd.dev
19:02:53  *** Meechmunchie has quit IRC
19:22:20  *** Dewin has joined #openttd.dev
19:45:04  *** Supercheese has joined #openttd.dev
20:47:18  *** frosch123 has quit IRC
22:26:27  *** FLHerne has joined #openttd.dev
22:35:21  *** Alberth has left #openttd.dev
23:02:12  *** Ristovski has quit IRC

Powered by YARRSTE version: svn-trunk