gParser Class Reference

#include <gParser.h>

Collaboration diagram for gParser:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 gParser (gArena *anArena, eGrid *aGrid)
void setSizeMultiplier (REAL aSizeMultiplier)
void Parse ()

Protected Member Functions

bool trueOrFalse (char *str)
char * myxmlGetProp (xmlNodePtr cur, const char *name)
int myxmlGetPropInt (xmlNodePtr cur, const char *name)
float myxmlGetPropFloat (xmlNodePtr cur, const char *name)
bool myxmlGetPropBool (xmlNodePtr cur, const char *name)
void myxmlGetDirection (xmlNodePtr cur, float &x, float &y)
bool isElement (const xmlChar *elementName, const xmlChar *searchedElement, const xmlChar *keyword=NULL)
bool isValidAlternative (xmlNodePtr cur, const xmlChar *keyword=NULL)
void processSubAlt (eGrid *grid, xmlNodePtr cur, const xmlChar *keyword=NULL)
bool isValidCodeName (const xmlChar *version)
bool isValidDotNumber (const xmlChar *version)
bool validateVersionSubRange (const xmlChar *subRange, const xmlChar *codeName, const xmlChar *dotVersion)
bool xmlCharSearchReplace (xmlChar *&original, const xmlChar *searchPattern, const xmlChar *replace)
int validateVersionRange (xmlChar *version, const xmlChar *codeName, const xmlChar *dotVersion)
void endElementAlternative (eGrid *grid, xmlNodePtr cur, const xmlChar *keyword)
void parseAxes (eGrid *grid, xmlNodePtr cur, const xmlChar *keyword)
void parseSpawn (eGrid *grid, xmlNodePtr cur, const xmlChar *keyword)
void parseZone (eGrid *grid, xmlNodePtr cur, const xmlChar *keyword)
bool parseZoneArthemis_v1 (eGrid *grid, xmlNodePtr cur, const xmlChar *keyword)
void parseWall (eGrid *grid, xmlNodePtr cur, const xmlChar *keyword)
bool parseShapeCircle (eGrid *grid, xmlNodePtr cur, float &x, float &y, float &radius, float &growth, const xmlChar *keyword)
void parseField (eGrid *grid, xmlNodePtr cur, const xmlChar *keyword)
void parseWorld (eGrid *grid, xmlNodePtr cur, const xmlChar *keyword=NULL)
void parseMap (eGrid *grid, xmlNodePtr cur, const xmlChar *keyword=NULL)
void parseSettings (eGrid *grid, xmlNodePtr cur, const xmlChar *keyword=NULL)
void parseSetting (eGrid *grid, xmlNodePtr cur, const xmlChar *keyword)
void parseAlternativeContent (eGrid *grid, xmlNodePtr cur)
void parseWallLine (eGrid *grid, xmlNodePtr cur, const xmlChar *keyword)
void parseWallRect (eGrid *grid, xmlNodePtr cur, const xmlChar *keyword)
void parseObstacleWall (eGrid *grid, xmlNodePtr cur, const xmlChar *keyword)

Protected Attributes

float sizeMultiplier

Private Member Functions

ePointDrawRim (eGrid *grid, ePoint *start, eCoord const &stop, REAL h=10000)

Private Attributes

gArenatheArena
eGridtheGrid
REAL rimTexture


Detailed Description

Definition at line 35 of file gParser.h.


Constructor & Destructor Documentation

gParser::gParser ( gArena anArena,
eGrid aGrid 
)

Definition at line 100 of file gParser.cpp.

References NULL.

00100                                              :
00101         theArena(anArena),
00102         theGrid(aGrid),
00103         rimTexture(0),
00104         sizeMultiplier(0.0)
00105 {
00106     m_Doc = NULL;
00107 
00108     // HACK - philippeqc
00109     // This seems as inconvenient as any other place to load the
00110     // static tables of variables and functions available.
00111     // It's run once per map loading, between round, so its basically
00112     // cost less vs the real structural mess that it cause ;)
00113 
00114     //  vars[tString("sizeMultiplier")] = &sizeMultiplier; // BAD dont use other than as an example, non static content
00115 
00116     //    tValue::Expr::functions[tString("time")] = &tSysTimeHack;
00117 #ifdef DEBUG_ZONE_SYNC
00118     tValue::Expr::functions[tString("time2")] = &tSysTimeHack2;
00119 #endif //DEBUG_ZONE_SYNC
00120     //    tValue::Expr::functions[tString("sizeMultiplier")] = &gArena::GetSizeMultiplierHack; // static
00121 
00122 }


Member Function Documentation

ePoint * gParser::DrawRim ( eGrid grid,
ePoint start,
eCoord const &  stop,
REAL  h = 10000 
) [private]

Definition at line 1689 of file gParser.cpp.

References eGrid::DrawLine(), REAL, rimTexture, and tNEW.

Referenced by parseObstacleWall(), parseWall(), parseWallLine(), and parseWallRect().

01691 {
01692     // calculate the wall's length and the rim wall textures
01693     REAL length = (stop-(*start)).Norm();
01694     REAL rimTextureStop = rimTexture + length;
01695 
01696     // create wall
01697     tJUST_CONTROLLED_PTR< gWallRim > newWall = tNEW( gWallRim )(grid, rimTexture, rimTextureStop, h);
01698 
01699     // update rim texture
01700     rimTexture = rimTextureStop;
01701 
01702     // draw line with wall
01703     return grid->DrawLine( start, stop, newWall, 0 );

Here is the call graph for this function:

Here is the caller graph for this function:

void gParser::setSizeMultiplier ( REAL  aSizeMultiplier  ) 

Definition at line 2160 of file gParser.cpp.

Referenced by gArena::PrepareGrid().

02163 {
02164     // BOP
02165     sizeMultiplier = aSizeMultiplier;

Here is the caller graph for this function:

void gParser::Parse (  ) 

Definition at line 2168 of file gParser.cpp.

References con, isElement(), isValidAlternative(), NULL, parseAlternativeContent(), parseMap(), parseWorld(), rimTexture, sg_Deprecated(), and theGrid.

Referenced by gArena::PrepareGrid().

02171 {
02172     rimTexture = 0;
02173     xmlNodePtr cur;
02174     cur = xmlDocGetRootElement(m_Doc);
02175 
02176 #ifdef ENABLE_ZONESV2
02177     monitors.clear();
02178 #endif
02179 #ifdef DEBUG_ZONE_SYNC
02180     newGameRound = true;
02181 #endif //DEBUG_ZONE_SYNC
02182 
02183     if (cur == NULL) {
02184         con << "ERROR: Map file is blank\n";
02185         return;
02186     }
02187 
02188     if (isElement(cur->name, (const xmlChar *) "Resource")) {
02189         if (xmlStrcmp((const xmlChar *) "aamap", xmlGetProp(cur, (const xmlChar *) "type"))) {
02190             con << "Type aamap expected, found " << xmlGetProp(cur, (const xmlChar *) "type") << " instead\n";
02191             con << "formalise this message\n";
02192         }
02193         else {
02194             cur = cur->xmlChildrenNode;
02195             while (cur != NULL) {
02196                 if (!xmlStrcmp(cur->name, (const xmlChar *)"text") || !xmlStrcmp(cur->name, (const xmlChar *)"comment")) {
02197                     /* Do nothing, but is required to eliminate all Text element */
02198                     /* text elements are half of any other elements, drop them here rather than perform countless test */
02199                 }
02200                 else if (isElement(cur->name, (const xmlChar *)"Map")) {
02201                     parseMap(theGrid, cur);
02202                 }
02203                 else if (isElement(cur->name, (const xmlChar *)"Alternative")) {
02204                     if (isValidAlternative(cur)) {
02205                         parseAlternativeContent(theGrid, cur);
02206                     }
02207                 }
02208                 cur = cur ? cur->next : NULL;
02209             }
02210         }
02211     }
02212     else if (isElement(cur->name, (const xmlChar *) "World")) {
02213         // Legacy code to support version 0.1 of the DTDs
02214         sg_Deprecated();
02215 
02216         cur = cur->xmlChildrenNode;
02217         while (cur != NULL) {
02218             if (!xmlStrcmp(cur->name, (const xmlChar *)"text") || !xmlStrcmp(cur->name, (const xmlChar *)"comment")) {}
02219             else if (isElement(cur->name, (const xmlChar *)"Map")) {
02220                 // Map and world got swapped in the current DTD, that's why this looks a little strange.
02221                 parseWorld (theGrid, cur);
02222             }
02223             else if (isElement(cur->name, (const xmlChar *)"Alternative")) {
02224                 if (isValidAlternative(cur)) {
02225                     parseAlternativeContent(theGrid, cur);
02226                 }
02227             }
02228             cur = cur->next;
02229         }
02230     }
02231 
02232 #ifdef ENABLE_ZONESV2
02233     mapZones.clear();
02234 #endif
02235 
02236     //        fprintf(stderr,"ERROR: Map file is missing root \'Resources\' node");

Here is the call graph for this function:

Here is the caller graph for this function:

bool gParser::trueOrFalse ( char *  str  )  [protected]

Definition at line 125 of file gParser.cpp.

Referenced by myxmlGetPropBool().

00126 {
00127     // This will work with true/false/yes/no/1/-1/0/etc
00128     return (!strncasecmp(str, "t", 1) || !strncasecmp(str, "y", 1) || atoi(str));
00129 }

Here is the caller graph for this function:

char * gParser::myxmlGetProp ( xmlNodePtr  cur,
const char *  name 
) [protected]

Definition at line 132 of file gParser.cpp.

Referenced by myxmlGetPropBool(), myxmlGetPropFloat(), myxmlGetPropInt(), and parseSetting().

00132                                                       {
00133     return (char *)xmlGetProp(cur, (const xmlChar *)name);
00134 }

Here is the caller graph for this function:

int gParser::myxmlGetPropInt ( xmlNodePtr  cur,
const char *  name 
) [protected]

Definition at line 137 of file gParser.cpp.

References myxmlGetProp(), and NULL.

Referenced by parseAxes(), and parseMap().

00137                                                          {
00138     char *v = myxmlGetProp(cur, name);
00139     if (v == NULL)      return 0;
00140     int r = atoi(v);
00141     xmlFree(v);
00142     return r;
00143 }

Here is the call graph for this function:

Here is the caller graph for this function:

float gParser::myxmlGetPropFloat ( xmlNodePtr  cur,
const char *  name 
) [protected]

Definition at line 174 of file gParser.cpp.

References myxmlGetProp(), and NULL.

Referenced by myxmlGetDirection(), parseAxes(), parseObstacleWall(), parseShapeCircle(), parseSpawn(), parseWall(), parseWallLine(), and parseWallRect().

00174                                                            {
00175     char *v = myxmlGetProp(cur, name);
00176     if (v == NULL)      return 0.;
00177     float r = atof(v);
00178     xmlFree(v);
00179     return r;
00180 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool gParser::myxmlGetPropBool ( xmlNodePtr  cur,
const char *  name 
) [protected]

Definition at line 183 of file gParser.cpp.

References myxmlGetProp(), NULL, and trueOrFalse().

Referenced by parseAxes().

00183                                                           {
00184     char *v = myxmlGetProp(cur, name);
00185     if (v == NULL)      return false;
00186     bool r = trueOrFalse(v);
00187     xmlFree(v);
00188     return r;
00189 }

Here is the call graph for this function:

Here is the caller graph for this function:

void gParser::myxmlGetDirection ( xmlNodePtr  cur,
float &  x,
float &  y 
) [protected]

Definition at line 426 of file gParser.cpp.

References cosf(), M_PI, myxmlGetPropFloat(), myxmlHasProp, and sinf().

Referenced by parseAxes(), and parseSpawn().

00427 {
00428     if (myxmlHasProp(cur, "angle")) {
00429         float angle = myxmlGetPropFloat(cur, "angle") * M_PI / 180.0;
00430         float speed = myxmlGetPropFloat(cur, "length");
00431         x = cosf(angle) * speed;
00432         y = sinf(angle) * speed;
00433     } else {
00434         x = myxmlGetPropFloat(cur, "xdir");
00435         y = myxmlGetPropFloat(cur, "ydir");
00436     }
00437 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool gParser::isElement ( const xmlChar *  elementName,
const xmlChar *  searchedElement,
const xmlChar *  keyword = NULL 
) [protected]

Definition at line 213 of file gParser.cpp.

References NULL.

Referenced by endElementAlternative(), isValidAlternative(), Parse(), parseAlternativeContent(), parseAxes(), parseField(), parseMap(), parseObstacleWall(), parseSettings(), parseShapeCircle(), parseWall(), parseWorld(), and parseZoneArthemis_v1().

00213                                                                                                       {
00214     bool valid = false;
00215     if (xmlStrcmp(elementName, searchedElement) == 0) {
00216         valid = true;
00217     }
00218     else {
00219         if (keyword != NULL) {
00220             xmlChar * searchedElementAndKeyword = xmlStrdup(searchedElement);
00221             searchedElementAndKeyword = xmlStrcat(searchedElementAndKeyword, keyword);
00222             if (xmlStrcmp(elementName, searchedElementAndKeyword) == 0) {
00223                 valid = true;
00224             }
00225             xmlFree (searchedElementAndKeyword);
00226         }
00227     }
00228 
00229     return valid;
00230 }

Here is the caller graph for this function:

bool gParser::isValidAlternative ( xmlNodePtr  cur,
const xmlChar *  keyword = NULL 
) [protected]

Definition at line 239 of file gParser.cpp.

References isElement(), NULL, and validateVersionRange().

Referenced by endElementAlternative(), Parse(), parseAlternativeContent(), parseAxes(), parseField(), parseMap(), parseObstacleWall(), parseSettings(), parseShapeCircle(), parseWall(), parseWorld(), parseZoneArthemis_v1(), and processSubAlt().

00239                                                                    {
00240     xmlChar *version = xmlGetProp(cur, (const xmlChar *) "version");
00241     /*
00242      * Find non empty version and
00243      * Alternative element, ie those having a name starting by "Alternative" and
00244      * only the Alternative elements that are for our version, ie Arthemis
00245      */
00246     return ((version != NULL) && isElement(cur->name, (const xmlChar *)"Alternative", keyword) && validateVersionRange(version, (const xmlChar*)"Artemis", (const xmlChar*)"0.2.8.0") );
00247 }

Here is the call graph for this function:

Here is the caller graph for this function:

void gParser::processSubAlt ( eGrid grid,
xmlNodePtr  cur,
const xmlChar *  keyword = NULL 
) [protected]

Definition at line 1832 of file gParser.cpp.

References isValidAlternative(), NULL, and parseAlternativeContent().

01833                                                                            {
01834     cur = cur->xmlChildrenNode;
01835     /* Quickly goes through all the sub element until a valid Alternative is found */
01836     while ( cur != NULL) {
01837         if (!xmlStrcmp(cur->name, (const xmlChar *)"text") || !xmlStrcmp(cur->name, (const xmlChar *)"comment")) {}
01838         else if (isValidAlternative(cur, keyword)) {
01839             parseAlternativeContent(grid, cur);
01840             return; /*We process only the first matching one*/
01841         }
01842         cur = cur->next;
01843     }

Here is the call graph for this function:

bool gParser::isValidCodeName ( const xmlChar *  version  )  [protected]

Definition at line 250 of file gParser.cpp.

Referenced by validateVersionSubRange().

00251 {
00252     const int NUMBER_NAMES = 24;
00253     xmlChar const *const names [] = { (const xmlChar*) "Artemis", (const xmlChar*) "Bachus", (const xmlChar*) "Cronus", (const xmlChar*) "Demeter", (const xmlChar*) "Epimetheus", (const xmlChar*) "Furiae", (const xmlChar*) "Gaia", (const xmlChar*) "Hades", (const xmlChar*) "Iapetos", (const xmlChar*) "Juno", (const xmlChar*) "Koios", (const xmlChar*) "Leto", (const xmlChar*) "Mars", (const xmlChar*) "Neptune", (const xmlChar*) "Okeanos", (const xmlChar*) "Prometheus", (const xmlChar*) "Rheia", (const xmlChar*) "Selene", (const xmlChar*) "Thanatos", (const xmlChar*) "Uranus", (const xmlChar*) "Vulcan", (const xmlChar*) "Wodan", (const xmlChar*) "Yggdrasil", (const xmlChar*) "Zeus"};
00254     /* Is is a valid codename*/
00255     int i;
00256     for (i=0; i<NUMBER_NAMES; i++)
00257     {
00258         if (xmlStrcmp(version, names[i]) == 0)
00259             return true;
00260     }
00261 
00262     return false;
00263 }

Here is the caller graph for this function:

bool gParser::isValidDotNumber ( const xmlChar *  version  )  [protected]

Definition at line 266 of file gParser.cpp.

Referenced by validateVersionSubRange().

00267 {
00268     char * work = (char *) xmlStrdup(version);
00269     char * start = work;
00270     char * end = work;
00271     bool valid = false;
00272     /* Check that we have at least i.j.k.xxx */
00273     for (int i=0; i<3; i++)
00274     {
00275         strtol(start, &end, 10);
00276         if (start != end) {
00277             valid = true;
00278             start = end +1;
00279         }
00280         else {
00281             valid = false;
00282             break;
00283         }
00284     }
00285     xmlFree(work);
00286     return valid;
00287 }

Here is the caller graph for this function:

bool gParser::validateVersionSubRange ( const xmlChar *  subRange,
const xmlChar *  codeName,
const xmlChar *  dotVersion 
) [protected]

Definition at line 291 of file gParser.cpp.

References isValidCodeName(), and isValidDotNumber().

Referenced by validateVersionRange().

00292 {
00293     bool valid = false;
00294     int posDelimiter = xmlUTF8Strloc(subRange, (const xmlChar *) "-");
00295     if (posDelimiter != -1)
00296     {
00297         xmlChar * pre = xmlUTF8Strsub(subRange, 0, posDelimiter);
00298         xmlChar * post = xmlUTF8Strsub(subRange, posDelimiter + 1, xmlUTF8Strlen(subRange) - posDelimiter - 1 );
00299 
00300         if (xmlStrlen(pre) == 0)
00301             /* The range is of type <empty>-<something>, so we pass the first part */
00302             valid = true;
00303         else
00304         {
00305             if (isValidCodeName(pre))
00306                 valid = ( xmlStrcmp(pre, codeName) <= 0 );
00307             else if (isValidDotNumber(pre))
00308                 valid = ( xmlStrcmp(pre, dotVersion) <= 0 );
00309         }
00310 
00311         if (xmlStrlen(post) == 0)
00312             /* Reject ranges of types <something>-<empty>*/
00313             valid = true;
00314         else
00315         {
00316             if (isValidCodeName(post))
00317                 valid &= ( xmlStrcmp(post, codeName) >= 0 );
00318             else if (isValidDotNumber(post))
00319                 valid &= ( xmlStrcmp(post, dotVersion) >= 0 );
00320         }
00321     }
00322     else
00323     {
00324         if (isValidCodeName(subRange))
00325             valid = ( xmlStrcmp(subRange, codeName) == 0 );
00326         else if (isValidDotNumber(subRange))
00327             valid = ( xmlStrcmp(subRange, dotVersion) == 0 );
00328     }
00329 
00330     return valid;
00331 }

Here is the call graph for this function:

Here is the caller graph for this function:

bool gParser::xmlCharSearchReplace ( xmlChar *&  original,
const xmlChar *  searchPattern,
const xmlChar *  replace 
) [protected]

Definition at line 337 of file gParser.cpp.

References pos.

Referenced by validateVersionRange().

00338 {
00339     int pos;
00340 
00341     int lenSearchPattern = xmlUTF8Strlen(searchPattern); /* number of character */
00342     int sizeSearchPattern = xmlUTF8Strsize(searchPattern, lenSearchPattern); /* number of bytes required*/
00343 
00344     /* Ugly hack as many function are lacking in string manipulation for xmlChar * */
00345     /* xmlUTF8Strloc can only find the location of a single character, and no xmlUTF8Str... function
00346        can return the location of a string in character position */
00347     /* We are looking for the first instance searchPattern and want its position in character */
00348     for (pos=0; pos<xmlUTF8Strlen(original); pos++)
00349     {
00350         if ( xmlStrncmp( xmlUTF8Strpos(original, pos), searchPattern, sizeSearchPattern) == 0 )
00351         {
00352             int count = xmlUTF8Strlen(original);
00353             xmlChar * pre = xmlUTF8Strsub(original, 0, pos);
00354             xmlChar * post = xmlUTF8Strsub(original, pos + lenSearchPattern, count - pos - lenSearchPattern );
00355 
00356             xmlFree(original);
00357             pre = xmlStrcat ( pre, replace);
00358             original = xmlStrcat ( pre, post );
00359             xmlFree(post);
00360             return true;
00361         }
00362     }
00363 
00364     return false;
00365 }

Here is the caller graph for this function:

int gParser::validateVersionRange ( xmlChar *  version,
const xmlChar *  codeName,
const xmlChar *  dotVersion 
) [protected]

Definition at line 370 of file gParser.cpp.

References pos, validateVersionSubRange(), and xmlCharSearchReplace().

Referenced by isValidAlternative().

00371 {
00372     xmlChar * copy = xmlStrdup(version);
00373 
00374     /* We allow numerical version to be expressed with . or _, cut down one to simplify treatment */
00375     while ( xmlCharSearchReplace(copy, (const xmlChar *) "_", (const xmlChar *) ".") ) {} ;
00376 
00377     /* Eliminate all the white space */
00378     while ( xmlCharSearchReplace(copy, (const xmlChar *) " ", (const xmlChar *) "") ) {} ;
00379 
00380     xmlChar * remain = copy;
00381     bool valid = false;
00382     int pos=0;
00383     while (xmlStrlen(remain) && valid == false)
00384     {
00385         if ( ( pos = xmlUTF8Strloc(remain, (const xmlChar *) ",")) == -1)
00386         {
00387             /* This is the last sub-range to explore */
00388             pos = xmlUTF8Strlen(remain);
00389         }
00390         xmlChar * subRange = xmlUTF8Strndup(remain, pos);
00391 
00392         /* Is the current version in the presented range */
00393         valid |= validateVersionSubRange(subRange, codeName, dotVersion);
00394         xmlFree(subRange);
00395 
00396         /* Move away from the zone explored*/
00397         remain = const_cast<xmlChar *>( xmlUTF8Strpos(remain, pos + 1) );
00398     }
00399 
00400     xmlFree(copy);
00401     return valid;
00402 }

Here is the call graph for this function:

Here is the caller graph for this function:

void gParser::endElementAlternative ( eGrid grid,
xmlNodePtr  cur,
const xmlChar *  keyword 
) [protected]

Definition at line 410 of file gParser.cpp.

References isElement(), isValidAlternative(), NULL, and parseAlternativeContent().

Referenced by parseAxes(), parseObstacleWall(), parseSetting(), parseShapeCircle(), parseSpawn(), parseWall(), parseWallLine(), and parseWallRect().

00410                                                                                    {
00411     /* Verify if any sub elements are included, and if they contain any Alt
00412        Sub elements of Spawn arent defined in the current version*/
00413     cur = cur->xmlChildrenNode;
00414     while ( cur != NULL) {
00415         if (!xmlStrcmp(cur->name, (const xmlChar *)"text") || !xmlStrcmp(cur->name, (const xmlChar *)"comment")) {}
00416         else if (isElement(cur->name, (const xmlChar *)"Alternative", keyword)) {
00417             if (isValidAlternative(cur, keyword)) {
00418                 parseAlternativeContent(grid, cur);
00419             }
00420         }
00421         cur = cur->next;
00422     }
00423 }

Here is the call graph for this function:

Here is the caller graph for this function:

void gParser::parseAxes ( eGrid grid,
xmlNodePtr  cur,
const xmlChar *  keyword 
) [protected]

Definition at line 440 of file gParser.cpp.

References con, eCoord, endElementAlternative(), free, isElement(), isValidAlternative(), malloc, myxmlGetDirection(), myxmlGetPropBool(), myxmlGetPropFloat(), myxmlGetPropInt(), NULL, parseAlternativeContent(), and eGrid::SetWinding().

Referenced by parseAlternativeContent(), and parseField().

00441 {
00442     int number;
00443     int normalize;
00444 
00445     number = myxmlGetPropInt(cur, "number");
00446     if (number < 1)
00447         return; // 1 axis is one-way. Keep it.
00448 
00449     normalize = myxmlGetPropBool(cur, "normalize");
00450 
00451     grid->SetWinding(number);
00452 
00453     cur = cur->xmlChildrenNode;
00454     if (cur != NULL)
00455     {
00456         int index = 0;
00457         eCoord *axisDir;
00458         axisDir = (eCoord *)malloc(sizeof(eCoord) * number);
00459         for (int i=0; i<number; i++){
00460             axisDir[i] = eCoord(1,0);
00461         }
00462 
00463         while (cur!= NULL) {
00464             if (!xmlStrcmp(cur->name, (const xmlChar *)"text") || !xmlStrcmp(cur->name, (const xmlChar *)"comment")) {}
00465             else if (isElement(cur->name, (const xmlChar *)"Axis", keyword)) {
00466                 if (index < number) {
00467                     myxmlGetDirection(cur, axisDir[index].x, axisDir[index].y);
00468                     index++;
00469                 }
00470                 else {
00471                     con << "Invalid index #" << index << "\n";
00472                 }
00473                 /* Verify if any sub elements are included, and if they contain any Alt
00474                    Sub elements of Point arent defined in the current version*/
00475                 endElementAlternative(grid, cur, keyword);
00476             }
00477             else if (isElement(cur->name, (const xmlChar *)"Point", keyword)) {
00478                 if (index < number) {
00479                     axisDir[index].x = myxmlGetPropFloat(cur, "x");
00480                     axisDir[index].y = myxmlGetPropFloat(cur, "y");
00481                     index++;
00482                 }
00483                 else {
00484                     con << "Invalid index #" << index << "\n";
00485                 }
00486                 /* Verify if any sub elements are included, and if they contain any Alt
00487                    Sub elements of Point arent defined in the current version*/
00488                 endElementAlternative(grid, cur, keyword);
00489             }
00490             else if (isElement(cur->name, (const xmlChar *)"Alternative", keyword)) {
00491                 if (isValidAlternative(cur, keyword)) {
00492                     parseAlternativeContent(grid, cur);
00493                 }
00494             }
00495             cur = cur->next;
00496         }
00497         grid->SetWinding(number, axisDir, normalize);
00498         free(axisDir);
00499     }
00500 }

Here is the call graph for this function:

Here is the caller graph for this function:

void gParser::parseSpawn ( eGrid grid,
xmlNodePtr  cur,
const xmlChar *  keyword 
) [protected]

Definition at line 503 of file gParser.cpp.

References eCoord, endElementAlternative(), myxmlGetDirection(), myxmlGetPropFloat(), gArena::NewSpawnPoint(), and theArena.

Referenced by parseAlternativeContent(), and parseField().

00504 {
00505     float x, y, xdir, ydir;
00506 
00507     x = myxmlGetPropFloat(cur, "x");
00508     y = myxmlGetPropFloat(cur, "y");
00509     myxmlGetDirection(cur, xdir, ydir);
00510 
00511     theArena->NewSpawnPoint(eCoord(x, y), eCoord(xdir, ydir));
00512 
00513     endElementAlternative(grid, cur, keyword);
00514 }

Here is the call graph for this function:

Here is the caller graph for this function:

void gParser::parseZone ( eGrid grid,
xmlNodePtr  cur,
const xmlChar *  keyword 
) [protected]

Definition at line 1568 of file gParser.cpp.

References mapVersion, and parseZoneArthemis_v1().

Referenced by parseAlternativeContent(), and parseField().

01570 {
01571 #ifdef ENABLE_ZONESV2
01572     switch (mapVersion)
01573     {
01574     case 1:
01575         // was, technically, without zones IIRC. But let's parse it anyway
01576     case 2:
01577         // switch to v2 when some sort of emulation layer is ready
01578         // we should probably check for the DTD, too; v1 zones are only possible
01579         // for 0.2.x dtds and 0.3.1-b and later, and v2 zones only for 0.3.1-a and
01580         // later.
01581         if( !parseZoneArthemis_v1(grid, cur, keyword) )
01582         {
01583             parseZoneBachus(grid, cur, keyword);
01584         }
01585         break;
01586     case 3:
01587         // well, the above is a really ugly hack to keep things working, better
01588         // let users of pure zone v2 maps upgrade them to map version 3.
01589         parseZoneBachus(grid, cur, keyword);
01590         break;
01591     default:
01592         parseZoneBachus(grid, cur, keyword);
01593         break;
01594     }
01595 #else
01596     parseZoneArthemis_v1(grid, cur, keyword);
01597 #endif

Here is the call graph for this function:

Here is the caller graph for this function:

bool gParser::parseZoneArthemis_v1 ( eGrid grid,
xmlNodePtr  cur,
const xmlChar *  keyword 
) [protected]

Definition at line 1517 of file gParser.cpp.

References eCoord, isElement(), isValidAlternative(), nCLIENT, NULL, parseAlternativeContent(), parseShapeCircle(), nNetObject::RequestSync(), gZone::SetExpansionSpeed(), gZone::SetRadius(), gZone::SetRotationSpeed(), sn_GetNetState(), and tNEW.

Referenced by parseAlternativeContent(), parseField(), and parseZone().

01519 {
01520     float x, y, radius, growth;
01521     bool shapeFound = false;
01522     xmlNodePtr shape = cur->xmlChildrenNode;
01523 
01524     while(shape != NULL && shapeFound==false) {
01525         if (!xmlStrcmp(cur->name, (const xmlChar *)"text") || !xmlStrcmp(cur->name, (const xmlChar *)"comment")) {}
01526         else if (isElement(shape->name, (const xmlChar *)"ShapeCircle", keyword)) {
01527             shapeFound = parseShapeCircle(grid, shape, x, y, radius, growth, keyword);
01528         }
01529         else if (isElement(cur->name, (const xmlChar *)"Alternative", keyword)) {
01530             if (isValidAlternative(cur, keyword)) {
01531                 parseAlternativeContent(grid, cur);
01532             }
01533         }
01534         shape = shape->next;
01535     }
01536 
01537     if ( !shapeFound )
01538     {
01539         return false;
01540     }
01541 
01542     gZone * zone = NULL;
01543     if (sn_GetNetState() != nCLIENT )
01544     {
01545         if (!xmlStrcmp(xmlGetProp(cur, (const xmlChar *)"effect"), (const xmlChar *)"win")) {
01546             zone = tNEW( gWinZoneHack) ( grid, eCoord(x*sizeMultiplier,y*sizeMultiplier) );
01547         }
01548         else if (!xmlStrcmp(xmlGetProp(cur, (const xmlChar *)"effect"), (const xmlChar *)"death")) {
01549             zone = tNEW( gDeathZoneHack) ( grid, eCoord(x*sizeMultiplier,y*sizeMultiplier) );
01550         }
01551         else if (!xmlStrcmp(xmlGetProp(cur, (const xmlChar *)"effect"), (const xmlChar *)"fortress")) {
01552             zone = tNEW( gBaseZoneHack) ( grid, eCoord(x*sizeMultiplier,y*sizeMultiplier) );
01553         }
01554 
01555         // leaving zone undeleted is no memory leak here, the grid takes control of it
01556         if ( zone )
01557         {
01558             zone->SetRadius( radius*sizeMultiplier );
01559             zone->SetExpansionSpeed( growth*sizeMultiplier );
01560             zone->SetRotationSpeed( .3f );
01561             zone->RequestSync();
01562         }
01563     }
01564 
01565     return zone;

Here is the call graph for this function:

Here is the caller graph for this function:

void gParser::parseWall ( eGrid grid,
xmlNodePtr  cur,
const xmlChar *  keyword 
) [protected]

Definition at line 1741 of file gParser.cpp.

References DrawRim(), eCoord, endElementAlternative(), height, eGrid::Insert(), isElement(), isValidAlternative(), myxmlGetPropFloat(), NULL, parseAlternativeContent(), parseWallLine(), parseWallRect(), and REAL.

Referenced by parseAlternativeContent(), and parseField().

01743 {
01744     ePoint *R = NULL, *sR = NULL;
01745     REAL ox, oy, x, y;
01746 
01747     REAL height = myxmlGetPropFloat(cur, "height");
01748     if ( height <= 0 )
01749         height = 10000;
01750 
01751     cur = cur->xmlChildrenNode;
01752 
01753     while (cur != NULL) {
01754         if (!xmlStrcmp(cur->name, (const xmlChar *)"text") || !xmlStrcmp(cur->name, (const xmlChar *)"comment")) {}
01755         else if (isElement(cur->name, (const xmlChar *)"Point", keyword)) {
01756             x = myxmlGetPropFloat(cur, "x");
01757             y = myxmlGetPropFloat(cur, "y");
01758 
01759             if (R == NULL)
01760                 R = grid->Insert(eCoord(x, y) * sizeMultiplier);
01761             else
01762                 R = this->DrawRim(grid, R, eCoord(x, y) * sizeMultiplier, height);
01763 
01764             // TODO-Alt:
01765             // if this function returns a point, use it in the wall. Otherwise, ignore what comes out.
01766             endElementAlternative(grid, cur, keyword);
01767         }
01768         else if (isElement(cur->name, (const xmlChar *)"SavePos", keyword)) {
01769             sR = R;
01770             endElementAlternative(grid, cur, keyword);
01771         }
01772         else if (isElement(cur->name, (const xmlChar *)"RestorePos", keyword)) {
01773             R = sR;
01774             endElementAlternative(grid, cur, keyword);
01775         }
01776         else if (isElement(cur->name, (const xmlChar *)"Line", keyword)) {
01777             parseWallLine(grid, cur, keyword);
01778             endElementAlternative(grid, cur, keyword);
01779         }
01780         else if (isElement(cur->name, (const xmlChar *)"Rectangle", keyword)) {
01781             parseWallRect(grid, cur, keyword);
01782             endElementAlternative(grid, cur, keyword);
01783         }
01784         else if (isElement(cur->name, (const xmlChar *)"Alternative", keyword)) {
01785             if (isValidAlternative(cur, keyword)) {
01786                 parseAlternativeContent(grid, cur);
01787             }
01788         }
01789         cur = cur->next;
01790         ox = x;
01791         oy = y;
01792     }

Here is the call graph for this function:

Here is the caller graph for this function:

bool gParser::parseShapeCircle ( eGrid grid,
xmlNodePtr  cur,
float &  x,
float &  y,
float &  radius,
float &  growth,
const xmlChar *  keyword 
) [protected]

Definition at line 1490 of file gParser.cpp.

References endElementAlternative(), isElement(), isValidAlternative(), myxmlGetPropFloat(), NULL, and parseAlternativeContent().

Referenced by parseZoneArthemis_v1().

01492 {
01493     radius = myxmlGetPropFloat(cur, "radius");
01494     growth = myxmlGetPropFloat(cur, "growth");
01495 
01496     cur = cur->xmlChildrenNode;
01497     while( cur != NULL) {
01498         if (!xmlStrcmp(cur->name, (const xmlChar *)"text") || !xmlStrcmp(cur->name, (const xmlChar *)"comment")) {}
01499         else if (isElement(cur->name, (const xmlChar *)"Point", keyword)) {
01500             x = myxmlGetPropFloat(cur, "x");
01501             y = myxmlGetPropFloat(cur, "y");
01502 
01503             endElementAlternative(grid, cur, keyword);
01504             return true;
01505         }
01506         else if (isElement(cur->name, (const xmlChar *)"Alternative", keyword)) {
01507             if (isValidAlternative(cur, keyword)) {
01508                 parseAlternativeContent(grid, cur);
01509             }
01510         }
01511         cur = cur->next;
01512     }
01513     return false;

Here is the call graph for this function:

Here is the caller graph for this function:

void gParser::parseField ( eGrid grid,
xmlNodePtr  cur,
const xmlChar *  keyword 
) [protected]

Definition at line 1928 of file gParser.cpp.

References isElement(), isValidAlternative(), NULL, parseAlternativeContent(), parseAxes(), parseObstacleWall(), parseSpawn(), parseWall(), parseWallLine(), parseWallRect(), parseZone(), and parseZoneArthemis_v1().

Referenced by parseAlternativeContent(), and parseWorld().

01930 {
01931     cur = cur->xmlChildrenNode;
01932     while (cur != NULL) {
01933         if (!xmlStrcmp(cur->name, (const xmlChar *)"text") || !xmlStrcmp(cur->name, (const xmlChar *)"comment")) {}
01934         else if (isElement(cur->name, (const xmlChar *)"Axes", keyword)) {
01935             parseAxes(grid, cur, keyword);
01936         }
01937         else if (isElement(cur->name, (const xmlChar *)"Spawn", keyword)) {
01938             parseSpawn(grid, cur, keyword);
01939         }
01940 #ifdef ENABLE_ZONESV2
01941         // Introduced in version 2, but no extra logic is required for it.
01942         else if (isElement(cur->name, (const xmlChar *)"Ownership", keyword)) {
01943             parseOwnership(grid, cur, keyword);
01944         }
01945         else if (isElement(cur->name, (const xmlChar *)"Monitor", keyword)) {
01946             parseMonitor(grid, cur, keyword);
01947         }
01948 #endif
01949         else if (isElement(cur->name, (const xmlChar *)"Zone", keyword)) {
01950             parseZone(grid, cur, keyword);
01951         }
01952         else if (isElement(cur->name, (const xmlChar *)"Zone_v1", keyword)) {
01953             parseZoneArthemis_v1(grid, cur, keyword);
01954         }
01955         else if (isElement(cur->name, (const xmlChar *)"Wall", keyword)) {
01956             parseWall(grid, cur, keyword);
01957         }
01958         else if (isElement(cur->name, (const xmlChar *)"ObstacleWall", keyword)) {
01959             parseObstacleWall(grid, cur, keyword);
01960         }
01961         else if (isElement(cur->name, (const xmlChar *)"Line", keyword)) {
01962             parseWallLine(grid, cur, keyword);
01963         }
01964         else if (isElement(cur->name, (const xmlChar *)"Rectangle", keyword)) {
01965             parseWallRect(grid, cur, keyword);
01966         }
01967         else if (isElement(cur->name, (const xmlChar *)"Alternative", keyword)) {
01968             if (isValidAlternative(cur, keyword)) {
01969                 parseAlternativeContent(grid, cur);
01970             }
01971         }
01972         cur = cur->next;
01973     }

Here is the call graph for this function:

Here is the caller graph for this function:

void gParser::parseWorld ( eGrid grid,
xmlNodePtr  cur,
const xmlChar *  keyword = NULL 
) [protected]

Definition at line 2080 of file gParser.cpp.

References isElement(), isValidAlternative(), NULL, parseAlternativeContent(), and parseField().

Referenced by Parse(), parseAlternativeContent(), and parseMap().

02083 {
02084     cur = cur->xmlChildrenNode;
02085     while (cur != NULL) {
02086         if (!xmlStrcmp(cur->name, (const xmlChar *)"text") || !xmlStrcmp(cur->name, (const xmlChar *)"comment")) {}
02087         else if (isElement(cur->name, (const xmlChar *)"Field", keyword)) {
02088             parseField(grid, cur, keyword);
02089         }
02090         else if (isElement(cur->name, (const xmlChar *)"Alternative", keyword)) {
02091             if (isValidAlternative(cur, keyword)) {
02092                 parseAlternativeContent(grid, cur);
02093             }
02094         }
02095         cur = cur->next;

Here is the call graph for this function:

Here is the caller graph for this function:

void gParser::parseMap ( eGrid grid,
xmlNodePtr  cur,
const xmlChar *  keyword = NULL 
) [protected]

Definition at line 2137 of file gParser.cpp.

References isElement(), isValidAlternative(), mapVersion, myxmlGetPropInt(), NULL, parseAlternativeContent(), parseSettings(), parseWorld(), and theGrid.

Referenced by Parse(), and parseAlternativeContent().

02140 {
02141     mapVersion = myxmlGetPropInt(cur, "version");
02142 
02143     cur = cur->xmlChildrenNode;
02144     while (cur != NULL) {
02145         if (!xmlStrcmp(cur->name, (const xmlChar *)"text") || !xmlStrcmp(cur->name, (const xmlChar *)"comment")) {}
02146         else if (isElement(cur->name, (const xmlChar *)"Settings", keyword)) {
02147             parseSettings (grid, cur, keyword);
02148         }
02149         else if (isElement(cur->name, (const xmlChar *)"World", keyword)) {
02150             parseWorld (theGrid, cur, keyword);
02151         }
02152         else if (isElement(cur->name, (const xmlChar *)"Alternative", keyword)) {
02153             if (isValidAlternative(cur, keyword)) {
02154                 parseAlternativeContent(grid, cur);
02155             }
02156         }
02157         cur = cur->next;

Here is the call graph for this function:

Here is the caller graph for this function:

void gParser::parseSettings ( eGrid grid,
xmlNodePtr  cur,
const xmlChar *  keyword = NULL 
) [protected]

Definition at line 2116 of file gParser.cpp.

References gArena::GetSizeMultiplier(), isElement(), isValidAlternative(), NULL, parseAlternativeContent(), parseSetting(), and update_settings().

Referenced by parseAlternativeContent(), and parseMap().

02119 {
02120     cur = cur->xmlChildrenNode;
02121     while (cur != NULL) {
02122         if (!xmlStrcmp(cur->name, (const xmlChar *)"text") || !xmlStrcmp(cur->name, (const xmlChar *)"comment")) {}
02123         else if (isElement(cur->name, (const xmlChar *)"Setting", keyword)) {
02124             parseSetting(grid, cur, keyword);
02125         }
02126         else if (isElement(cur->name, (const xmlChar *)"Alternative", keyword)) {
02127             if (isValidAlternative(cur, keyword)) {
02128                 parseAlternativeContent(grid, cur);
02129             }
02130         }
02131         cur = cur->next;
02132     }
02133 
02134     update_settings();

Here is the call graph for this function:

Here is the caller graph for this function:

void gParser::parseSetting ( eGrid grid,
xmlNodePtr  cur,
const xmlChar *  keyword 
) [protected]

Definition at line 2098 of file gParser.cpp.

References endElementAlternative(), tRecorderBase::IsPlayingBack(), tConfItemBase::LoadAll(), tConfItemBase::LoadPlayback(), myxmlGetProp(), nCLIENT, sn_GetNetState(), and ss.

Referenced by parseAlternativeContent(), and parseSettings().

02101 {
02102     if (strlen(myxmlGetProp(cur, "name")) && strlen(myxmlGetProp(cur, "value")) && sn_GetNetState() != nCLIENT )
02103     {
02104         std::stringstream ss;
02105         /* Yes it is ackward to generate a string that will be decifered on the other end*/
02106         ss << myxmlGetProp(cur, "name")  << " " << myxmlGetProp(cur, "value");
02107         if ( tRecorder::IsPlayingBack() )
02108             tConfItemBase::LoadPlayback( true );
02109         else
02110             tConfItemBase::LoadAll(ss);
02111     }
02112     /* Verify if any sub elements are included, and if they contain any Alt
02113        Sub elements of Point arent defined in the current version*/

Here is the call graph for this function:

Here is the caller graph for this function:

void gParser::parseAlternativeContent ( eGrid grid,
xmlNodePtr  cur 
) [protected]

Definition at line 1847 of file gParser.cpp.

References isElement(), isValidAlternative(), NULL, parseAxes(), parseField(), parseMap(), parseObstacleWall(), parseSetting(), parseSettings(), parseSpawn(), parseWall(), parseWallLine(), parseWallRect(), parseWorld(), parseZone(), and parseZoneArthemis_v1().

Referenced by endElementAlternative(), Parse(), parseAxes(), parseField(), parseMap(), parseObstacleWall(), parseSettings(), parseShapeCircle(), parseWall(), parseWorld(), parseZoneArthemis_v1(), and processSubAlt().

01849 {
01850     const xmlChar * keyword = xmlGetProp(cur, (const xmlChar *) "keyword");
01851 
01852     cur = cur->xmlChildrenNode;
01853 
01854     while (cur != NULL) {
01855         if (!xmlStrcmp(cur->name, (const xmlChar *)"text") || !xmlStrcmp(cur->name, (const xmlChar *)"comment")) {
01856             /* Do nothing, but is required to eliminate all Text and Comment element */
01857             /* text elements are half of any other elements, drop them here rather than perform countless test */
01858         }
01859         /* The elements of Field */
01860         else if (isElement(cur->name, (const xmlChar *)"Axes", keyword)) {
01861             parseAxes(grid, cur, keyword);
01862         }
01863         else if (isElement(cur->name, (const xmlChar *)"Spawn", keyword)) {
01864             parseSpawn(grid, cur, keyword);
01865         }
01866         else if (isElement(cur->name, (const xmlChar *)"Zone", keyword)) {
01867             parseZone(grid, cur, keyword);
01868         }
01869         else if (isElement(cur->name, (const xmlChar *)"Zone_v1", keyword)) {
01870             parseZoneArthemis_v1(grid, cur, keyword);
01871         }
01872         else if (isElement(cur->name, (const xmlChar *)"Wall", keyword)) {
01873             parseWall(grid, cur, keyword);
01874         }
01875         else if (isElement(cur->name, (const xmlChar *)"ObstacleWall", keyword)) {
01876             parseObstacleWall(grid, cur, keyword);
01877         }
01878         else if (isElement(cur->name, (const xmlChar *)"Line", keyword)) {
01879             parseWallLine(grid, cur, keyword);
01880         }
01881         else if (isElement(cur->name, (const xmlChar *)"Rectangle", keyword)) {
01882             parseWallRect(grid, cur, keyword);
01883         }
01884         /* The settings */
01885         else if (isElement(cur->name, (const xmlChar *)"Settings", keyword)) {
01886             parseSettings(grid, cur, keyword);
01887         }
01888         else if (isElement(cur->name, (const xmlChar *)"Setting", keyword)) {
01889             parseSetting(grid, cur, keyword);
01890         }
01891         /* The big holders*/
01892         else if (isElement(cur->name, (const xmlChar *)"Map", keyword)) {
01893             parseMap(grid, cur, keyword);
01894         }
01895         else if (isElement(cur->name, (const xmlChar *)"World", keyword)) {
01896             parseWorld(grid, cur, keyword);
01897         }
01898         else if (isElement(cur->name, (const xmlChar *)"Field", keyword)) {
01899             parseField(grid, cur, keyword);
01900         }
01901         /* Those that cant affect the instance directly. They should return something */
01902         else if (isElement(cur->name, (const xmlChar *)"Axis", keyword)) {
01903             // TODO-Alt2: A method to read in Axis data and return an "Axis object" to be captured at some other level.
01904             // The same method could be used inside of the parseAxes
01905             //            parseAxis(grid, cur, keyword);
01906         }
01907         else if (isElement(cur->name, (const xmlChar *)"Point", keyword)) {
01908             // TODO-Alt2: A method to read in Point data and return an "Point object" to be captured at some other level.
01909             // The same method could be used to read all "Point" in the code
01910             //            parsePoint(grid, cur, keyword);
01911         }
01912         else if (isElement(cur->name, (const xmlChar *)"ShapeCircle", keyword)) {
01913             // TODO-Alt2: parseShapeCircle should be modified to return an "ShapeCircle object" to be captured at some other level.
01914             // The same method could be used inside of the parseZone
01915             //            parseShapeCircle(grid, cur, keyword);
01916         }
01917         else if (isElement(cur->name, (const xmlChar *)"Alternative", keyword)) {
01918             if (isValidAlternative(cur, keyword)) {
01919                 parseAlternativeContent(grid, cur);
01920             }
01921         }
01922 
01923 
01924         cur = cur->next;
01925     }

Here is the call graph for this function:

Here is the caller graph for this function:

void gParser::parseWallLine ( eGrid grid,
xmlNodePtr  cur,
const xmlChar *  keyword 
) [protected]

Definition at line 1706 of file gParser.cpp.

References DrawRim(), eCoord, endElementAlternative(), eGrid::Insert(), myxmlGetPropFloat(), REAL, and sg_Deprecated().

Referenced by parseAlternativeContent(), parseField(), and parseWall().

01707                                                                            {
01708     REAL ox, oy, x, y;
01709     ePoint *R;
01710 
01711     ox = myxmlGetPropFloat(cur, "startx");
01712     oy = myxmlGetPropFloat(cur, "starty");
01713     x = myxmlGetPropFloat(cur,   "endx");
01714     y = myxmlGetPropFloat(cur,   "endy");
01715     R = grid->Insert(eCoord(ox, oy) * sizeMultiplier);
01716     R = this->DrawRim(grid, R, eCoord(x, y) * sizeMultiplier);
01717     sg_Deprecated();
01718 
01719     endElementAlternative(grid, cur, keyword);

Here is the call graph for this function:

Here is the caller graph for this function:

void gParser::parseWallRect ( eGrid grid,
xmlNodePtr  cur,
const xmlChar *  keyword 
) [protected]

Definition at line 1722 of file gParser.cpp.

References DrawRim(), eCoord, endElementAlternative(), eGrid::Insert(), myxmlGetPropFloat(), REAL, and sg_Deprecated().

Referenced by parseAlternativeContent(), parseField(), and parseWall().

01723                                                                            {
01724     REAL ox, oy, x, y;
01725     ePoint *R;
01726 
01727     ox = myxmlGetPropFloat(cur, "startx");
01728     oy = myxmlGetPropFloat(cur, "starty");
01729     x = myxmlGetPropFloat(cur,   "endx");
01730     y = myxmlGetPropFloat(cur,   "endy");
01731     R = grid->Insert(eCoord(ox, oy) * sizeMultiplier);
01732     R = this->DrawRim( grid, R, eCoord( x, oy) * sizeMultiplier);
01733     R = this->DrawRim( grid, R, eCoord( x,  y) * sizeMultiplier);
01734     R = this->DrawRim( grid, R, eCoord(ox,  y) * sizeMultiplier);
01735     R = this->DrawRim( grid, R, eCoord(ox, oy) * sizeMultiplier);
01736     sg_Deprecated();
01737 
01738     endElementAlternative(grid, cur, keyword);

Here is the call graph for this function:

Here is the caller graph for this function:

void gParser::parseObstacleWall ( eGrid grid,
xmlNodePtr  cur,
const xmlChar *  keyword 
) [protected]

Definition at line 1795 of file gParser.cpp.

References DrawRim(), eCoord, endElementAlternative(), height, eGrid::Insert(), isElement(), isValidAlternative(), myxmlGetPropFloat(), NULL, parseAlternativeContent(), REAL, and sg_Deprecated().

Referenced by parseAlternativeContent(), and parseField().

01797 {
01798     ePoint *R = NULL;
01799     REAL x, y;
01800 
01801     REAL height = myxmlGetPropFloat(cur, "height");
01802     cur = cur->xmlChildrenNode;
01803 
01804     while (cur != NULL) {
01805         if (!xmlStrcmp(cur->name, (const xmlChar *)"text") || !xmlStrcmp(cur->name, (const xmlChar *)"comment")) {}
01806         else if (isElement(cur->name, (const xmlChar *)"Point", keyword)) {
01807             x = myxmlGetPropFloat(cur, "x");
01808             y = myxmlGetPropFloat(cur, "y");
01809 
01810             if (R == NULL)
01811                 R = grid->Insert(eCoord(x, y) * sizeMultiplier);
01812             else
01813                 R = this->DrawRim(grid, R, eCoord(x, y) * sizeMultiplier, height );
01814             endElementAlternative(grid, cur, keyword);
01815         }
01816         else if (isElement(cur->name, (const xmlChar *)"Alternative", keyword)) {
01817             if (isValidAlternative(cur, keyword)) {
01818                 parseAlternativeContent(grid, cur);
01819             }
01820         }
01821         cur = cur->next;
01822     }
01823     sg_Deprecated();

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

gArena* gParser::theArena [private]

Definition at line 37 of file gParser.h.

Referenced by parseSpawn().

eGrid* gParser::theGrid [private]

Definition at line 38 of file gParser.h.

Referenced by Parse(), and parseMap().

REAL gParser::rimTexture [private]

Definition at line 40 of file gParser.h.

Referenced by DrawRim(), and Parse().

float gParser::sizeMultiplier [protected]

Definition at line 128 of file gParser.h.


The documentation for this class was generated from the following files:
Generated on Sat Mar 15 23:44:25 2008 for Armagetron Advanced by  doxygen 1.5.4