








struct Context {
handler: Handler,
}
struct Handler {
context: Arc<Context>
}
impl Handler {
fn new(context: Arc<Context>) -> Self {
Handler { context }
}
}
let context = Context { handler: Handler::new(..); };
How would you handle something like this?







struct Context {
handler: Handler,
}
struct Handler {
context: Arc<Context>
}
impl Handler {
fn new(context: Arc<Context>) -> Self {
Handler { context }
}
}
let context = Context { handler: Handler::new(..); };
How would you handle something like this? 


Vec<Box<dyn Module + Send + Sync>> in it, it'll soon also have utility functions modules can use on it




Vec<Box<dyn Module + Send + Sync>> in it, it'll soon also have utility functions modules can use on it 



struct Context {
handler: Handler,
}
struct Handler {
context: Arc<Context>
}
impl Handler {
fn new(context: Arc<Context>) -> Self {
Handler { context }
}
}
let context = Context { handler: Handler::new(..); };
How would you handle something like this? 
Weak is a version of Arc that holds a non-owning reference to the managed allocation. The allocation is accessed by calling upgrade on the Weak pointer, which returns an Option>.

Vec can store a trait object without box

Vec needs fixed size


Vec can store a trait object without box 

A is fixed size




struct Context {
handler: Handler,
}
struct Handler {
context: Arc<Context>
}
impl Handler {
fn new(context: Arc<Context>) -> Self {
Handler { context }
}
}
let context = Context { handler: Handler::new(..); };
How would you handle something like this? 
Vec<&(dyn Module + Send + Sync)>




std::shared_ptr
struct Handler * and struct Context *



Arc because it's a memleak

Arc because it's a memleak Weak is a version of Arc that holds a non-owning reference to the managed allocation. The allocation is accessed by calling upgrade on the Weak pointer, which returns an Option>.


Arc because it's a memleak 




Option there and it'll create the same dependency
Option alone, it won't work, but by adding Mutex you could make it work

Option alone, it won't work, but by adding Mutex you could make it work 


Option<> after the creation of the Arc anymore

Context and Handler?



goto may offend some developers
goto_switch [id]. Which will set the clients view port to the first occurrence it finds of that switcher in the map. If the command ...

Context and Handler? Context is a set of global stuff like the SqlitePool, the discord api client, a http client, bots current state, it's current user_id
Handler is a handler to initialize and dispatch events to Modules
Modules will call back into the Handler for registering what should be dispatched to them












Modules using utility functions in Handler, it needs a copy of the context, I'll just think of something else


Context and Modules live for the entire duration of the program so it's not too too bad 
CMapBasedEnvelopePointAccess::SetPointsRange function so the start point and number of points that should be considered when using this envelope point storage can be configured. In the editor, this range always includes all points, as each envelope directly stores only its own points, so animations were rendered correctly there. However, all points are stored in one array when loading them from the map file (i.e. when rendering the map ingame), so the start point and number of points sp...








Weak? Am I supposed to be upgrading it before use so I can make sure it doesn't get dropped while I'm using it?



Weak? Am I supposed to be upgrading it before use so I can make sure it doesn't get dropped while I'm using it? 

Weak? Am I supposed to be upgrading it before use so I can make sure it doesn't get dropped while I'm using it? 



goto


















































2









m_RenderPrev and m_RenderCur, the client interpolates between those two so it looks smooth the the eye (edited)












UI()->MouseDeltaY() actually returns? I would expect it to return the change of the y coordinate in whatever unit all other stuff is. So that UI()->MouseDeltaY() / View.y would give the percentage the mouse moved in the View. It seems to work fine for x, but not for y coordinates








UI()->MouseDeltaY() actually returns? I would expect it to return the change of the y coordinate in whatever unit all other stuff is. So that UI()->MouseDeltaY() / View.y would give the percentage the mouse moved in the View. It seems to work fine for x, but not for y coordinates 


UI()->MouseDeltaY() / Graphics()->WindowWidth(). So I tried multiplying it with Graphics()->WindowWidth() / Graphics()->WindowHeight() but its still off











MapScreenToWorld does

















pub const fn as_nanos(&self) -> u128 {
self.secs as u128 * NANOS_PER_SEC as u128 + self.nanos.0 as u128
}

u64 nanos in a Duration, but a Duration can have more nanos than fit into a u64

2**64-1 seconds + 10*9-1 nanoseconds, I believe




















































m_vTextureIndices[TextureID.Id()]











































m_vSpriteHelper state variable so it's not thread-safe























# in the URL




















dbg_dummies 31 or 63 and reload: https://github.com/Robyt3/ddnet/tree/Debug-Server-Dummies-Skins-KillMsg

libpng: warning for file "downloadedskins/Bat.15596.tmp": iCCP: known incorrect sRGB profile


libpng: warning for file "downloadedskins/Bat.15596.tmp": iCCP: known incorrect sRGB profile 




downloadedskins folder and more than 80% of those files are .tmp files







bluekitty .7612.tmp



bluekitty (with a space at the end) then this should make a request to https://api.skins.tw/api/resolve/skins/bluekitty%20.png, as confirmed by adding debug logs for this variable:
https://github.com/ddnet/ddnet/blob/3991d199667d133a220758b3e0def3e75911a1b2/src/engine/shared/http.cpp#L232
However, this actually seems to make a request to https://api.skins.tw/api/resolve/skins/bluekitty.png (without the space), as the download is successful, hence `downloadedsk...






