ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/cf.schmorp.de/dclient/src/frontend/tclient/tmain.cpp
Revision: 1.4
Committed: Mon Oct 25 02:07:51 2010 UTC (15 years, 11 months ago) by sf-pippijn
Branch: MAIN
Changes since 1.3: +1 -63 lines
Log Message:
factored out common client main

File Contents

# User Rev Content
1 sf-pippijn 1.1 #include "autoconf.h"
2    
3     #include "tinput_handler.h"
4     #include "tquery_handler.h"
5     #include "trenderer.h"
6    
7     #include "deliantra/client.h"
8     #include "deliantra/command_parser.h"
9     #include "deliantra/communicator.h"
10     #include "deliantra/handshake_handler.h"
11     #include "deliantra/inventory_manager.h"
12     #include "deliantra/message_logger.h"
13    
14     #include "deliantra/data/item.h"
15    
16     #include "adt/bind.h"
17    
18     #include <ndk/application.hh>
19    
20     #include <csignal>
21     #include <cstring>
22     #include <iomanip>
23     #include <memory>
24    
25     static void
26     start_game ( std::string const &server
27     , std::string const &port
28     , std::string const &user
29     , std::string const &pass
30     )
31     {
32     if (!ev_default_loop (EVBACKEND_SELECT))
33     throw "unable to initialise event loop";
34    
35     // deliantra
36     communicator comm (server, port);
37     command_parser cmdp;
38     client cli (comm, cmdp);
39     handshake_handler hh (comm);
40     message_logger logger;
41     inventory_manager invman;
42    
43     cmdp.add_command_handler (hh);
44 sf-pippijn 1.3 cmdp.add_command_handler (invman);
45 sf-pippijn 1.1 cmdp.add_command_handler (logger);
46    
47     // link deliantra stuff together
48     comm.set_packet_handler (cli);
49    
50     // tclient
51     input_handler ih (comm);
52     query_handler qh (comm, user, pass);
53     renderer rend;
54    
55     // link tclient stuff in
56     cmdp.add_command_handler (qh);
57     cmdp.add_command_handler (rend);
58    
59 sf-pippijn 1.3 ih.rend = &rend;
60    
61 sf-pippijn 1.1 // run the event loop
62     ev_run (EV_DEFAULT_UC_ 0);
63     }
64    
65 sf-pippijn 1.4 #include "../main.h"