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