Welcome to Niotso Trac

At the moment, this website's purpose is simply to allow for the reading of the Niotso repository in your web browser. However, in the future, we plan to use this website consistently to organize the development of the entire project, among other procedures like accepting bug reports. Documentation of The Sims Online and its technical features is maintained on  Niotso Wiki. Documentation of our own software occurs here on Niotso Trac.

hg URL:  http://hg.assembla.com/niotso

For the compiling guide, see CompileGuide.


Style Guidelines

Character encodings

Encoding: Encode your text files in ANSI (ISO 8859-1) unless there's a specific reason they need to be multilingual.
Newlines: Use Unix newlines in source code. Use Windows newlines in .txt files excluding the ones that are named CMakeLists.txt. A file with a name that is in all caps without a file extension should use Unix newlines.
Tabs: Don't use tabs in any source files except for Makefiles. The subtle issues that show up when you use tabs (gcc line numbering too short, Trac's in-browser source viewer using tab-width 8) do not justify the filesize savings or the reduction of backspaces needed to delete a tab. Set up your editor to produce 4 spaces when you hit the tab key. And learn how to use the home and end keys.
Wrap-around: Don't let your text editor do wrap-around for you. Tell your editor to draw a faint line after the 128th character column, and do not let your code span to the right of that line.
Trailing spaces: You may wish to set up your editor to automatically remove all trailing spaces when you save. Notepad++ does this when you use Alt+Shift+S.

Syntax

if(FileSize > 20){
    //Code
}
for(int i=0; i<5; i++){
    //Code
}
while(i < 5){
    //Code
}
do {
    //Code
} while(i < 5);

switch(Message){

case MSG_KEYPRESS:
    pressed = true;
    break;

case MSG_MOVEX:
case MSG_MOVEY:
    printf("Mouse moved\n");
    break;

case MSG_ERROR: {
    int i;
    //Do something with i
    Shutdown();
} return -1;

}

Conventions

At the top of every source file (.c, .h, .cpp, or .hpp) is a license reminder, either ISC License or GPLv3. If you are creating a new file, your name should be whichever online identifier of your choice, optionally followed by your email address in less-than/greater-than brackets. If you wish to remain anonymous, specify "Anonymous contributor".

Use camel-case for variable and function names. E.g. FileSize? rather than filesize.

Except in a for loop with a constant upper bound, use unsigned integers if it makes no sense for the number you are dealing with to be negative. Leave off the "int" part of "unsigned int". Unless it's part of a struct, which will specifically have padding and won't clobber registers, use a natural integer rather than uint32_t or int16_t or short or anything like that, unless it makes sense. Use chars for strings, not uint8_ts. Don't ever use the short or long (or long long) keywords. short is always better represented as int16_t or uint16_t, and long has different meanings depending on your compiler, even on the same platform (*ahem* Windows).

Do not do "Circle myCircle", "Bone bne", etc. Do "Circle_t Circle" and "Bone_t Bone".

Don't do this:

101|            Graphics::CallThisFunction(x, sqrt(3), texture[Graphics::getid(TEX_BUTTON)], |<- Cutoff line
102|                                       max(foo_bar + OFFSET, SomeConstant),              |
103|                                       AUTODETECT_TYPE | MB_OK, 16777216,                |
104|                                       "Title - Name of the sim, male, a/s/l\n",         |
105|                                       &result);                                         |

Do this:

101|            Graphics::CallThisFunction(x, sqrt(3), texture[Graphics::getid(TEX_BUTTON)], |<- Cutoff line
102|                max(foo_bar + OFFSET, SomeConstant), AUTODETECT_TYPE | MB_OK, 16777216,  |
103|                "Title - Name of the sim, male, a/s/l\n", &result);                      |

Coding reminders

Please remember to use the static, const, and _._restrict (remove the .) keywords. const is not necessary (per se) in the body of a function, but mandatory for pointers/arrays passed as arguments that will not be modified, and things at the global scope which will not be modified.