Changeset edfd1d0 in network-game for server/server.cpp
- Timestamp:
- Dec 25, 2012, 6:27:14 PM (12 years ago)
- Branches:
- master
- Children:
- 4c202e0
- Parents:
- baaf6c8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/server.cpp
rbaaf6c8 redfd1d0 7 7 #include <vector> 8 8 #include <algorithm> 9 10 #include <fcntl.h> 11 #include <assert.h> 9 #include <cstring> 12 10 13 11 #include <sys/socket.h> … … 16 14 #include <arpa/inet.h> 17 15 16 /* 18 17 #include <openssl/bio.h> 19 18 #include <openssl/ssl.h> 20 19 #include <openssl/err.h> 20 */ 21 21 22 22 #include "../common/Compiler.h" 23 #include "../common/Common.h" 23 24 #include "../common/Message.h" 24 #include "../common/Common.h" 25 26 #include "Player.h" 25 #include "../common/Player.h" 26 27 27 #include "DataAccess.h" 28 28 … … 63 63 64 64 return NULL; 65 } 66 67 void broadcastPlayerPositions(vector<Player> &vec, int sock) 68 { 69 vector<Player>::iterator it, it2; 70 NETWORK_MSG serverMsg; 71 72 serverMsg.type = MSG_TYPE_PLAYER; 73 74 for (it = vec.begin(); it != vec.end(); it++) 75 { 76 strncpy(serverMsg.buffer, (char*)&*it, sizeof(Player)); 77 78 for (it2 = vec.begin(); it2 != vec.end(); it2++) 79 { 80 if ( sendMessage(&serverMsg, sock, &(it2->addr)) < 0 ) 81 error("sendMessage"); 82 } 83 } 65 84 } 66 85 … … 73 92 vector<Player> vctPlayers; 74 93 75 SSL_load_error_strings();76 ERR_load_BIO_strings();77 OpenSSL_add_all_algorithms();94 //SSL_load_error_strings(); 95 //ERR_load_BIO_strings(); 96 //OpenSSL_add_all_algorithms(); 78 97 79 98 if (argc < 2) { … … 127 146 error("sendMessage"); 128 147 } 129 } 130 148 149 broadcastPlayerPositions(vctPlayers, sock); 150 } 131 151 } 132 152
Note:
See TracChangeset
for help on using the changeset viewer.