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.152 by root, Sun Jul 1 05:00:20 2007 UTC vs.
Revision 1.155 by root, Sat Jul 21 15:04:36 2007 UTC

226 /* if it's a dragon player, set the correct title here */ 226 /* if it's a dragon player, set the correct title here */
227 if (is_dragon_pl (ob)) 227 if (is_dragon_pl (ob))
228 { 228 {
229 object *tmp, *abil = 0, *skin = 0; 229 object *tmp, *abil = 0, *skin = 0;
230 230
231 shstr_cmp dragon_ability_force ("dragon_ability_force");
232 shstr_cmp dragon_skin_force ("dragon_skin_force");
233
234 for (tmp = ob->inv; tmp; tmp = tmp->below) 231 for (tmp = ob->inv; tmp; tmp = tmp->below)
235 if (tmp->type == FORCE) 232 if (tmp->type == FORCE)
236 if (tmp->arch->archname == dragon_ability_force) 233 if (tmp->arch->archname == shstr_dragon_ability_force)
237 abil = tmp; 234 abil = tmp;
238 else if (tmp->arch->archname == dragon_skin_force) 235 else if (tmp->arch->archname == shstr_dragon_skin_force)
239 skin = tmp; 236 skin = tmp;
240 237
241 set_dragon_name (ob, abil, skin); 238 set_dragon_name (ob, abil, skin);
242 } 239 }
243 240
300 ns->pl = 0; 297 ns->pl = 0;
301 ns = 0; 298 ns = 0;
302 } 299 }
303 300
304 if (ob) 301 if (ob)
302 {
305 ob->close_container (); //TODO: client-specific 303 ob->close_container (); //TODO: client-specific
304 ob->drop_unpaid_items ();
305 }
306 306
307 observe = ob; 307 observe = ob;
308 308
309 deactivate (); 309 deactivate ();
310} 310}
2316/* This goes throws the inventory and removes unpaid objects, and puts them 2316/* This goes throws the inventory and removes unpaid objects, and puts them
2317 * back in the map (location and map determined by values of env). This 2317 * back in the map (location and map determined by values of env). This
2318 * function will descend into containers. op is the object to start the search 2318 * function will descend into containers. op is the object to start the search
2319 * from. 2319 * from.
2320 */ 2320 */
2321void 2321static void
2322remove_unpaid_objects (object *op, object *env) 2322drop_unpaid_items (object *op, object *env)
2323{ 2323{
2324 while (op) 2324 while (op)
2325 { 2325 {
2326 object *next = op->below; /* Make sure we have a good value, in case we remove object 'op' */ 2326 object *next = op->below; /* Make sure we have a good value, in case we remove object 'op' */
2327 2327
2331 esrv_del_item (env->contr, op->count); 2331 esrv_del_item (env->contr, op->count);
2332 2332
2333 op->insert_at (env); 2333 op->insert_at (env);
2334 } 2334 }
2335 else if (op->inv) 2335 else if (op->inv)
2336 remove_unpaid_objects (op->inv, env); 2336 drop_unpaid_items (op->inv, env);
2337 2337
2338 op = next; 2338 op = next;
2339 } 2339 }
2340}
2341
2342void
2343object::drop_unpaid_items ()
2344{
2345 if (!flag [FLAG_REMOVED])
2346 ::drop_unpaid_items (inv, this);
2340} 2347}
2341 2348
2342/* 2349/*
2343 * Returns pointer a static string containing gravestone text 2350 * Returns pointer a static string containing gravestone text
2344 * Moved from apply.c to player.c - player.c is what 2351 * Moved from apply.c to player.c - player.c is what
2550 } 2557 }
2551 2558
2552 /* Digestion */ 2559 /* Digestion */
2553 if (--op->last_eat < 0) 2560 if (--op->last_eat < 0)
2554 { 2561 {
2555 int bonus = op->contr->digestion > 0 ? op->contr->digestion : 0, penalty = op->contr->digestion < 0 ? -op->contr->digestion : 0; 2562 int bonus = max (0, op->contr->digestion),
2563 penalty = max (0, -op->contr->digestion);
2556 2564
2557 if (op->contr->gen_hp > 0)
2558 op->last_eat = 25 * (1 + bonus) / (op->contr->gen_hp + penalty + 1); 2565 op->last_eat = 25 * (1 + bonus) / (max (0, op->contr->gen_hp) + penalty + 1);
2559 else
2560 op->last_eat = 25 * (1 + bonus) / (penalty + 1);
2561 2566
2562 /* dms do not consume food */ 2567 /* dms do not consume food */
2563 if (!QUERY_FLAG (op, FLAG_WIZ)) 2568 if (!QUERY_FLAG (op, FLAG_WIZ))
2564 op->stats.food--; 2569 op->stats.food--;
2565 } 2570 }
2625 archetype *at; 2630 archetype *at;
2626 object *tmp; 2631 object *tmp;
2627 2632
2628 if (save_life (op)) 2633 if (save_life (op))
2629 return; 2634 return;
2630
2631 2635
2632 /* If player dies on BATTLEGROUND, no stat/exp loss! For Combat-Arenas 2636 /* If player dies on BATTLEGROUND, no stat/exp loss! For Combat-Arenas
2633 * in cities ONLY!!! It is very important that this doesn't get abused. 2637 * in cities ONLY!!! It is very important that this doesn't get abused.
2634 * Look at op_on_battleground() for more info --AndreasV 2638 * Look at op_on_battleground() for more info --AndreasV
2635 */ 2639 */
2875 2879
2876 /* 2880 /*
2877 * Check to see if the player has any unpaid items. If so, remove them 2881 * Check to see if the player has any unpaid items. If so, remove them
2878 * and put them back in the map. 2882 * and put them back in the map.
2879 */ 2883 */
2880 remove_unpaid_objects (op->inv, op); 2884 op->drop_unpaid_items ();
2881 2885
2882 /****************************************/ 2886 /****************************************/
2883 /* */ 2887 /* */
2884 /* Move player to his current respawn- */ 2888 /* Move player to his current respawn- */
2885 /* position (usually last savebed) */ 2889 /* position (usually last savebed) */
3422 { 3426 {
3423 /* forces in the treasurelist can alter the player's stats */ 3427 /* forces in the treasurelist can alter the player's stats */
3424 object *skin; 3428 object *skin;
3425 3429
3426 /* first get the dragon skin force */ 3430 /* first get the dragon skin force */
3427 shstr_cmp dragon_skin_force ("dragon_skin_force");
3428 for (skin = who->inv; skin && !(skin->arch->archname == dragon_skin_force); skin = skin->below) 3431 for (skin = who->inv; skin && !(skin->arch->archname == shstr_dragon_skin_force); skin = skin->below)
3429 ; 3432 ;
3430 3433
3431 if (!skin) 3434 if (!skin)
3432 return; 3435 return;
3433 3436

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines