ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/skill_util.C
(Generate patch)

Comparing deliantra/server/server/skill_util.C (file contents):
Revision 1.75 by elmex, Sun Jan 4 20:23:07 2009 UTC vs.
Revision 1.79 by root, Sat Nov 7 18:30:06 2009 UTC

3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * it under the terms of the GNU General Public License as published by 9 * the terms of the Affero GNU General Public License as published by the
10 * the Free Software Foundation, either version 3 of the License, or 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * (at your option) any later version. 11 * option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the Affero GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>.
20 * 21 *
21 * The authors can be reached via e-mail to <support@deliantra.net> 22 * The authors can be reached via e-mail to <support@deliantra.net>
22 */ 23 */
23 24
24/* Created July 95 to separate skill utilities from actual skills -b.t. */ 25/* Created July 95 to separate skill utilities from actual skills -b.t. */
715 * it so it doesn't crash the server - otherwise, one character may 716 * it so it doesn't crash the server - otherwise, one character may
716 * crash the server numerous times. 717 * crash the server numerous times.
717 */ 718 */
718 if (num_skills_found >= NUM_SKILLS) 719 if (num_skills_found >= NUM_SKILLS)
719 { 720 {
720 new_draw_info (NDI_RED, 0, op, "Your character has too many skills."); 721 new_draw_info (NDI_RED | NDI_REPLY, 0, op, "Your character has too many skills.");
721 new_draw_info (NDI_RED, 0, op, "Something isn't right - contact the server admin"); 722 new_draw_info (NDI_RED | NDI_REPLY, 0, op, "Something isn't right - contact the server admin");
722 break; 723 break;
723 } 724 }
724 } 725 }
725 } 726 }
726 727
727 dynbuf_text msg (4096, 1024); 728 dynbuf_text &msg = msg_dynbuf; msg.clear ();
728 729
729 msg << "T<Player skills:>\n\n"; 730 msg << "T<Player skills:>\n\n";
730 if (num_skills_found > 1) 731 if (num_skills_found > 1)
731 qsort (skills, num_skills_found, sizeof (skills [0]), (int (*)(const void *, const void *)) std::strcmp); 732 qsort (skills, num_skills_found, sizeof (skills [0]), (int (*)(const void *, const void *)) std::strcmp);
732 733
762 763
763 for (skop = op->inv; skop; skop = skop->below) 764 for (skop = op->inv; skop; skop = skop->below)
764 { 765 {
765 if (skop->type == SKILL 766 if (skop->type == SKILL
766 && QUERY_FLAG (skop, FLAG_CAN_USE_SKILL) 767 && QUERY_FLAG (skop, FLAG_CAN_USE_SKILL)
767 && !strncasecmp (string, skop->skill, MIN (strlen (string), (size_t) strlen (skop->skill)))) 768 && !strncasecmp (string, skop->skill, min (strlen (string), (size_t) strlen (skop->skill))))
768 break; 769 break;
769 else if (skop->type == SKILL_TOOL 770 else if (skop->type == SKILL_TOOL
770 && !strncasecmp (string, skop->skill, MIN (strlen (string), (size_t) strlen (skop->skill)))) 771 && !strncasecmp (string, skop->skill, min (strlen (string), (size_t) strlen (skop->skill))))
771 break; 772 break;
772 } 773 }
773 774
774 if (!skop) 775 if (!skop)
775 { 776 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines