Changeset 6e66ffd in network-game for client


Ignore:
Timestamp:
May 21, 2013, 10:00:54 PM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
5f868c0
Parents:
cc1c6c1
Message:

Add functions to the WorldMap class to allow the server to notify clients of object creation and movement

File:
1 edited

Legend:

Unmodified
Added
Removed
  • client/Client/main.cpp

    rcc1c6c1 r6e66ffd  
    530530   mapPos.y = 0;
    531531   mapPos = mapToScreen(mapPos);
     532
    532533   for (int x=0; x<12; x++)
    533534   {
     
    544545            al_draw_filled_rectangle(x*25+mapPos.x, y*25+mapPos.y, x*25+25+mapPos.x, y*25+25+mapPos.y, al_map_rgb(100, 100, 0));
    545546
    546          if (structure == WorldMap::STRUCTURE_BLUE_FLAG)
    547             al_draw_filled_rectangle(x*25+5+mapPos.x, y*25+5+mapPos.y, x*25+20+mapPos.x, y*25+20+mapPos.y, al_map_rgb(0, 0, 255));
    548          else if (structure == WorldMap::STRUCTURE_RED_FLAG)
    549             al_draw_filled_rectangle(x*25+5+mapPos.x, y*25+5+mapPos.y, x*25+20+mapPos.x, y*25+20+mapPos.y, al_map_rgb(255, 0, 0));
     547         if (structure == WorldMap::STRUCTURE_BLUE_FLAG) {
     548            al_draw_circle(x*25+12+mapPos.x, y*25+12+mapPos.y, 12, al_map_rgb(0, 0, 0), 3);
     549            //al_draw_filled_rectangle(x*25+5+mapPos.x, y*25+5+mapPos.y, x*25+20+mapPos.x, y*25+20+mapPos.y, al_map_rgb(0, 0, 255));
     550         }else if (structure == WorldMap::STRUCTURE_RED_FLAG) {
     551            al_draw_circle(x*25+12+mapPos.x, y*25+12+mapPos.y, 12, al_map_rgb(0, 0, 0), 3);
     552            //al_draw_filled_rectangle(x*25+5+mapPos.x, y*25+5+mapPos.y, x*25+20+mapPos.x, y*25+20+mapPos.y, al_map_rgb(255, 0, 0));
     553         }
     554      }
     555   }
     556
     557   for (int x=0; x<12; x++)
     558   {
     559      for (int y=0; y<12; y++)
     560      {
     561         vector<WorldMap::Object> vctObjects = gameMap->getObjects(x, y);
     562
     563         vector<WorldMap::Object>::iterator it;
     564         for(it = vctObjects.begin(); it != vctObjects.end(); it++) {
     565            switch(it->type) {
     566               case WorldMap::OBJECT_BLUE_FLAG:
     567                  al_draw_filled_rectangle(it->pos.x-8+mapPos.x, it->pos.y-8+mapPos.y, it->pos.x+8+mapPos.x, it->pos.y+8+mapPos.y, al_map_rgb(0, 0, 255));
     568                  break;
     569               case WorldMap::OBJECT_RED_FLAG:
     570                  al_draw_filled_rectangle(it->pos.x-8+mapPos.x, it->pos.y-8+mapPos.y, it->pos.x+8+mapPos.x, it->pos.y+8+mapPos.y, al_map_rgb(255, 0, 0));
     571                  break;
     572            }
     573         }
    550574      }
    551575   }
Note: See TracChangeset for help on using the changeset viewer.