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.261 by root, Sat Apr 3 02:46:19 2010 UTC vs.
Revision 1.268 by root, Wed Apr 7 19:54:45 2010 UTC

76 ob->remove (); 76 ob->remove ();
77 ob->enemy = 0; // sometimes keeps an extra refcount on itself 77 ob->enemy = 0; // sometimes keeps an extra refcount on itself
78 ob->map = 0; 78 ob->map = 0;
79 party = 0; 79 party = 0;
80 80
81 combat_ob = ranged_ob = 0; //TODO, should be special marker, non-refcounted, not this
82
83 players.erase (this); 81 players.erase (this);
84} 82}
85 83
86// connect the player with a specific client 84// connect the player with a specific client
87// also changes, rationalises, and fixes some incorrect settings 85// also changes, rationalises, and fixes some incorrect settings
139 ob->flag [FLAG_READY_WEAPON] = false; 137 ob->flag [FLAG_READY_WEAPON] = false;
140 ob->flag [FLAG_READY_SKILL] = false; 138 ob->flag [FLAG_READY_SKILL] = false;
141 ob->flag [FLAG_READY_RANGE] = false; 139 ob->flag [FLAG_READY_RANGE] = false;
142 ob->flag [FLAG_READY_BOW] = false; 140 ob->flag [FLAG_READY_BOW] = false;
143 141
144 for (object *op = ob->inv; op; op = op->below)
145 if (op->flag [FLAG_APPLIED])
146 switch (op->type)
147 {
148 case SKILL:
149 op->flag [FLAG_APPLIED] = false;
150 break;
151
152 case SPELL:
153 case WAND:
154 case ROD:
155 case HORN:
156 case BOW:
157 case RANGED:
158 ranged_ob = op;
159 op->flag [FLAG_APPLIED] = false;
160 break;
161
162 case WEAPON:
163 combat_ob = op;
164 op->flag [FLAG_APPLIED] = false;
165 break;
166 }
167
168 ob->update_stats (); // we unapplied stuff above 142 ob->update_stats (); // we unapplied stuff above
169
170 ob->current_weapon = 0;
171 if (object *item = combat_ob ? combat_ob : ranged_ob)
172 ob->apply (item);
173
174 activate (); 143 activate ();
175 144
176 INVOKE_PLAYER (CONNECT, this); 145 INVOKE_PLAYER (CONNECT, this);
177 INVOKE_PLAYER (LOGIN, this); 146 INVOKE_PLAYER (LOGIN, this);
178} 147}
265 disconnect (); 234 disconnect ();
266 235
267 attachable::do_destroy (); 236 attachable::do_destroy ();
268 237
269 if (ob) 238 if (ob)
270 {
271 ob->destroy_inv (false);
272 ob->destroy (); 239 ob->destroy ();
273 }
274 240
275 ob = observe = viewpoint = 0; 241 ob = observe = viewpoint = 0;
276} 242}
277 243
278player::~player () 244player::~player ()
1654} 1620}
1655 1621
1656/* Received a fire command for the player - go and do it. 1622/* Received a fire command for the player - go and do it.
1657 */ 1623 */
1658bool 1624bool
1659fire (object *op, int dir) 1625fire (object *who, int dir)
1660{ 1626{
1661 int spellcost = 0; 1627 int spellcost = 0;
1662 1628
1663 player *pl = op->contr; 1629 player *pl = who->contr;
1664 1630
1665 if (pl->golem) 1631 if (pl->golem)
1666 { 1632 {
1667 control_golem (op->contr->golem, dir); 1633 control_golem (who->contr->golem, dir);
1668 return false; 1634 return false;
1669 } 1635 }
1670 1636
1671 object *ob = pl->ranged_ob; 1637 object *ob = pl->ranged_ob;
1672 1638
1673 if (!ob) 1639 if (!ob)
1674 return false; 1640 return false;
1675 1641
1676 if (op->speed_left > 0.f) 1642 if (who->speed_left > 0.f)
1677 --op->speed_left; 1643 --who->speed_left;
1678 else 1644 else
1679 return false; 1645 return false;
1680 1646
1681 if (!op->apply (ob)) 1647 if (!who->apply (ob))
1682 return false; 1648 return false;
1683 1649
1684 /* check for loss of invisiblity/hide */ 1650 /* check for loss of invisiblity/hide */
1685 if (action_makes_visible (op)) 1651 if (action_makes_visible (who))
1686 make_visible (op); 1652 make_visible (who);
1687 1653
1688 switch (ob->type) 1654 switch (ob->type)
1689 { 1655 {
1690 case BOW: 1656 case BOW:
1691 player_fire_bow (op, dir); 1657 player_fire_bow (who, dir);
1692 break; 1658 break;
1693 1659
1694 case SPELL: 1660 case SPELL:
1695 spellcost = cast_spell (op, op, dir, ob, *pl->spellparam ? pl->spellparam : 0); 1661 spellcost = cast_spell (who, who, dir, ob, *pl->spellparam ? pl->spellparam : 0);
1696 break; 1662 break;
1697 1663
1698 case BUILDER: 1664 case BUILDER:
1699 apply_map_builder (op, dir); 1665 apply_map_builder (who, dir);
1700 break; 1666 break;
1701 1667
1702 case SKILL: 1668 case SKILL:
1703 do_skill (op, op, ob, dir, 0); 1669 do_skill (who, who, ob, dir, 0);
1704 break; 1670 break;
1705 1671
1672 case RANGED:
1673 do_skill (who, ob, who->chosen_skill, dir, 0);
1674 break;
1675
1706 default: 1676 default:
1707 fire_misc_object (op, dir); 1677 fire_misc_object (who, dir);
1708 break; 1678 break;
1709 } 1679 }
1710 1680
1711 return true; 1681 return true;
1712} 1682}
3205 else 3175 else
3206 j = 1; 3176 j = 1;
3207 strcat (buf, spellpathnames[i]); 3177 strcat (buf, spellpathnames[i]);
3208 } 3178 }
3209 } 3179 }
3180
3210 strcat (buf, "."); 3181 strcat (buf, ".");
3211 new_draw_info (NDI_UNIQUE | NDI_BLUE, 0, who, buf); 3182 new_draw_info (NDI_UNIQUE | NDI_BLUE, 0, who, buf);
3212 } 3183 }
3213 3184
3214 /* evtl. adding flags: */ 3185 /* evtl. adding flags: */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines