Learning with the TMW code
Posted: 24 Oct 2008, 12:14
Well, I only know the basics of coding in a couple of languages, so I figured to try to delve some more into this. By working with the TMW code. Here are some questions, which you’re free to answer.
At the moment I’m working with the 0.0 client.
src/gui/item_amount.cpp:
src/gui/sell.cpp
Questions
EDIT (12.57 UTC)
I think I figured out the first question, it seems to be all about scope. I tested to add a function (private class method) and suddenly I believe I realised some things...
EDIT (13.26 UTC)
New question:
• When I tried to make changes in scope and do things in a more advanced way, TMW segmentsfaults.
Is there a way to check where this happens, without adding a lot of write-to-output-snippets in the code?

src/gui/item_amount.cpp:
Code: Select all
amount = static_cast<int>(mItemAmountSlide->getValue());
Code: Select all
mAmountItems = (int) mSlider->getValue();
- Variable or class member, which is preferred? Or, is there a reason to use the one in one place but not in the other? (amount vs mAmountItems)
- How to use one datatype as another? (static cast vs “whatever it is namedâ€ÂÂ)
EDIT (12.57 UTC)
I think I figured out the first question, it seems to be all about scope. I tested to add a function (private class method) and suddenly I believe I realised some things...
EDIT (13.26 UTC)
New question:
• When I tried to make changes in scope and do things in a more advanced way, TMW segmentsfaults.
