Page 1 of 1

Transport Empire Developer Handbook

Posted: 21 Nov 2007 12:09
by uzurpator
This document is permanently Under Construction.

Transport Empire Prtential Developer Handbook:

1. How to get the source

The Source is available at svn://svn.transportempire.com/trunk/transport_empire_4
Currently it contains only win32, VC10 project and dependancies.


2. How to get the dependancies

TEmpire uses several dependancies to build they include:

Boost - http://www.boost.org/
Ogre - http://www.ogre3d.org

Boost is a gargantuan set of libraries. We actually use only:

3. How to build

TEmpire should port easily to any operating system. Current build however relies on
a few windows specific functions (see timing.h).

Unfortuneatly you have to build yourself a makefile on any platform that is not win32

4. How to submit changes

To submit changes you have to contact our project maintainer - Steve:
http://www.tt-forums.net/memberlist.php ... ile&u=2023

While submitting make sure that the code you have submitted actually
compiles and runs well.

5. General coding tips

Note that TEmpire is a C++ code. This means that it is a template/class/std::
bonanza. Ie you should prefer:

std::string to char*,
std::vector<int> to int[],
cout << "stuff", to printf("stuff")

While nobody will kill you if you use those functions in your own
code - ie inside a class, however when dealing with class interfaces then:

__IT IS STRICTLY FORBIDDEN, UNLESS EXPLICITLY ALLOWED IN SPECIAL
CASES, TO USE C SPECIFIC SOLUTION WHEN C++ SOLUTUION IS AVAILABLE__

This is pretty much the only rule of the project :>

As for formatting your source file, the format is available in template.txt in the source.

6. Reserved for future use

Re: Transport Empire Developer Handbook

Posted: 22 Nov 2007 03:17
by DaleStan
uzurpator wrote: __IT IS STRICTLY FORBIDDEN, UNLESS EXPLICITLY ALLOWED IN SPECIAL
CASES, TO USE C SPECIFIC SOLUTION WHEN C++ SOLUTUION IS AVAILABLE__
Define "C specific solution". Unless you're using class, template, typename, this, public, protected, or private as names (which would be incredibly stupid, and should be forbidden) all valid C code is also valid C++ code. Does this mean that no code that a C compiler would accept is permitted? That will make things ... difficult.

Also:
boost::format vs *printf?
std::vector of boost::any vs va_list et al?

Re: Transport Empire Developer Handbook

Posted: 22 Nov 2007 10:05
by uzurpator
It means:

No void* or void**
No char* for text output
No type[] unless their size is constant (but then boost::array is better)
No defines if template/inline is possible
Avoid globals
no #define value 10 (prefer const int value 10)

all this however is on the module (class) interface. I don't want any ownership or allocation problems between classes. Whatever an author does inside of his class is completely up to him/her

The intent is to ecourage using of modern solutions instead good ol

Re: Transport Empire Developer Handbook

Posted: 23 Nov 2007 03:15
by DaleStan
uzurpator wrote:No char* for text output
So one has to do this:

Code: Select all

cout<<string("My text\n"):
I'm sure I don't have to tell *you* this, but for the benefit of others, "My text\n" is a char*, and sending it direct to cout is clearly using it for output.

Code: Select all

const int value 10
Not legal in either C or C++. After applying the obvious corrections, the code is valid in both. What makes this a C++ solution?

Re: Transport Empire Developer Handbook

Posted: 23 Nov 2007 10:20
by uzurpator
DaleStan wrote:
uzurpator wrote:No char* for text output
So one has to do this:

Code: Select all

cout<<string("My text\n"):
I'm sure I don't have to tell *you* this, but for the benefit of others, "My text\n" is a char*, and sending it direct to cout is clearly using it for output.
that is

cout << const char *;

which is a compile time constant. Not a dynamically allocated buffer which is printf'ed/strcmp'ed and there is nothing done to it.

Code: Select all

const int value 10
Not legal in either C or C++. After applying the obvious corrections, the code is valid in both. What makes this a C++ solution?[/quote]

Because C programs tend to prefer #define to do A LOT of things, and overuse of macros is dangerous - especially with the lack of namespaces.

Re: Transport Empire Developer Handbook

Posted: 14 Nov 2009 00:31
by MrSmoke
well i better get learning C++ haha

Re: Transport Empire Developer Handbook

Posted: 15 Aug 2010 23:19
by Vaulter
Wow! I did it!
Thank for posts and readmes!

ps: see some threads issues..... will fixing
pss: attach to make project actual compile with GCC (ownership_manager for a now disabled :()