/* $Id: Glue.C,v 1.5 1996/09/30 03:33:38 swetland Exp $
**
** MechManiaII Client Glue and Startup Code
**
** Copyright 1996, Brian J. Swetland <swetland@uiuc.edu> and ACM@UIUC.
** Free for non-commercial use.  Share and Enjoy!
*/

#include <stdio.h>
#include <stdlib.h>

#include "Client.h"
#include "Team.h"

main(int argc, char *argv[])
{
    MessageSocket *ms;
    Client *client;
    TeamSuper *team;
    int port;

    if(argc < 2) {
        fprintf(stderr,"usage:  client <hostname> [<portno>]\n");
        return 0;
    }

    if(argc == 3) 
        port = atoi(argv[2]);
    else
        port = 31337;
    
    team = new Team();

    fprintf(stderr,"MM2 Client: Team is named \"%s\".\n", team->Name());
    fprintf(stderr,"MM2 Client: Connecting to %s:%d.\n",argv[1],port);

    ms = new MessageSocket();
    ms->ConnectTo(argv[1],port);
    
    client = new Client(team, ms);
    client->Run();

    fprintf(stderr,"MM2 Client: Exiting cleanly\n\n.");
}
 

