Changes in client/Client/main.cpp [3b1efcc:e607c0f] in network-game


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • client/Client/main.cpp

    r3b1efcc re607c0f  
    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.