| //Main: // |
| |
| int main(int argc, char *argv[]) { |
| nick = new char[TIC_MAXNAMELEN]; |
| ZeroMemory(nick, TIC_MAXNAMELEN); |
| strcpy(nick, "default"); //the in-game nickname |
| |
| WORD sockVersion = MAKEWORD(2,2); |
| WSADATA wsadata; |
| int result = WSAStartup(sockVersion, &wsadata); |
| if(result) { |
| return -1; |
| } |
| |
| bool alive = true; |
| while(alive) { |
| cout<<"\nWelcome to SereeK's multiplayer TicTacToe!" |
| <<"\nDo you want to:\n1. Join a game \n2. Host a game. \n3. Settings. \n4. Exit\n"; |
| int menu = 0; |
| cin>> menu; |
| |
| switch(menu) { |
| case 1: |
| result = joinGame(); |
| cout<<"\nGame over.\n"; |
| break; |
| case 2: |
| result = hostGame(); |
| cout<<"\nGame over.\n"; |
| break; |
| case 3: |
| if(!settings()) { |
| cout<<"\nFailed to edit settings..."; |
| } |
| break; |
| default: |
| if(confirm("exit")) { |
| alive = false; |
| } |
| break; |
| } |
| |
| cout<<"\n"; |
| system("CLS"); |
| } |
| |
| delete [] nick; |
| WSACleanup(); |
| return 0; |
| } |