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.103 by root, Sat Feb 10 01:52:29 2007 UTC vs.
Revision 1.106 by pippijn, Fri Mar 2 10:15:40 2007 UTC

116 116
117 news[0] = '\0'; 117 news[0] = '\0';
118 subject[0] = '\0'; 118 subject[0] = '\0';
119 size = 0; 119 size = 0;
120 120
121 while (fgets (buf, MAX_BUF, fp) != NULL) 121 while (fgets (buf, MAX_BUF, fp))
122 { 122 {
123 if (*buf == '#') 123 if (*buf == '#')
124 continue; 124 continue;
125 125
126 if (*buf == '%') 126 if (*buf == '%')
197 remove_friendly_object (ob); 197 remove_friendly_object (ob);
198 ob->deactivate_recursive (); 198 ob->deactivate_recursive ();
199 maplevel = ob->map->path; 199 maplevel = ob->map->path;
200 ob->remove (); 200 ob->remove ();
201 ob->map = 0; 201 ob->map = 0;
202 party = 0;
202 203
203 // for weird reasons, this is often "ob", keeping a circular reference 204 // for weird reasons, this is often "ob", keeping a circular reference
204 ranges [range_skill] = 0; 205 ranges [range_skill] = 0;
205 206
206 players.erase (this); 207 players.erase (this);
236 link_player_skills (ob); 237 link_player_skills (ob);
237 238
238 CLEAR_FLAG (ob, FLAG_NO_FIX_PLAYER); 239 CLEAR_FLAG (ob, FLAG_NO_FIX_PLAYER);
239 240
240 assign (title, ob->arch->clone.name); 241 assign (title, ob->arch->clone.name);
241
242 /* can_use_shield is a new flag. However, the can_use.. seems to largely come
243 * from the class, and not race. I don't see any way to get the class information
244 * to then update this. I don't think this will actually break anything - anyone
245 * that can use armour should be able to use a shield. What this may 'break'
246 * are features new characters get, eg, if someone starts up with a Q, they
247 * should be able to use a shield. However, old Q's won't get that advantage.
248 */
249 if (QUERY_FLAG (ob, FLAG_USE_ARMOUR))
250 SET_FLAG (ob, FLAG_USE_SHIELD);
251 242
252 /* if it's a dragon player, set the correct title here */ 243 /* if it's a dragon player, set the correct title here */
253 if (is_dragon_pl (ob)) 244 if (is_dragon_pl (ob))
254 { 245 {
255 object *tmp, *abil = 0, *skin = 0; 246 object *tmp, *abil = 0, *skin = 0;
300 ns->reset_stats (); 291 ns->reset_stats ();
301 ns->pl = 0; 292 ns->pl = 0;
302 this->ns = 0; 293 this->ns = 0;
303 } 294 }
304 295
296 if (ob)
305 ob->close_container (); //TODO: client-specific 297 ob->close_container (); //TODO: client-specific
298
306 deactivate (); 299 deactivate ();
307} 300}
308 301
309// the need for this function can be explained 302// the need for this function can be explained
310// by load_object not returning the object 303// by load_object not returning the object
311void 304void
312player::set_object (object *op) 305player::set_object (object *op)
313{ 306{
314 ob = op; 307 ob = op;
315 ob->contr = this; /* this aren't yet in archetype */ 308 ob->contr = this; /* this aren't yet in archetype */
316 309
317 ob->speed_left = 0.5; 310 ob->speed_left = 0.5;
318 ob->speed = 1.0; 311 ob->speed = 1.0;
319 ob->direction = 5; /* So player faces south */ 312 ob->direction = 5; /* So player faces south */
320 ob->stats.wc = 2;
321 ob->run_away = 25; /* Then we panick... */
322
323 ob->roll_stats ();
324} 313}
325 314
326player::player () 315player::player ()
327{ 316{
328 /* There are some elements we want initialised to non zero value - 317 /* There are some elements we want initialised to non zero value -
372player::create () 361player::create ()
373{ 362{
374 player *pl = new player; 363 player *pl = new player;
375 364
376 pl->set_object (arch_to_object (get_player_archetype (0))); 365 pl->set_object (arch_to_object (get_player_archetype (0)));
366
367 pl->ob->roll_stats ();
368 pl->ob->stats.wc = 2;
369 pl->ob->run_away = 25; /* Then we panick... */
370
377 set_first_map (pl->ob); 371 set_first_map (pl->ob);
378 372
379 return pl; 373 return pl;
380} 374}
381 375
1036int 1030int
1037check_pick (object *op) 1031check_pick (object *op)
1038{ 1032{
1039 object *tmp, *next; 1033 object *tmp, *next;
1040 int stop = 0; 1034 int stop = 0;
1041 int j, k, wvratio; 1035 int wvratio;
1042 char putstring[128], tmpstr[16]; 1036 char putstring[128];
1043 1037
1044 /* if you're flying, you cna't pick up anything */ 1038 /* if you're flying, you cna't pick up anything */
1045 if (op->move_type & MOVE_FLYING) 1039 if (op->move_type & MOVE_FLYING)
1046 return 1; 1040 return 1;
1047 1041
3083} 3077}
3084 3078
3085int 3079int
3086is_true_undead (object *op) 3080is_true_undead (object *op)
3087{ 3081{
3088 object *tmp = NULL;
3089
3090 if (QUERY_FLAG (&op->arch->clone, FLAG_UNDEAD)) 3082 if (QUERY_FLAG (&op->arch->clone, FLAG_UNDEAD))
3091 return 1; 3083 return 1;
3092 3084
3093 return 0; 3085 return 0;
3094} 3086}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines