Version 7 (modified by landauf, 16 years ago) (diff) |
---|
FAQ
TracNav(TracNav/TOC_Development)?
Questions
- Where's the makefile?
- This Styleguide shit is a joke, right? My code just has to work!
- I can't commit anything
- What's that COUT(x) crap?
- I don't get no output in my console/logfile/shell
- I have to call a function requesting a 'MultiType' but all I've got …
- I have to calculate something complicated, are there some helping …
- I have to manipulate a string, are there some helping functions?
- I want to split a string into multiple tokens
- How can I convert a string into a number?
- How can I convert typeX into typeY?
- What is std::string and what should I know about it?
- Why not using const char*?
- What is std::list / std::set / std::map / std::vector / std::stack / …
- Why should I use STL containers? They're so weird!
Where's the makefile?
We use CMake? as build system. Read the wikipage? for more information.
This Styleguide shit is a joke, right? My code just has to work!
No, you're code has to work AND be readable and understandable. Of course every piece of code can be understood somehow, but we don't want to puzzle. So, please, write your code in a common form. The styleguide? helps you on this topic.
I can't commit anything
You have to checkout? the repository via https. Http is anonymous and therefore can't be used to commit something.
What's that COUT(x) crap?
COUT(level) is a macro that works almost exactly like std::cout. The number inside the parentheses denotes the level of the output. Read this for more information.
I don't get no output in my console/logfile/shell
First you have to use COUT to send output to those devices. Then you have to ensure the maximal output level of the concerned device is ≥ the level of your output. You can configure those maximal levels in the config file.
There's a possible third problem: If your output comes too early (before the game has started) and the level of your output is > 2, it wont be displayed by default. If it's just for debuging purpose, change the value temporarily in util/OutputHandler.cc (constructor). If your output is really important for the game, use a lower level.
I have to call a function requesting a 'MultiType' but all I've got is an int/float/string/whatever
Just pass your variable to the function. MultiType? is a class accepting almost all types of variables. C++ will do an implicit conversion. That's exactly the point about the MultiType: no matter what you've got, you can call that fuing function.
I have to calculate something complicated, are there some helping functions?
Probably not, but check out Math? to be sure. If your calculation is of common interest, please put it into util/Math.h too.
I have to manipulate a string, are there some helping functions?
Maybe, check out String? to get an overview of the existing functions. If your stringmanipulation function is of common interest, please put it into util/String.h too.
I want to split a string into multiple tokens
Use SubString?.
How can I convert a string into a number?
Use Convert? or MultiType?.
How can I convert typeX into typeY?
Use Convert? or MultiType? too, it's almighty.
What is std::string and what should I know about it?
std::string is part of the C++ standard. It's more than just a char array: It provides several useful functions, is much easier, more flexible and more safe. But this is not Java, so you will still get a crash if you access a char outside the range of the string. Read the reference for more information.
Why not using const char*?
Trust me, you really don't want to do this. std::string? is SO much easier, it's like day and night. Or like heaven and hell if you excuse the sanctimoniousness.
What is std::list / std::set / std::map / std::vector / std::stack / std::queue / std::pair?
All those are STL containers. They're part of the C++ standard and available on every system. Read the page about STL usage for help and more information.
Why should I use STL containers? They're so weird!
They might look complicated, but as you get used to them, they'll be your friends. Everyone knows STL containers, so no one will missunderstand your code. They're powerful and bug free and are well documented. Please don't implement your own list for every chickenshit.