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.33 by root, Tue Dec 12 21:39:57 2006 UTC vs.
Revision 1.37 by root, Thu Dec 14 02:37:37 2006 UTC

320 * All we can really get in this is some settings like host and display 320 * All we can really get in this is some settings like host and display
321 * mode. 321 * mode.
322 */ 322 */
323 323
324int 324int
325add_player (NewSocket * ns) 325add_player (client_socket * ns)
326{ 326{
327 player *p; 327 player *p;
328 328
329 p = get_player (NULL); 329 p = get_player (NULL);
330 p->socket = *ns; 330 p->socket = *ns;
336 memcpy (p->socket.faces_sent, ns->faces_sent, p->socket.faces_sent_len * sizeof (*p->socket.faces_sent)); 336 memcpy (p->socket.faces_sent, ns->faces_sent, p->socket.faces_sent_len * sizeof (*p->socket.faces_sent));
337 /* Needed because the socket we just copied over needs to be cleared. 337 /* Needed because the socket we just copied over needs to be cleared.
338 * Note that this can result in a client reset if there is partial data 338 * Note that this can result in a client reset if there is partial data
339 * on the uncoming socket. 339 * on the uncoming socket.
340 */ 340 */
341 //TODO socket copying is EVIL, do not do this
341 p->socket.inbuf.len = 0; 342 p->socket.inbuf_len = 0;
342 set_first_map (p->ob); 343 set_first_map (p->ob);
343 344
344 CLEAR_FLAG (p->ob, FLAG_FRIENDLY); 345 CLEAR_FLAG (p->ob, FLAG_FRIENDLY);
345 add_friendly_object (p->ob); 346 add_friendly_object (p->ob);
346 send_rules (p->ob); 347 send_rules (p->ob);
1060 { 1061 {
1061 char buf[MAX_BUF]; 1062 char buf[MAX_BUF];
1062 1063
1063 /* this must before then initial items are given */ 1064 /* this must before then initial items are given */
1064 esrv_new_player (op->contr, op->weight + op->carrying); 1065 esrv_new_player (op->contr, op->weight + op->carrying);
1066
1065 create_treasure (find_treasurelist ("starting_wealth"), op, 0, 0, 0); 1067 treasurelist *tl = find_treasurelist ("starting_wealth");
1068 if (tl)
1069 create_treasure (tl, op, 0, 0, 0);
1066 1070
1067 INVOKE_PLAYER (BIRTH, op->contr); 1071 INVOKE_PLAYER (BIRTH, op->contr);
1068 INVOKE_PLAYER (LOGIN, op->contr); 1072 INVOKE_PLAYER (LOGIN, op->contr);
1069 1073
1070 op->contr->state = ST_PLAYING; 1074 op->contr->state = ST_PLAYING;
1882 if (arrow == NULL) 1886 if (arrow == NULL)
1883 { 1887 {
1884 new_draw_info_format (NDI_UNIQUE, 0, op, "You have no %s left.", &bow->race); 1888 new_draw_info_format (NDI_UNIQUE, 0, op, "You have no %s left.", &bow->race);
1885 return 0; 1889 return 0;
1886 } 1890 }
1887 set_owner (arrow, op); 1891 arrow->set_owner (op);
1888 arrow->skill = bow->skill; 1892 arrow->skill = bow->skill;
1889 1893
1890 arrow->direction = dir; 1894 arrow->direction = dir;
1891 arrow->x = sx; 1895 arrow->x = sx;
1892 arrow->y = sy; 1896 arrow->y = sy;
2359 * player owns it and it is either friendly or unagressive. 2363 * player owns it and it is either friendly or unagressive.
2360 */ 2364 */
2361 if ((op->type == PLAYER) 2365 if ((op->type == PLAYER)
2362#if COZY_SERVER 2366#if COZY_SERVER
2363 && 2367 &&
2364 ((get_owner (mon) && get_owner (mon)->contr 2368 ((mon->owner && mon->owner->contr
2365 && same_party (get_owner (mon)->contr->party, op->contr->party)) || get_owner (mon) == op) 2369 && same_party (mon->owner->contr->party, op->contr->party)) || mon->owner == op)
2366#else 2370#else
2367 && get_owner (mon) == op 2371 && mon->owner == op
2368#endif 2372#endif
2369 && (QUERY_FLAG (mon, FLAG_UNAGGRESSIVE) || QUERY_FLAG (mon, FLAG_FRIENDLY))) 2373 && (QUERY_FLAG (mon, FLAG_UNAGGRESSIVE) || QUERY_FLAG (mon, FLAG_FRIENDLY)))
2370 { 2374 {
2371 /* If we're braced, we don't want to switch places with it */ 2375 /* If we're braced, we don't want to switch places with it */
2372 if (op->contr->braced) 2376 if (op->contr->braced)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines