Changeset cdb4bec in network-game for client/Client/main.cpp


Ignore:
Timestamp:
Dec 9, 2012, 8:59:18 PM (12 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
3f5616f
Parents:
da692b9 (diff), e607c0f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of github.com:weretaco/network-game

File:
1 edited

Legend:

Unmodified
Added
Removed
  • client/Client/main.cpp

    rda692b9 rcdb4bec  
    2323#include "../../common/Compiler.h"
    2424#include "../../common/Message.h"
     25#include "../../common/Common.h"
    2526
    2627#include "Window.h"
     
    200201      error("socket");
    201202
     203   set_nonblock(sock);
     204
    202205   server.sin_family = AF_INET;
    203206   hp = gethostbyname(argv[1]);
     
    209212
    210213   al_start_timer(timer);
    211  
     214
    212215   while(!doexit)
    213216   {
     
    282285         }
    283286      }
    284  
    285       if(redraw && al_is_event_queue_empty(event_queue)) {
     287
     288      if (receiveMessage(&msgFrom, sock, &from) >= 0)
     289      {
     290         processMessage(msgFrom, state, chatConsole);
     291         cout << "state: " << state << endl;
     292      }
     293 
     294      if (redraw && al_is_event_queue_empty(event_queue))
     295      {
    286296         redraw = false;
    287297 
     
    364374      case STATE_START:
    365375      {
     376         cout << "In STATE_START" << endl;
     377
    366378         chatConsole.addLine(response);
    367379
     
    448460
    449461   sendMessage(&msgTo, sock, &server);
    450    receiveMessage(&msgFrom, sock, &from);
    451    processMessage(msgFrom, state, chatConsole);
    452    cout << "state: " << state << endl;
    453462}
    454463
     
    468477
    469478   sendMessage(&msgTo, sock, &server);
    470    receiveMessage(&msgFrom, sock, &from);
    471    processMessage(msgFrom, state, chatConsole);
    472    cout << "state: " << state << endl;
    473479}
    474480
     
    482488
    483489   sendMessage(&msgTo, sock, &server);
    484    receiveMessage(&msgFrom, sock, &from);
    485    processMessage(msgFrom, state, chatConsole);
    486490}
    487491
     
    502506
    503507   sendMessage(&msgTo, sock, &server);
    504    receiveMessage(&msgFrom, sock, &from);
    505    processMessage(msgFrom, state, chatConsole);
    506 }
     508}
Note: See TracChangeset for help on using the changeset viewer.