Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Mon Nov 20, 2017 11:30 am

All times are UTC




Post new topic  Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Wed Nov 21, 2007 12:09 pm 
Offline
Transport Empire Moderator
Transport Empire Moderator
User avatar

Joined: Fri Jan 10, 2003 12:21 pm
Posts: 2125
Location: Wroclaw, Poland / Katowice, Poland
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:
memberlist.php?mode=viewprofile&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

_________________
All art and vehicle stats I authored for TT and derivatives are as of now PUBLIC DOMAIN! Use as you see fit
Just say NO to the TT fan-art sprite licensing madness. Public domain your art as well.


Top
   
PostPosted: Thu Nov 22, 2007 3:17 am 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
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?

_________________
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser


Top
   
PostPosted: Thu Nov 22, 2007 10:05 am 
Offline
Transport Empire Moderator
Transport Empire Moderator
User avatar

Joined: Fri Jan 10, 2003 12:21 pm
Posts: 2125
Location: Wroclaw, Poland / Katowice, Poland
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

_________________
All art and vehicle stats I authored for TT and derivatives are as of now PUBLIC DOMAIN! Use as you see fit
Just say NO to the TT fan-art sprite licensing madness. Public domain your art as well.


Top
   
PostPosted: Fri Nov 23, 2007 3:15 am 
Offline
TTDPatch Developer
TTDPatch Developer

Joined: Wed Feb 18, 2004 3:06 am
Posts: 10285
uzurpator wrote:
No char* for text output
So one has to do this:
Code:
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:
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?

_________________
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser


Top
   
PostPosted: Fri Nov 23, 2007 10:20 am 
Offline
Transport Empire Moderator
Transport Empire Moderator
User avatar

Joined: Fri Jan 10, 2003 12:21 pm
Posts: 2125
Location: Wroclaw, Poland / Katowice, Poland
DaleStan wrote:
uzurpator wrote:
No char* for text output
So one has to do this:
Code:
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:
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.

_________________
All art and vehicle stats I authored for TT and derivatives are as of now PUBLIC DOMAIN! Use as you see fit
Just say NO to the TT fan-art sprite licensing madness. Public domain your art as well.


Top
   
PostPosted: Sat Nov 14, 2009 12:31 am 
Offline
Engineer
Engineer

Joined: Sun Jul 16, 2006 11:50 pm
Posts: 25
well i better get learning C++ haha


Top
   
PostPosted: Sun Aug 15, 2010 11:19 pm 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Tue Dec 21, 2004 5:35 am
Posts: 185
Skype: andrey-zaharov
Location: St. Petersburg, Russia
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 :()


Attachments:
File comment: First successful run after hundreds fails
te.png [220.55 KiB]
Downloaded 2 times
File comment: Patch to make project linux buildable
gcc.patch [70.3 KiB]
Downloaded 136 times
File comment: CMake list for te4 separately (included in patch)
CMakeLists.txt [2.87 KiB]
Downloaded 135 times

_________________
OpenTTD Hard Game Pack
Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000-2017 phpBB Limited

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2017.
Hosted by Zernebok Hosting.