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.201 by root, Sun Aug 17 01:26:35 2008 UTC vs.
Revision 1.209 by root, Thu Dec 18 05:13:38 2008 UTC

219 /* make sure he's a player -- needed because of class change. */ 219 /* make sure he's a player -- needed because of class change. */
220 ob->type = PLAYER; // we are paranoid 220 ob->type = PLAYER; // we are paranoid
221 ob->race = ob->arch->race; 221 ob->race = ob->arch->race;
222 222
223 ob->update_weight (); 223 ob->update_weight ();
224 link_player_skills (ob); 224 link_skills ();
225 225
226 CLEAR_FLAG (ob, FLAG_NO_FIX_PLAYER); 226 CLEAR_FLAG (ob, FLAG_NO_FIX_PLAYER);
227 227
228 assign (title, ob->arch->object::name); 228 assign (title, ob->arch->object::name);
229 229
348 savebed_map = first_map_path; /* Init. respawn position */ 348 savebed_map = first_map_path; /* Init. respawn position */
349 349
350 gen_sp_armour = 10; 350 gen_sp_armour = 10;
351 bowtype = bow_normal; 351 bowtype = bow_normal;
352 petmode = pet_normal; 352 petmode = pet_normal;
353 listening = 10;
354 usekeys = containers; 353 usekeys = containers;
355 peaceful = 1; /* default peaceful */ 354 peaceful = 1; /* default peaceful */
356 do_los = 1; 355 do_los = 1;
357 356
358 weapon_sp = 1.0f; 357 weapon_sp = 1.0f;
729 else /* lock all 'normal items by default */ 728 else /* lock all 'normal items by default */
730 SET_FLAG (op, FLAG_INV_LOCKED); 729 SET_FLAG (op, FLAG_INV_LOCKED);
731 } /* for loop of objects in player inv */ 730 } /* for loop of objects in player inv */
732 731
733 /* Need to set up the skill pointers */ 732 /* Need to set up the skill pointers */
734 link_player_skills (pl); 733 pl->contr->link_skills ();
735} 734}
736 735
737void 736void
738get_party_password (object *op, partylist *party) 737get_party_password (object *op, partylist *party)
739{ 738{
871 ob->msg = 0; 870 ob->msg = 0;
872 871
873 start_info (ob); 872 start_info (ob);
874 CLEAR_FLAG (ob, FLAG_WIZ); 873 CLEAR_FLAG (ob, FLAG_WIZ);
875 give_initial_items (ob, ob->randomitems); 874 give_initial_items (ob, ob->randomitems);
876 link_player_skills (ob);
877 esrv_send_inventory (ob, ob); 875 esrv_send_inventory (ob, ob);
878 ob->update_stats (); 876 ob->update_stats ();
879 877
880 /* This moves the player to a different start map, if there 878 /* This moves the player to a different start map, if there
881 * is one for this race 879 * is one for this race
1580 } 1578 }
1581 1579
1582 /* this should not happen, but sometimes does */ 1580 /* this should not happen, but sometimes does */
1583 if (arrow->nrof == 0) 1581 if (arrow->nrof == 0)
1584 { 1582 {
1583 LOG (llevError | logBacktrace, "arrow (%s) has nrof 0\n", arrow->debug_desc ());
1585 arrow->destroy (); 1584 arrow->destroy ();
1586 return 0; 1585 return 0;
1587 } 1586 }
1588 1587
1589 left = arrow; /* these are arrows left to the player */ 1588 left = arrow; /* these are arrows left to the player */
1794bool 1793bool
1795fire (object *op, int dir) 1794fire (object *op, int dir)
1796{ 1795{
1797 int spellcost = 0; 1796 int spellcost = 0;
1798 1797
1799 /* check for loss of invisiblity/hide */
1800 if (action_makes_visible (op))
1801 make_visible (op);
1802
1803 player *pl = op->contr; 1798 player *pl = op->contr;
1804 1799
1805 if (pl->golem) 1800 if (pl->golem)
1806 { 1801 {
1807 control_golem (op->contr->golem, dir); 1802 control_golem (op->contr->golem, dir);
1809 } 1804 }
1810 1805
1811 object *ob = pl->ranged_ob; 1806 object *ob = pl->ranged_ob;
1812 1807
1813 if (!ob) 1808 if (!ob)
1814 return false;
1815
1816 if (!op->change_weapon (ob))
1817 return false; 1809 return false;
1818 1810
1819 if (op->speed_left > 0.f) 1811 if (op->speed_left > 0.f)
1820 --op->speed_left; 1812 --op->speed_left;
1821 else 1813 else
1822 return false; 1814 return false;
1815
1816 if (!op->change_weapon (ob))
1817 return false;
1818
1819 /* check for loss of invisiblity/hide */
1820 if (action_makes_visible (op))
1821 make_visible (op);
1823 1822
1824 switch (ob->type) 1823 switch (ob->type)
1825 { 1824 {
1826 case BOW: 1825 case BOW:
1827 player_fire_bow (op, dir); 1826 player_fire_bow (op, dir);
2072 --op->speed_left; 2071 --op->speed_left;
2073 2072
2074 op->play_sound (sound_find ("push_player")); 2073 op->play_sound (sound_find ("push_player"));
2075 push_ob (mon, dir, op); 2074 push_ob (mon, dir, op);
2076 2075
2077 if (op->contr->tmp_invis || op->hide) 2076 if (op->contr->tmp_invis || op->flag [FLAG_HIDDEN])
2078 make_visible (op); 2077 make_visible (op);
2079 2078
2080 return true; 2079 return true;
2081 } 2080 }
2082 else 2081 else
2104 push_ob (mon, dir, op); 2103 push_ob (mon, dir, op);
2105 } 2104 }
2106 else 2105 else
2107 op->statusmsg ("You withhold your attack"); 2106 op->statusmsg ("You withhold your attack");
2108 2107
2109 if (op->contr->tmp_invis || op->hide) 2108 if (op->contr->tmp_invis || op->flag [FLAG_HIDDEN])
2110 make_visible (op); 2109 make_visible (op);
2111 2110
2112 return true; 2111 return true;
2113 } 2112 }
2114 } 2113 }
2172 if (QUERY_FLAG (op, FLAG_CONFUSED) && dir) 2171 if (QUERY_FLAG (op, FLAG_CONFUSED) && dir)
2173 dir = absdir (dir + rndm (3) + rndm (3) - 2); 2172 dir = absdir (dir + rndm (3) + rndm (3) - 2);
2174 2173
2175 op->facing = dir; 2174 op->facing = dir;
2176 2175
2177 if (op->hide) 2176 if (op->flag [FLAG_HIDDEN])
2178 do_hidden_move (op); 2177 do_hidden_move (op);
2179 2178
2180 bool retval; 2179 bool retval;
2181 2180
2182 if (INVOKE_PLAYER (MOVE, op->contr, ARG_INT (dir))) 2181 if (INVOKE_PLAYER (MOVE, op->contr, ARG_INT (dir)))
2313const char * 2312const char *
2314gravestone_text (object *op) 2313gravestone_text (object *op)
2315{ 2314{
2316 static dynbuf_text buf; 2315 static dynbuf_text buf;
2317 2316
2318 buf << "---- R.I.P. ----\n\n"; 2317 buf << "---- R.I.P. ----\n\n"
2319 op->name; 2318 << op->name;
2320 2319
2321 if (op->type == PLAYER) 2320 if (op->type == PLAYER)
2322 buf << " the " << op->contr->title; 2321 buf << " the " << op->contr->title;
2323 2322
2324 buf << "\n\n"; 2323 buf << "\n\n";
2793 * exp loss on the stone. 2792 * exp loss on the stone.
2794 */ 2793 */
2795 tmp = arch_to_object (archetype::find ("gravestone")); 2794 tmp = arch_to_object (archetype::find ("gravestone"));
2796 tmp->name = format ("%s's gravestone", &op->name); 2795 tmp->name = format ("%s's gravestone", &op->name);
2797 tmp->name_pl = format ("%s's gravestones", &op->name); 2796 tmp->name_pl = format ("%s's gravestones", &op->name);
2798 tmp->msg = format ("RIP\nHere rests the hero %s the %s,\nwho was killed\nby %s.\n", &op->name, op->contr->title, op->contr->killer_name ()); 2797 tmp->msg = format ("T<RIP>\n\nHere rests the hero %s the %s,\rwho was killed\rby %s.\n",
2798 &op->name, op->contr->title, op->contr->killer_name ());
2799 tmp->x = op->x, tmp->y = op->y; 2799 tmp->x = op->x, tmp->y = op->y;
2800 insert_ob_in_map (tmp, op->map, NULL, 0); 2800 insert_ob_in_map (tmp, op->map, NULL, 0);
2801 2801
2802 /**************************************/ 2802 /**************************************/
2803 /* */ 2803 /* */
2891 if (will_kill_again & (1 << at)) 2891 if (will_kill_again & (1 << at))
2892 force->resist[at] = 100; 2892 force->resist[at] = 100;
2893 2893
2894 insert_ob_in_ob (force, op); 2894 insert_ob_in_ob (force, op);
2895 op->update_stats (); 2895 op->update_stats ();
2896
2897 } 2896 }
2898 2897
2899 new_draw_info (NDI_UNIQUE, 0, op, "YOU HAVE DIED."); 2898 new_draw_info (NDI_UNIQUE, 0, op, "YOU HAVE DIED.");
2900} 2899}
2901 2900
3002} 3001}
3003 3002
3004void 3003void
3005make_visible (object *op) 3004make_visible (object *op)
3006{ 3005{
3007 op->hide = 0; 3006 op->flag [FLAG_HIDDEN] = 0;
3008 op->invisible = 0; 3007 op->invisible = 0;
3009 3008
3010 if (op->type == PLAYER) 3009 if (op->type == PLAYER)
3011 { 3010 {
3012 op->contr->tmp_invis = 0; 3011 op->contr->tmp_invis = 0;
3233 3232
3234 if (op->contr && op->contr->tmp_invis == 0) 3233 if (op->contr && op->contr->tmp_invis == 0)
3235 return 0; 3234 return 0;
3236 3235
3237 /* If monsters, they should become visible */ 3236 /* If monsters, they should become visible */
3238 if (op->hide || !op->contr || (op->contr && op->contr->tmp_invis)) 3237 if (op->flag [FLAG_HIDDEN] || !op->contr || (op->contr && op->contr->tmp_invis))
3239 { 3238 {
3240 new_draw_info_format (NDI_UNIQUE, 0, op, "You become %s!", op->hide ? "unhidden" : "visible"); 3239 new_draw_info_format (NDI_UNIQUE, 0, op, "You become %s!", op->flag [FLAG_HIDDEN] ? "unhidden" : "visible");
3241 return 1; 3240 return 1;
3242 } 3241 }
3243 } 3242 }
3244 3243
3245 return 0; 3244 return 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines