ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/cf.schmorp.de/dclient/src/frontend/client/main.cpp
Revision: 1.12
Committed: Mon Feb 7 19:18:45 2011 UTC (15 years, 8 months ago) by sf-pippijn
Branch: MAIN
CVS Tags: HEAD
Changes since 1.11: +1 -1 lines
Log Message:
inventory_widget: don't fault on pgdn with only one item

by Jonathan Neuschäfer <j.neuschaefer@gmx.net>

File Contents

# Content
1 #include "autoconf.h"
2
3 #include "dclient/input_handler.h"
4 #include "dclient/query_handler.h"
5 #include "dclient/renderer.h"
6 #include "dclient/widgets.h"
7 #include "dclient/widgets/inventory.h"
8
9 #include "deliantra/client.h"
10 #include "deliantra/command_parser.h"
11 #include "deliantra/communicator.h"
12 #include "deliantra/handshake_handler.h"
13 #include "deliantra/inventory_manager.h"
14 #include "deliantra/message_logger.h"
15
16 #include "deliantra/data/item.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 std::runtime_error ("unable to initialise event loop");
34
35 // ncurses
36 std::auto_ptr<ndk::application> app (ndk::app = new ndk::application);
37 app->init_palette ();
38
39 // deliantra
40 communicator comm (server, port);
41 command_parser cmdp;
42 client cli (comm, cmdp);
43 handshake_handler hh (comm);
44 message_logger logger;
45 inventory_manager invman;
46
47 cmdp.add_command_handler (hh);
48 cmdp.add_command_handler (invman);
49 cmdp.add_command_handler (logger);
50
51 // link deliantra stuff together
52 comm.set_packet_handler (cli);
53
54 // dclient
55 widgets ui;
56 renderer rend (ui);
57 input_handler input (comm, ui);
58 query_handler qh (comm, ui, user, pass);
59
60 // link dclient stuff together
61 invman.set_inventory_view (*ui.inventory);
62 invman.set_container_view (*ui.container);
63 cmdp.add_command_handler (qh);
64 cmdp.add_command_handler (rend);
65
66 // run the event loop
67 ev_run (EV_DEFAULT_UC_ 0);
68 }
69
70 #include "../main.h"