- Timestamp:
- Dec 24, 2013, 3:02:22 PM (11 years ago)
- Branches:
- master
- Children:
- 8554263
- Parents:
- e1af80c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/main.cpp
re1af80c r68d94de 130 130 131 131 MessageProcessor msgProcessor; 132 ofstream outputLog;133 132 134 133 int main(int argc, char **argv) … … 141 140 map<unsigned int, Projectile> mapProjectiles; 142 141 unsigned int curPlayerId = -1; 142 ofstream outputLog; 143 143 144 int scoreBlue, scoreRed; 144 145 … … 341 342 memcpy((char *)&server.sin_addr, (char *)hp->h_addr, hp->h_length); 342 343 server.sin_port = htons(atoi(argv[2])); 344 345 msgProcessor = MessageProcessor(sock, &outputLog); 343 346 344 347 al_start_timer(timer); … … 370 373 msgTo.type = MSG_TYPE_PICKUP_FLAG; 371 374 memcpy(msgTo.buffer, &curPlayerId, 4); 372 msgProcessor.sendMessage(&msgTo, sock, &server, &outputLog);375 msgProcessor.sendMessage(&msgTo, &server); 373 376 } 374 377 break; … … 391 394 msgTo.type = MSG_TYPE_DROP_FLAG; 392 395 memcpy(msgTo.buffer, &curPlayerId, 4); 393 msgProcessor.sendMessage(&msgTo, sock, &server, &outputLog);396 msgProcessor.sendMessage(&msgTo, &server); 394 397 } 395 398 } … … 414 417 memcpy(msgTo.buffer+8, &pos.y, 4); 415 418 416 msgProcessor.sendMessage(&msgTo, sock, &server, &outputLog);419 msgProcessor.sendMessage(&msgTo, &server); 417 420 } 418 421 else … … 449 452 memcpy(msgTo.buffer+4, &target->id, 4); 450 453 451 msgProcessor.sendMessage(&msgTo, sock, &server, &outputLog);454 msgProcessor.sendMessage(&msgTo, &server); 452 455 } 453 456 } … … 456 459 } 457 460 458 if (msgProcessor.receiveMessage(&msgFrom, sock, &from, &outputLog) >= 0)461 if (msgProcessor.receiveMessage(&msgFrom, &from) >= 0) 459 462 processMessage(msgFrom, state, chatConsole, gameMap, mapPlayers, mapProjectiles, curPlayerId, scoreBlue, scoreRed); 460 463 … … 463 466 redraw = false; 464 467 465 msgProcessor.resendUnackedMessages(sock, &outputLog); 466 //msgProcessor.cleanAckedMessages(&outputLog); 468 msgProcessor.resendUnackedMessages(); 467 469 468 470 if (debugging && wndCurrent == wndGame) … … 981 983 strcpy(msgTo.buffer, gameName.c_str()); 982 984 983 msgProcessor.sendMessage(&msgTo, sock, &server, &outputLog);985 msgProcessor.sendMessage(&msgTo, &server); 984 986 985 987 break; … … 1362 1364 memcpy(msgTo.buffer+username.size()+password.size()+2, &playerClass, 4); 1363 1365 1364 msgProcessor.sendMessage(&msgTo, sock, &server, &outputLog);1366 msgProcessor.sendMessage(&msgTo, &server); 1365 1367 } 1366 1368 … … 1379 1381 strcpy(msgTo.buffer+username.size()+1, strPassword.c_str()); 1380 1382 1381 msgProcessor.sendMessage(&msgTo, sock, &server, &outputLog);1383 msgProcessor.sendMessage(&msgTo, &server); 1382 1384 1383 1385 state = STATE_LOBBY; … … 1404 1406 strcpy(msgTo.buffer, username.c_str()); 1405 1407 1406 msgProcessor.sendMessage(&msgTo, sock, &server, &outputLog);1408 msgProcessor.sendMessage(&msgTo, &server); 1407 1409 } 1408 1410 … … 1420 1422 strcpy(msgTo.buffer, msg.c_str()); 1421 1423 1422 msgProcessor.sendMessage(&msgTo, sock, &server, &outputLog);1424 msgProcessor.sendMessage(&msgTo, &server); 1423 1425 } 1424 1426 … … 1438 1440 strcpy(msgTo.buffer, msg.c_str()); 1439 1441 1440 msgProcessor.sendMessage(&msgTo, sock, &server, &outputLog);1442 msgProcessor.sendMessage(&msgTo, &server); 1441 1443 } 1442 1444 … … 1453 1455 strcpy(msgTo.buffer, msg.c_str()); 1454 1456 1455 msgProcessor.sendMessage(&msgTo, sock, &server, &outputLog);1457 msgProcessor.sendMessage(&msgTo, &server); 1456 1458 } 1457 1459 … … 1467 1469 msgTo.type = MSG_TYPE_LEAVE_GAME; 1468 1470 1469 msgProcessor.sendMessage(&msgTo, sock, &server, &outputLog);1471 msgProcessor.sendMessage(&msgTo, &server); 1470 1472 } 1471 1473
Note:
See TracChangeset
for help on using the changeset viewer.