Win32 Compile notes under MSVC 2005

Everything related to the code /
Tout ce qui touche au code
Post Reply
User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Win32 Compile notes under MSVC 2005

Post by Cire » Tue Nov 07, 2006 8:18 pm

I've downloaded Allegro and The Accompaning Allergo GL extension and placed them within the projects root directory, then added to the projects paths the approprpaite include/lib dirs.

Starting off I created a stdafx.h file and included allegro.h, I am getting alot of compile noise specifically C4312 *boggle*, so I disabled it while including the allegro libs.

To get around running fix and what not I added a define to set it as win32. Allegro people really shouln't add a key include that needs modified depending on lib, but rather require a define to spcify platform before including allegro.

My opening looks something like this.

Code: Select all

#pragma warning( disable : 4312 )

#define ALLEGRO_MSVC
#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
#include <allegro>

#pragma warning( default : 4312 )
Anyhow after that console and a number of other files compiles rather well, but hpi.h and hpi.cpp have a number of seirous issues that shoudl be addressed.

First and formost thier are a number of code reduancies here as well as replications that could cut down on the amount of code used. I'll leave it in your hands for a rewrite but when you do please look at...

chunk size calculation via the lines...

Code: Select all

				int chunks=node->hpifile.FileSize+0xFFFF>>16;		// Nombre de morceaux composants le fichier
				int chunk_size[chunks];								// Taille des différents morceaux
A number of compiler issues here, first and formost is the operator >>, you might wana place some brackets to specify precedence, my compiler is bitching about it.

The second line really throws me for a loop, I really didn't know that any C++ compilers allowed for dynamic array allocation, I suggest modifing this to use malloc or new, which i'am assuming is what your compiler is doing anyhow.

Finally at the bottom of hpi.h you have a prototype of osmehting like...

Code: Select all

byte *load_file_zone(char *filename,int start,int size,int *size=NULL);
I have no clue how you even got this to compile since right away i can see that the varialbe size varies in levels of direciton, simple fix really, just change one of the size to size2.

++Cire.

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Fri Nov 10, 2006 10:50 pm

The conflict between the two 'size' variables is fixed, just changed the first one to 'len'. That was just a mistake, and it prevented TA3D to behave as expected.

Well it seems we will have to clean a bit the code :? .
=>;-D Penguin Powered

User avatar
Cire
Moderator
Posts: 350
Joined: Tue Oct 31, 2006 5:59 pm
Location: Somewhere on Earth

Post by Cire » Sat Nov 11, 2006 5:55 pm

When can we get together either on irc or some realtime chat program, I wouln't mind lending my tallents to help bring alot of this code into standards with c++ as well as working to make sure that code is platform safe in respects to size of variables and functions and what not.

Since the core of TA pretty much begins with hpi,gp3,ccx and other files I think it would be a good place to begin. Rather then using a linked list, I think it would be more appropiate to use a std::list or vector, or map to manage the archive list this is just a thought, defantly would be more complaint and probably in the long run easier to 'add to', and flexable and what not.

++Cire

User avatar
zuzuf
Administrateur - Site Admin
Posts: 3281
Joined: Mon Oct 30, 2006 8:49 pm
Location: Toulouse, France
Contact:

Post by zuzuf » Sat Nov 11, 2006 6:13 pm

why not tonight??
=>;-D Penguin Powered

Post Reply

Who is online

Users browsing this forum: No registered users and 27 guests