Changeset 6c9bcdd in network-game for client/Client


Ignore:
Timestamp:
Dec 20, 2013, 2:09:42 AM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
ce2bb87
Parents:
402cf86
Message:

Client sends flag pickup and drop messages in individual games

File:
1 edited

Legend:

Unmodified
Added
Removed
  • client/Client/main.cpp

    r402cf86 r6c9bcdd  
    356356               break;
    357357            case ALLEGRO_KEY_S:  // pickup an item next to you
    358                if (state == STATE_GAME) {
     358               if (state == STATE_GAME || state == STATE_NEW_GAME) {
    359359                  msgTo.type = MSG_TYPE_PICKUP_FLAG;
    360360                  memcpy(msgTo.buffer, &curPlayerId, 4);
     
    363363               break;
    364364            case ALLEGRO_KEY_D:  // drop the current item
    365                if (state == STATE_GAME) {
    366                   // find the current player in the player list
    367                   map<unsigned int, Player*>::iterator it;
     365               if (state == STATE_GAME || state == STATE_NEW_GAME) {
    368366                  Player* p = NULL;
    369                   for(it = mapPlayers.begin(); it != mapPlayers.end(); it++)
    370                   {
    371                      if (it->second->id == curPlayerId)
    372                         p = it->second;
    373                   }
     367                  try {
     368                     p = mapPlayers.at(curPlayerId);
     369                  } catch (const out_of_range& ex) {}
    374370
    375371                  if (p != NULL) {
Note: See TracChangeset for help on using the changeset viewer.