--- deliantra/server/server/skill_util.C 2007/05/03 10:39:46 1.38 +++ deliantra/server/server/skill_util.C 2007/05/09 11:32:31 1.39 @@ -117,24 +117,24 @@ object * find_skill_by_name (object *who, const char *name) { - object *skill = NULL, *skill_tool = NULL, *tmp; - if (!name) - return NULL; + return 0; + + object *skill = 0, *skill_tool = 0; /* We make sure the length of the string in the object is greater * in length than the passed string. Eg, if we have a skill called * 'hi', we don't want to match if the user passed 'high' */ - for (tmp = who->inv; tmp != NULL; tmp = tmp->below) + for (object *tmp = who->inv; tmp; tmp = tmp->below) { - if (tmp->type == SKILL && !strncasecmp (name, tmp->skill, strlen (name)) && (size_t) strlen (tmp->skill) >= strlen (name)) + if (tmp->type == SKILL && !strncasecmp (name, tmp->skill, strlen (name)) && strlen (tmp->skill) >= strlen (name)) skill = tmp; /* Try to find appropriate skilltool. If the player has one already * applied, we try to keep using that one. */ - else if (tmp->type == SKILL_TOOL && !strncasecmp (name, tmp->skill, strlen (name)) && (size_t) strlen (tmp->skill) >= strlen (name)) + else if (tmp->type == SKILL_TOOL && !strncasecmp (name, tmp->skill, strlen (name)) && strlen (tmp->skill) >= strlen (name)) { if (QUERY_FLAG (tmp, FLAG_APPLIED)) skill_tool = tmp; @@ -142,21 +142,20 @@ skill_tool = tmp; } } + /* If this is a skill that can be used without a tool, return it */ if (skill && QUERY_FLAG (skill, FLAG_CAN_USE_SKILL)) return skill; - /* Player has a tool to use the skill. IF not applied, apply it - - * if not successful, return null. If they do have the skill tool + /* Player has a tool to use the skill. If not applied, apply it - + * if not successful, return null. If they do have the skill tool * but not the skill itself, give it to them. */ if (skill_tool) { if (!QUERY_FLAG (skill_tool, FLAG_APPLIED)) - { - if (apply_special (who, skill_tool, 0)) - return NULL; - } + if (apply_special (who, skill_tool, 0)) + return 0; if (!skill) { @@ -167,7 +166,7 @@ return skill; } - return NULL; + return 0; }