C Type explanation request

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

C Type explanation request

Post by belugas »

I'm sorry to ask, but could anyone give me the byte lenght of those C Types?
I'm trying to translate OpenTTD to Delphi, and i'm really puzzled by these :

int
uint

Are they Signed/Unsigned 32 bytes or Signed/Unsigned 16 bytes?

Thanks
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

You could've looked it up yourself:

Code: Select all

typedef unsigned int uint;
typedef unsigned int uint32;

Code: Select all

assert_compile(sizeof(uint32) == 4);
int is signed int 32, uint is unsigned int 32, at least we assume so for OpenTTD.


Btw, why and how are you translating OpenTTD to Delphi?
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Post by belugas »

I guess I could have found it myself indeed, but it would take me days and days of searching...

I'm a senior delphi programmer at work without any knowledge of C.
So I though that it might be a good idea for me to learn from the pros ;)
Why not do it with OpenTTD.

I downloaded the sources from SourceForge, then I started working on h files, renamed "h.pas". I'm using delphi 7, in order to be able to compile on 2 platforms.

No tools, simply reading and understanding C...
Hard job... :(
Bjarni
Tycoon
Tycoon
Posts: 2088
Joined: 08 Mar 2004 13:10

Post by Bjarni »

you know, OpenTTD might be a really bad choice for this since the code is rather complex. Also you learn C best if you code in C. Try some self learning book instead..... translating 126k of code where seasoned C coders might not understand all of it is not a good place to start. Get the source and compile to play it and maybe even try to write a patch for it if you feel like you can manage, but translating all of it.... forget it. It's a project that will take years to do, even if you know the language well
User avatar
belugas
OpenTTD Developer
OpenTTD Developer
Posts: 1507
Joined: 05 Apr 2005 01:48
Location: Deep down the deepest blue
Contact:

Post by belugas »

Well.. I agree that it is quite a pile of work.
On the other hand, drilling into the code gives me the possibility to AT LEAST understand the types of, let say grf files.
Eventually, that could lead me to write a grf editor, or a map editor, or whatever could come up.

I know how to read C, up to a certain point.
I simply want to improve myself in something that I like, Delphi and OpenTTD...

If I could translate it, cool. Otherwise, too bad, but it would have been fun...

Anyway, thanks for the advice, i'll consider it.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 15 guests