Changeset e70b66b in network-game for client/Client/main.cpp
- Timestamp:
- Jan 23, 2014, 1:37:40 AM (11 years ago)
- Branches:
- master
- Children:
- 7f884ea
- Parents:
- 06fc7f7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/main.cpp
r06fc7f7 re70b66b 432 432 target = it->second; 433 433 cout << "set target" << endl; 434 if (target-> getId() != curPlayerId && target->team != curPlayer->team)434 if (target->team != curPlayer->team) 435 435 { 436 436 cout << "Found valid target" << endl; 437 437 438 unsigned int targetId = target->getId(); 439 440 msgTo.type = MSG_TYPE_ATTACK; 441 memcpy(msgTo.buffer, &curPlayerId, 4); 442 memcpy(msgTo.buffer+4, &targetId, 4); 443 444 msgProcessor.sendMessage(&msgTo, &server); 438 POSITION cursorPos; 439 cursorPos.x = ev.mouse.x; 440 cursorPos.y = ev.mouse.y; 441 cursorPos = screenToMap(cursorPos); 442 443 float distance =posDistance(cursorPos.toFloat(), target->pos); 444 445 if (distance < 25) { 446 unsigned int targetId = target->getId(); 447 448 msgTo.type = MSG_TYPE_ATTACK; 449 memcpy(msgTo.buffer, &curPlayerId, 4); 450 memcpy(msgTo.buffer+4, &targetId, 4); 451 452 msgProcessor.sendMessage(&msgTo, &server); 453 } 445 454 } 446 455 }
Note:
See TracChangeset
for help on using the changeset viewer.