Changeset 0678d60 in network-game for common/WorldMap.cpp


Ignore:
Timestamp:
Jan 22, 2014, 1:31:27 AM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
06fc7f7
Parents:
204edcf
Message:

All server warnings have been fixed and the WorldMap class has a new method to create flags (and, in the future, other objects) based on structures present on the map

File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/WorldMap.cpp

    r204edcf r0678d60  
    4545}
    4646
     47void WorldMap::createObjectsFromStructures() {
     48   for (int y=0; y<this->height; y++) {
     49      for (int x=0; x<this->width; x++) {
     50         switch (this->getStructure(x, y)) {
     51            case WorldMap::STRUCTURE_BLUE_FLAG:
     52               this->addObject(WorldMap::OBJECT_BLUE_FLAG, x*25+12, y*25+12);
     53               break;
     54            case WorldMap::STRUCTURE_RED_FLAG:
     55               this->addObject(WorldMap::OBJECT_RED_FLAG, x*25+12, y*25+12);
     56               break;
     57            case WorldMap::STRUCTURE_NONE:
     58               break;
     59         }
     60      }
     61   }
     62}
     63
    4764WorldMap::TerrainType WorldMap::getElement(int x, int y)
    4865{
     
    7188   pos.y = 0;
    7289
    73    for (int x=0; x<vctStructures->size(); x++) {
    74       for (int y=0; y<(*vctStructures)[x]->size(); y++) {
     90   for (unsigned int x=0; x<vctStructures->size(); x++) {
     91      for (unsigned int y=0; y<(*vctStructures)[x]->size(); y++) {
    7592        if ((*(*vctStructures)[x])[y] == t) {
    7693           pos.x = x;
     
    131148   case WorldMap::OBJECT_RED_FLAG:
    132149      cout << "RED_FLAG" << endl;
     150      break;
     151   case WorldMap::OBJECT_NONE:
     152      cout << "OBJECY_NONE" << endl;
    133153      break;
    134154   }
     
    145165            cout << "RED_FLAG" << endl;
    146166            break;
     167         case WorldMap::OBJECT_NONE:
     168            cout << "OBJECY_NONE" << endl;
     169            break;
    147170         }
    148171         it->pos.x = x;
Note: See TracChangeset for help on using the changeset viewer.