Guild icon
DDraceNetwork
Development / developer
Development discussion. Logged to https://ddnet.tw/irclogs/ Connected with DDNet's IRC channel, Matrix room and GitHub repositories — IRC: #ddnet on Quakenet | Matrix: #ddnet-developer:matrix.org GitHub: https://github.com/ddnet
Between 2019-09-10 00:00:00Z and 2019-09-11 00:00:00Z
Avatar
Would be nice if we could use toggle with commands instead of just values. Existing toggle command example usage: bind pagedown toggle cl_show_quads 0 1 New togglecmd command example usage: bind j toggle_command "bind k kill" "unbind k" The existing toggle analyzes the current value of the variable it's toggling (0 or 1 in above example) and sets it to the _other value. The new togglecmd should just "remember" which cmd was executed last, and execute the _other cmd. ...
Avatar
@fokkonaut you just need std::sort and a lambda function to do the comparison
Avatar
:( Tried that
Avatar
(or you could just use a function, instead of a lambda function if you are old school :P)
11:19
show what you tried
Avatar
When I get home
11:21
I dont have that example anymore tho
11:21
Just the one that sorts it correctly but has 2 entries per entry xd
Avatar
std::sort(v.begin(), v.end(), [](const somestruct &a, const somestruct &b) -> bool { return a.x > b.x; });
11:25
sth like this should be correct
Avatar
I'll try that! Thanks :))
11:28
what is this -> return thing?
Avatar
its an arrow troll (edited)
Avatar
const return
Avatar
@fokkonaut that's literally the only way to explicitly list the return type in lambda functions, otherwise it is inferred, which would also be fine in this case I guess: https://en.cppreference.com/w/cpp/language/lambda
12:03
for non-lambda functions you can also use auto as return type and add an -> if the return type depends on the parameters
Avatar
Well, it works but I get two entries each...
13:36
ahhh
13:36
okay, lol?
13:36
my listdirectory calls every file twice
13:36
but why
13:38
Yea, thats the error. ListDirectory() goes through all files twice it seems
13:40
Is there a fix? Is this a bug? Or do I have to check whether I opened that file already manually?
Avatar
is this CStorage::ListDirectory you are talking about?
13:41
Placing a dbg_msg returning the filename in it, I get each twice
Avatar
what storage type are you using?
13:41
TYPE_ALL
Avatar
is it possible that you have some weird storage.cfg that lists a path twice?
Avatar
current dir, data dir is the same?
Avatar
could be, either way it's because of the TYPE_ALL
Avatar
Well, the files are located in ../files/
13:44
so
Avatar
(still a bug, I guess)
Avatar
one dir back. then in a folder again
Avatar
@heinrich5991 one I wouldn't really know how to fix tbh
Avatar
I dont have a storage.cfg
13:45
Should I just check whether this file has been called already manually for a workaround?
Avatar
../files sounds like you aren't really using storage correctly tbh
Avatar
its a path based on a config var
Avatar
the files are located at ../files relative to what?
Avatar
relative to the binary of course
Avatar
well that "of course" is not at all obvious to CStorage 😛
Avatar
What do you mean? :D (edited)
13:46
should I try placing them in the binary path/files?
13:47
Well no wait
13:47
ahh
13:47
this might be because of my windows
13:47
I have tested this on windows
13:47
and here it is in binarydir/data/files
13:48
no storage.cfg tho
13:48
no, thats not it :/
Avatar
if there is no storage.cfg, the engine adds $USERDIR, $DATADIR, $CURRENTDIR
13:49
TYPE_ALL means check all added paths
Avatar
I will add a storage.cfg and only include CURRENTDIR, then it only checks for the binary dir, right?
13:49
or what is what?
Avatar
$DATADIR is binary dir
Avatar
$CURRENTDIR is cwd, from where your process started
Avatar
listing duplicate names is probably not helpful for CStorage::ListDirectory
13:50
it should probably discard entries with the same name in lower priority folders
Avatar
only DATADIR doesnt work, it cant find the files
Avatar
maybe I'm wrong about $DATADIR
Avatar
$DATADIR is ./data iirc
13:52
looks for data/mapres in cwd
Avatar
cwd?
Avatar
current working directory
13:52
yea
Avatar
if it's not in the current working directory, it checks whether it's in the path from argv[0]
Avatar
add_path $USERDIR add_path $DATADIR add_path $CURRENTDIR add_path $APPDIR
13:53
this is available
Avatar
there is no $APPDIR
Avatar
in 0.7 there is :o
Avatar
damn 0.7 messing around with things again
Avatar
$APPDIR # - usable path provided by argv[0]
Avatar
I have no idea what $APPDIR is or might be, given I haven't read the 0.7 source since oy abandoned it 6 years ago
Avatar
$USERDIR # - ~/.appname on UNIX based systems # - ~/Library/Applications Support/appname on Mac OS X # - %APPDATA%/Appname on Windows based systems # $DATADIR # - the 'data' directory which is part of an official # release # $CURRENTDIR # - current working directory # $APPDIR # - usable path provided by argv[0]
Avatar
what if no usable path is provided by argv[0]
Avatar
idk what that is
Avatar
you'd have to read AddPath to see how $APPDIR is handled
13:56
Anyway, your issue is most definitely one of the paths you are adding is overlapping
13:56
you could just print out the paths to see which ones are overlapping
13:57
if I remove APPDIR it is working
13:57
lol
Avatar
bet it's how they handle "usable" path provided by argv[0]
Avatar
it was the same path as CURRENTDIR, checked the log of the server
Avatar
Yeah "./" and "" are perfectly "usable" paths
14:00
@heinrich5991 the better solution would be to make storage paths a set rather then an array
Avatar
my thing is also needed
14:00
it's intended that storage paths from higher priority override lower priority ones
14:01
for the "are two paths the same" problem, there are probably also solutions. I'd guess that they're not particularly nice
14:01
you could probably stat the directory on linux and compare ino and device number
Avatar
the ugliness can be abstracted into an fs_same_file
Avatar
I think the solution will still be hacky and not work at all times if we do it
Avatar
the override in listdirectory isn't particularly pretty to implement either
Avatar
see the problems around #pragma once
14:03
the problem of "are these two directories the same" is that the question is underspecified IMO
14:03
at least this problem does not exist for the other solution
14:03
*the other bugfix
14:04
I mean we already treat the files as such (OpenFile only opens the highest priority file)
Avatar
i'm sure winapi provides some fancy function with many underscores and an Ex at the end that solves the problem
Avatar
In the C and C++ programming languages, #pragma once is a non-standard but widely supported preprocessor directive designed to cause the current source file to be included only once in a single compilation. Thus, #pragma once serves the same purpose as include guards, but wit...
14:05
Identifying the same file on a file system is not a trivial task.[6] Symbolic links and especially hard links may cause the same file to be found under different names in different directories. Compilers may use a heuristic that compares file size, modification time and content.[7] Additionally, #pragma once can do the wrong thing if the same file is intentionally copied into several parts of a project, e.g. when preparing the build. Whereas include guards would still protect from double definitions, #pragma once may or may not treat them as the same file in a compiler-dependent way. These difficulties, together with difficulties related to defining what constitutes the same file in the presence of hard links, networked file systems, etc. so far prevented the standardization of #pragma once.[citation needed]
Avatar
No underscores but GetFileInformationByHandleEx is a thing
14:07
The shortcomings of compilers is not particularly interesting. comparing ino and devid on linux and the triplet returned by winapi should be enough for our uses
Avatar
okay. the other thing is still needed though, right?
Avatar
yes, definitely
14:08
no idea how to do it without keeping track of the files returned by fs_listdir and then delaying the calling of the callback
14:08
I guess it wouldn't look too bad with a lambda function
14:09
do we have a set in base/tl?
Avatar
no, don't think so
14:10
that's gonna get ugly w/o a container
Avatar
matricks's tl code is so cryptic 😛
15:11
Oh they finally fixed the huge avatars
Avatar
xd
Avatar
Turns out fixing the bugs is more intricate then I predicted earlier
15:12
I don't feel comfortable touching
15:12
it
16:25
but I forgot what I added it for after adding it
16:25
such a productive day 😛
Avatar
Does anyone here got in touch with 0.7 already or do I have most knowledge about it here and you cant help? xd
16:53
16:53
@Learath2 LIAR xd
Avatar
It used to be muuuch bigger 😛
Avatar
It was like this on phone forever
Avatar
@fokkonaut @heinrich5991 is the only person I imagine knows about some of the 0.7 code
Avatar
Mh, well, this could also be known by you
Avatar
I don't think I feel comfortable touching anything about 0.7 yet, too many unknowns about the dev team
16:59
god forbid we spend time implementing things and they just refuse to cooperate, or vanish into thin air again
Avatar
in 0.7, skinchanges arent handled in snap anymore, instead using a CNetjObj_Sv_SkinChange. I created a rainbow, so the skinchange message will be sent every tick to the currently snapping client. If there are about 7 players on the server, it will overload the buffer and disconnect the players one by one (or most of them) for the reason out of buffer. Oy said, this shouldnt even reach the limit of the buffer, and I cannot find out why it does. The client doesnt receive any weird extra packages too or something like that.
Avatar
pleasedont
Avatar
make your rainbow slower
17:03
sending an extra sv skinchange every tick is just very not nice
Avatar
if all the 7 people have rainbow* is what i meant
Avatar
why not ask oy
Avatar
@Learath2 By making it slower you mean sending it every (?) 2 ticks or even more?
Avatar
yep that's what I mean
Avatar
would 2 be enough?
17:04
i guess it wont
Avatar
2 ticks is 25 times a second
17:04
what kinda rainbow is this?
Avatar
a smooth transition rainbow, pretty slow
Avatar
also why did they move the skin changes out of the snap?...
Avatar
They completely removed them at first
17:06
but some people (also me) didnt want to accept that change, so they reimplemented it using a netobj in like 0.7.2 or .1
Avatar
completely removed skinchanges?
17:06
oh I remember this
17:06
such a stupid change
Avatar
yea, needed to reconnect
17:06
yes
17:06
name and clan cant even be changed ingame
17:06
i think country cant aswell
Avatar
yes 0.7 is stupid
Avatar
nah its not stupid
Avatar
I mean those are pretty stupid design decisions
18:22
probably with no reason even
Avatar
Yea, thats true
Avatar
ChillerDragon 2019-09-10 18:32:37Z
so thats why we should be active in 0.7 and make sure they dont fuck things up @fokkonaut does a good job there
18:33
me top1 master
19:04
i didnt expect that many players on 0.7
Avatar
they are masochists
Avatar
more like sadists
Exported 171 message(s)