Hello,
I found this part of code on github, its from some Dwarf Fortress mode. link (it starts on line 946)
[source lang="cpp"]
void paintboard()
{
uint32_t starttime = clock();
int op, src, dst, alpha_op, alpha_src, alpha_dst;
al_get_separate_blender(&op, &src, &dst, &alpha_op, &alpha_src, &alpha_dst);
al_set_separate_blender(ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO,ALLEGRO_ADD, ALLEGRO_ONE, ALLEGRO_ZERO);
if(config.transparentScreenshots)
{
al_clear_to_color(al_map_rgba(0,0,0,0));
}
else
{
al_clear_to_color(al_map_rgb(config.backr,config.backg,config.backb));
}
al_set_separate_blender(op, src, dst, alpha_op, alpha_src, alpha_dst);
// lock segment for painting and retrieve it.
map_segment->lock();
WorldSegment * segment = map_segment->get();
...
[/source]
I am thinking about variable map_segment, because it wasnt declared in this function nor passed. But I dont think there is a mistake. So can you tell me how is this possible?
Thanks for answers
Explanation of code - no declaration of variable
Just as a side note - that code comes with a solution file for Visual Studio. If you download that you can right-click on any variable, constant (basically any identifier) and click "Go To Definition".
Brilliant tool for looking at other people's code.
Brilliant tool for looking at other people's code.
Just as a side not that code comes with a solution file for Visual Studio. If you download that you can right-click on any variable, constant (basically any identifier) and click "Go To Definition".
Brilliant tool for looking at other people's code.
Or hit F12. I hit it all the time.
[size=2]Why was this downvoted? I mean, seriously? Negated..
[rollup='Moderator response (collapsed so as to not fill the topic with off-topic chat)']
If you hover over the down-vote button you'll see some descriptive text pop up saying "this response is not useful and does not improve the conversation"; I'm guessing someone thought that appropriate given Acotoz gave a less detailed version of the exact same response that the previous user (Cornstalks) had already given around three and-a-half hours earlier. Personally -- although I didn't go to the effort of down-voting the post myself -- I'd have to agree: even though the post is factually correct, taken in context it's a pointless response that adds no value what-so-ever to the conversation, and as such down-voting it is correct usage of the system.
This is all well-and-truly off-topic however, and I'd ask you not to risk disrupting topics with this sort of post in future -- if you want to query a vote (or the concept of voting in general) you can make a topic in the Comments, Suggestions & Ideas forum, or contact a moderator privately -- we do investigate abuses of the system and have on occasion reversed votes we believe to be unfair or out of keeping with the spirit in which the system was intended.[/rollup]
It would be appreciated if there were no further off-topic replies from this point onward.
Wait a minute, I thought I was the first response of this forum post.
That's why it seems like I'm posting something pointless
That's why it seems like I'm posting something pointless
A short time after the previous reply was posted that would be perfectly excusable... over three hours after the previous response though...? In any case...
It would be appreciated if there were [color=#ff0000]no further off-topic replies from this point onward.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement