Changeset 032e550 in network-game


Ignore:
Timestamp:
Jun 17, 2013, 1:43:55 AM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
02fa8fd
Parents:
5b1e31e
Message:

Add some more debug info

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • client/Client/main.cpp

    r5b1e31e r032e550  
    351351            al_draw_text(font, al_map_rgb(0, 255, 0), 515, 80, ALLEGRO_ALIGN_LEFT, ossScoreRed.str().c_str());
    352352
    353             // update player positions
     353            // update players
    354354            map<unsigned int, Player>::iterator it;
     355            for (it = mapPlayers.begin(); it != mapPlayers.end(); it++)
     356            {
     357               it->second.updateTarget(mapPlayers);
     358            }
     359
    355360            for (it = mapPlayers.begin(); it != mapPlayers.end(); it++)
    356361            {
     
    483488{
    484489   string response = string(msg.buffer);
    485 
    486    cout << "Processing message" << endl;
    487490
    488491   switch(state)
     
    588591            case MSG_TYPE_PLAYER:
    589592            {
    590                cout << "Got MSG_TYPE_PLAYER message in STATE_LOGIN" << endl;
     593               //cout << "Got MSG_TYPE_PLAYER message in STATE_LOGIN" << endl;
    591594
    592595               Player p("", "");
    593596               p.deserialize(msg.buffer);
    594597               p.timeLastUpdated = getCurrentMillis();
     598               p.isChasing = false;
    595599               mapPlayers[p.id] = p;
    596600
     
    652656            case MSG_TYPE_ATTACK:
    653657            {
     658               cout << "Received ATTACK message" << endl;
     659
     660               break;
     661            }
     662            case MSG_TYPE_START_ATTACK:
     663            {
     664               cout << "Received START_ATTACK message" << endl;
     665
     666               unsigned int id, targetID;
     667               memcpy(&id, msg.buffer, 4);
     668               memcpy(&targetID, msg.buffer+4, 4);
     669
     670               cout << "source id: " << id << endl;
     671               cout << "target id: " << targetID << endl;
     672
     673               Player* source = &mapPlayers[id];
     674               source->targetPlayer = targetID;
     675               source->isChasing = true;
     676
    654677               break;
    655678            }
  • common/Player.cpp

    r5b1e31e r032e550  
    199199      this->target.y = mapPlayers[this->targetPlayer].pos.y;
    200200
     201      cout << "Setting target" << endl;
     202      cout << "target id: " << mapPlayers[this->targetPlayer].id << endl;
     203      cout << "cur player id: " << this->id << endl;
     204
    201205      if (posDistance(this->pos, this->target.toFloat()) <= this->range) {
     206         cout << "Stopped chasing" << endl;
     207
    202208         this->target.x = this->pos.x;
    203209         this->target.y = this->pos.y;
Note: See TracChangeset for help on using the changeset viewer.