1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * |
5 | * |
6 | * Deliantra is free software: you can redistribute it and/or modify it under |
6 | * Deliantra is free software: you can redistribute it and/or modify it under |
7 | * the terms of the Affero GNU General Public License as published by the |
7 | * the terms of the Affero GNU General Public License as published by the |
8 | * Free Software Foundation, either version 3 of the License, or (at your |
8 | * Free Software Foundation, either version 3 of the License, or (at your |
9 | * option) any later version. |
9 | * option) any later version. |
… | |
… | |
132 | state = ST_SETUP; |
132 | state = ST_SETUP; |
133 | mapmode = Map1aCmd; |
133 | mapmode = Map1aCmd; |
134 | mapx = 11; |
134 | mapx = 11; |
135 | mapy = 11; |
135 | mapy = 11; |
136 | itemcmd = 1; /* Default is version item1 command */ |
136 | itemcmd = 1; /* Default is version item1 command */ |
137 | max_rate = 100000 / (1000000 / MAX_TIME); // ~1mbit is assumed per default |
137 | max_rate = 200000 / (1000000 / MAX_TIME); // ~2mbit is assumed per default |
138 | |
138 | |
139 | /* Do this so we don't send a face command for the client for |
139 | /* Do this so we don't send a face command for the client for |
140 | * this face. Face 0 is sent to the client to say clear |
140 | * this face. Face 0 is sent to the client to say clear |
141 | * face information. |
141 | * face information. |
142 | */ |
142 | */ |
… | |
… | |
146 | socket_ev.set (fd, EV_READ); |
146 | socket_ev.set (fd, EV_READ); |
147 | socket_ev.prio (2); // one higher than the ticker priority |
147 | socket_ev.prio (2); // one higher than the ticker priority |
148 | socket_ev.start (); |
148 | socket_ev.start (); |
149 | |
149 | |
150 | // initialisation done, kick it! |
150 | // initialisation done, kick it! |
151 | send_packet_printf ("version %d %d %s\n", VERSION_CS, VERSION_SC, VERSION_INFO); |
151 | INVOKE_CLIENT (CONNECT, this); |
|
|
152 | |
152 | flush (); |
153 | flush (); |
153 | |
154 | |
154 | reset_stats (); |
155 | reset_stats (); |
155 | |
156 | |
156 | clients.insert (this); |
157 | clients.insert (this); |
… | |
… | |
167 | } |
168 | } |
168 | |
169 | |
169 | void |
170 | void |
170 | client::do_destroy () |
171 | client::do_destroy () |
171 | { |
172 | { |
|
|
173 | INVOKE_CLIENT (CLIENT_DESTROY, this); |
172 | attachable::do_destroy (); |
174 | attachable::do_destroy (); |
173 | |
175 | |
174 | if (pl) |
176 | if (pl) |
175 | pl->disconnect (); |
177 | pl->disconnect (); |
176 | |
178 | |
… | |
… | |
221 | |
223 | |
222 | client * |
224 | client * |
223 | client::create (int fd, const char *peername) |
225 | client::create (int fd, const char *peername) |
224 | { |
226 | { |
225 | client *ns = new client (dup (fd), peername); |
227 | client *ns = new client (dup (fd), peername); |
|
|
228 | |
226 | ns->instantiate (); // effectively a nop right now |
229 | ns->instantiate (); // effectively a nop right now |
227 | INVOKE_CLIENT (CONNECT, ns); |
230 | |
228 | return ns; |
231 | return ns; |
229 | } |
232 | } |
230 | |
233 | |