ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/player.C
(Generate patch)

Comparing deliantra/server/server/player.C (file contents):
Revision 1.76 by root, Sun Dec 31 17:17:23 2006 UTC vs.
Revision 1.82 by elmex, Wed Jan 3 02:30:52 2007 UTC

158 158
159/* This loads the first map an puts the player on it. */ 159/* This loads the first map an puts the player on it. */
160static void 160static void
161set_first_map (object *op) 161set_first_map (object *op)
162{ 162{
163 strcpy (op->contr->maplevel, first_map_path); 163 op->contr->maplevel = first_map_path;
164 op->x = -1; 164 op->x = -1;
165 op->y = -1; 165 op->y = -1;
166} 166}
167 167
168void 168void
255 enter_map (); 255 enter_map ();
256 256
257 send_rules (ob); 257 send_rules (ob);
258 send_news (ob); 258 send_news (ob);
259 display_motd (ob); 259 display_motd (ob);
260
261 INVOKE_PLAYER (CONNECT, this);
260 INVOKE_PLAYER (LOGIN, this); 262 INVOKE_PLAYER (LOGIN, this);
261} 263}
262 264
263void 265void
264player::disconnect () 266player::disconnect ()
268 270
269 //TODO: don't be so harsh and destroy :) 271 //TODO: don't be so harsh and destroy :)
270 if (ns) 272 if (ns)
271 { 273 {
272 if (enable_save) 274 if (enable_save)
275 {
273 INVOKE_PLAYER (LOGOUT, this, ARG_INT (0)); 276 INVOKE_PLAYER (LOGOUT, this, ARG_INT (0));
277 save (true);
278 }
279
280 INVOKE_PLAYER (DISCONNECT, this);
274 281
275 client *ns = this->ns; 282 client *ns = this->ns;
276 ns->send_packet ("goodbye"); 283 ns->send_packet ("goodbye");
277 ns->flush (); 284 ns->flush ();
278 ns->pl = 0; 285 ns->pl = 0;
300 ob->roll_stats (); 307 ob->roll_stats ();
301} 308}
302 309
303player::player () 310player::player ()
304{ 311{
305 /* There are some elements we want initialized to non zero value - 312 /* There are some elements we want initialised to non zero value -
306 * we deal with that below this point. 313 * we deal with that below this point.
307 */ 314 */
308 outputs_sync = 16; /* Every 2 seconds */ 315 outputs_sync = 16; /* Every 2 seconds */
309 outputs_count = 8; /* Keeps present behaviour */ 316 outputs_count = 8; /* Keeps present behaviour */
310 unapply = unapply_nochoice; 317 unapply = unapply_nochoice;
311 318
312 assign (savebed_map, first_map_path); /* Init. respawn position */ 319 savebed_map = first_map_path; /* Init. respawn position */
313 320
314 gen_sp_armour = 10; 321 gen_sp_armour = 10;
315 last_speed = -1; 322 last_speed = -1;
316 shoottype = range_none; 323 shoottype = range_none;
317 bowtype = bow_normal; 324 bowtype = bow_normal;
929 if (*first_map_ext_path) 936 if (*first_map_ext_path)
930 { 937 {
931 object *tmp; 938 object *tmp;
932 char mapname[MAX_BUF]; 939 char mapname[MAX_BUF];
933 940
934 snprintf (mapname, MAX_BUF - 1, "%s/%s", first_map_ext_path, &op->arch->name); 941 snprintf (mapname, MAX_BUF - 1, "%s/%s", &first_map_ext_path, &op->arch->name);
935 tmp = object::create (); 942 tmp = object::create ();
936 EXIT_PATH (tmp) = mapname; 943 EXIT_PATH (tmp) = mapname;
937 EXIT_X (tmp) = op->x; 944 EXIT_X (tmp) = op->x;
938 EXIT_Y (tmp) = op->y; 945 EXIT_Y (tmp) = op->y;
939 op->enter_exit (tmp); /* we don't really care if it succeeded; 946 op->enter_exit (tmp); /* we don't really care if it succeeded;
940 * if the map isn't there, then stay on the 947 * if the map isn't there, then stay on the
941 * default initial map */ 948 * default initial map */
942 tmp->destroy (); 949 tmp->destroy ();
943 } 950 }
2345 2352
2346 /* call this here - we also will call this in do_ericserver, but 2353 /* call this here - we also will call this in do_ericserver, but
2347 * the players time has been increased when doericserver has been 2354 * the players time has been increased when doericserver has been
2348 * called, so we recheck it here. 2355 * called, so we recheck it here.
2349 */ 2356 */
2350 //TODO: better than handling 8 commands, use some more intelligent rate-limiting 2357 op->contr->ns->handle_command ();
2351 for (int rep = 8; --rep && op->contr->ns->handle_command (); )
2352 ;
2353 2358
2354 if (op->speed_left < 0) 2359 if (op->speed_left < 0)
2355 return 0; 2360 return 0;
2356 2361
2357 if (op->direction && (op->contr->run_on || op->contr->fire_on)) 2362 if (op->direction && (op->contr->run_on || op->contr->fire_on))
3464 if (trlist == NULL || who->type != PLAYER) 3469 if (trlist == NULL || who->type != PLAYER)
3465 return; 3470 return;
3466 3471
3467 for (i = 0, tr = trlist->items; tr != NULL && i < level - 1; tr = tr->next, i++); 3472 for (i = 0, tr = trlist->items; tr != NULL && i < level - 1; tr = tr->next, i++);
3468 3473
3469 if (tr == NULL || tr->item == NULL) 3474 if (!tr || !tr->item)
3470 { 3475 {
3471 /* LOG(llevDebug, "-> no more treasure for %s\n", change_resist_msg[atnr]); */ 3476 /* LOG(llevDebug, "-> no more treasure for %s\n", change_resist_msg[atnr]); */
3472 return; 3477 return;
3473 } 3478 }
3474 3479

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines