Modding, Mission Design, and Coding > FS2 Open Coding - The Source Code Project (SCP)

Working on the AI but need some help with C++

(1/4) > >>

Firgeis:
Pretty self explanatory
Whats the code doing here?:

Assert(objp->type == OBJ_SHIP);

and here whats in the parenthesis?:

#define   AIF_FORMATION_WING   (1

Mysterial:
Asserts are double-checks to make sure that something that ought to be true really is. If for some reason it isn't the program should crash with a file, line number and in some cases the function that the assert failed in. Furthermore, in most cases Assert() is controlled by a define (e.g. #define DEBUGMODE) which, when not set, will make the assert function into an empty function, thereby saving processor time in a release version.

phreak:
and 1

Firgeis:
Thanks alot for the help, still got some questions, in:

(objp->type == OBJ_SHIP); whats the -> for,? or is it a part of the name of the class/object/function

neimad:

--- Quote ---Originally posted by Firgeis
Thanks alot for the help, still got some questions, in:

(objp->type == OBJ_SHIP); whats the -> for,? or is it a part of the name of the class/object/function
--- End quote ---


"->" is used to gain access to members of an object/class in C.

In VB/Delphi it would look like this:

if objp.type = OBJ_SHIP then

Navigation

[0] Message Index

[#] Next page

Go to full version