Author Topic: Glest's Source  (Read 2771 times)

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Glest's Source
« on: 28 January 2009, 08:45:32 »
We should start a thread were we can identify parts of glest's source code. Glest doesn't really say straight out what each element or class is, so that leaves you to have to inspect the source code. Been thinking that maybe everyone can post bits that they know when ever they feel like it. Sure would make it easier for programmers to help out. I've been dicing my skills up, but I then realized I'm not familiar with glest! :o OOPS!

I'll start a bit, feel free to correct:
Code: [Select]
void Game::incSpeed() This is for setting the game speed. We use sFast, sNormal, or sSlow.
Code: [Select]
void Game::showLoseMessageBox() This is for displaying the 'You Lose' display box.
Code: [Select]
void Game::showWinMessageBox() This is the exact opposite, for the 'You Win' display.
Code: [Select]
Command::Command(const CommandType *ct, const Vec2i &pos) Command Class.
So on... Course, I'm not very familiar with Glest's source, so any help from those who spent a long time coding Glest, post!


10: Print "Happy Programming";
20: Goto 10;
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

hailstone

  • GAE Team
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: Glest's Source
« Reply #1 on: 29 January 2009, 00:00:12 »
Methods like showLoseMessageBox() are fairly self explanatory. Other ones are obscure. Daniel has done some commenting of these and some explanations of different parts (see https://docs.megaglest.org/Glest_Advanced_Engine#Source_Explanation - you'll need to convert the urls).

Quote
Command::Command(const CommandType *ct, const Vec2i &pos)
This is a constructor for the command class.

The only way to really understand the code is to go through it. Doxygen documentation might help.
« Last Edit: 18 June 2016, 19:10:48 by filux »
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

battle machine man

  • Guest
Re: Glest's Source
« Reply #2 on: 16 February 2009, 16:24:00 »
We should start a thread were we can identify parts of glest's source code. Glest doesn't really say straight out what each element or class is, so that leaves you to have to inspect the source code. Been thinking that maybe everyone can post bits that they know when ever they feel like it. Sure would make it easier for programmers to help out. I've been dicing my skills up, but I then realized I'm not familiar with glest! :o OOPS!

I'll start a bit, feel free to correct:
Code: [Select]
void Game::incSpeed() This is for setting the game speed. We use sFast, sNormal, or sSlow.
Code: [Select]
void Game::showLoseMessageBox() This is for displaying the 'You Lose' display box.
Code: [Select]
void Game::showWinMessageBox() This is the exact opposite, for the 'You Win' display.
Code: [Select]
Command::Command(const CommandType *ct, const Vec2i &pos) Command Class.
So on... Course, I'm not very familiar with Glest's source, so any help from those who spent a long time coding Glest, post!


10: Print "Happy Programming";
20: Goto 10;
Ha! I could do this with a little practice its harder than basic but what is it in I thought mayby C++ or some other C like code but this looks a LOT shorter and really easy!

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Glest's Source
« Reply #3 on: 16 February 2009, 21:15:32 »
Um, dude, it's harder. It's a more complex OOP language. However, it can do everything that c can do better. (Note that c may not work in c++ if you use one of c++'s codewords.

Although I am learning glest a bit better. Doxygen isn't very reliable here though because glest is very comment-less...
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

modman

  • Guest
Re: Glest's Source
« Reply #4 on: 17 February 2009, 02:29:21 »
You're wrong!  I'm almost certain!  C++ was designed to be backwardly compatible with C, so mostly the only things that do not work are declaring arguments.

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Glest's Source
« Reply #5 on: 17 February 2009, 11:48:19 »
Might I quote:
c may not work in c++ if you use one of c++'s codewords.
If you use one of c++'s codewords (ie: then, if, true) c will NOT work in a c++ compiler. Why anyone would use c to make a game or any other program is beyond me though.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

hailstone

  • GAE Team
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: Glest's Source
« Reply #6 on: 18 February 2009, 04:46:49 »
I've done C programming for university and I can definitely say that 'then', 'if' and 'true' (although needs to be a macro from memory) statements will work in C and compile in a C++ compiler (backward compatibility). Object oriented features like 'class' or C++ libraries won't work with a C compiler. Also you shouldn't mix C's malloc/free and C++'s new/delete.
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Glest's Source
« Reply #7 on: 18 February 2009, 09:22:28 »
Not good choices for key words.
However, if you tried something like asigning a variable to a c++ codeword that is NOT a c code word would work on a c compiler, but not a c++ one. For example, if you tried to use a codeword like public, private, reinterpret_cast, volatile, extern, etc; the compilation would fail.
Of course, I don't know why we are even having this conversation since glest is coded in C++, not c (NOTHING is coded in c these days...)
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

Yggdrasil

  • GAE Team
  • Ornithopter
  • ********
  • Posts: 408
    • View Profile
Re: Glest's Source
« Reply #8 on: 18 February 2009, 12:16:47 »
NOTHING is coded in c these days...
Oh, really? But only if NOTHING includes Linux (kernel), gcc, Gnome, gimp, blender, ...

modman

  • Guest
Re: Glest's Source
« Reply #9 on: 21 February 2009, 02:25:53 »
Hee Hee ;D  Sorry if it looks like I take pleasure in this, but I do anyhow. :-\