I’d really like to assist with some of the issues on the Github project page and eventually contribute a mod or two. Of course, there are quite a few source files, and this is my first time looking at contributing to someone else’s project.
Is there general advice one could give regarding becoming more familiar with the high-level purposes of the various, less obviously-named files (like tileray.cpp)? Is it simply a matter of jumping in face-first? Also, I was looking at working out this issue specifically, since it looks relatively straightforward: https://github.com/TheDarklingWolf/Cataclysm-DDA/issues/531
Is there a recommended approach to tackling an issue like this? Personally, I’ve just been reading the code that determines what’s inside vs. outside. But I don’t even necessarily know that that’s the cause of the issue. Is there some more efficient method to debugging this issue than simply reading all the relevant code?
It’s a case of jumping in face-first and figuring out how the code works - and asking questions along the way. It’s a tangled, gnarly mess, and there’s not a whole lot of code documentation at the moment.
Hopefully you pick an easy place to jump into the first time around, and also feel free to ask if something confuses you.
In that particular case… Well, I know that you get unhappy when you’re wet, so I’ll search for “WET” and hope there’s something that matches. Ah, MORALE_WET, exactly what I’m looking for. That’s added in… weather.cpp, in weather_effect:wet. Looking at the if statement, it appears to be PLAYER_OUTSIDE that’s controlling what you want. So, if I then look for what PLAYER_OUTSIDE means, it’s apparently a preprocessor #define that calls map::is_outside. So, I’ll look that function up, and… it uses outside_cache, a 2D array (I think… ew the low-level C). And that’s updated in map::build_outside_cache.
Now, looking at map::build_outside_cache, I don’t see any bugs in that function. So, I suspect the issue is either that the shelter kit terrain isn’t being properly marked as inside, OR the outside_cache array isn’t being refreshed in a case where it needs to be.
Another approach would be to test the tent as well. If the tent doesn’t have the same bug, then look for differences between the tent and the shelter kit, and that might yield results.
Does that step-by-step walkthrough of the debugging process help?
Thanks, that was the exact process I was taking as well (only got as far as map::build_outside_cache before I thought I’d post here). Also, I meant to ask in my original post, but since this is apparently being developed primarily with Code::Blocks, when I right-click something in Code::Blocks, I can find where it’s declared, implemented, and so on. Once I click one of those occurrences, is there any way to jump back to the code I was originally looking at?
For instance, say I right-click some random occurrence I come across of “levz” and find its declaration. Is there some sort of back button so I can quickly go back to looking at the occurrence I was just looking at? That’s a poor example, since the occurrence would be in a .cpp file and the declaration would be in a separate, .h file, but I hope it illustrates what I’m after. That would make reading the code so much easier than it is for me right now.
I think it’s actually being developed mainly with GNU make and gcc, but Code::Blocks is what the current project lead uses (since he’s on Windows). Unfortunately, I don’t know much about how that works, but someone else might.
Glad to hear that you were following a good procedure for debugging, by the way :). Yeah, I’d say that either the shelter kit terrain is buggy, or we need to add another call to map::build_outside_cache somewhere.