--- deliantra/server/common/region.C 2008/12/31 17:35:37 1.40 +++ deliantra/server/common/region.C 2009/01/01 11:41:17 1.41 @@ -45,13 +45,13 @@ * used by the map parsing code. */ region * -region::find (const char *name) +region::find (shstr_cmp name) { for_all_regions (rgn) - if (!strcmp (rgn->name, name)) + if (rgn->name == name) return rgn; - LOG (llevError, "region called %s requested, but not found, using fallback.\n", name); + LOG (llevError, "region called %s requested, but not found, using fallback.\n", &name); return default_region (); } @@ -74,44 +74,36 @@ if (!name) return default_region (); + // TODO: bug, changes possibly const string char *p = strchr (name, '\n'); if (p) *p = '\0'; for_all_regions (rgn) - if (!strcasecmp (rgn->name, name)) + if (rgn->name.eq_nc (name)) return rgn; for_all_regions (rgn) - if (rgn->longname) - if (!strcasecmp (rgn->longname, name)) - return rgn; + if (rgn->longname.eq_nc (name)) + return rgn; for_all_regions (rgn) - if (rgn->longname) - { - if (strstr (rgn->longname, name)) - return rgn; - } + if (rgn->longname.contains (name)) + return rgn; for_all_regions (rgn) - if (rgn->longname) - { - /* - * This is not a bug, we want the region that is most identifiably a discrete - * area in the game, eg if we have 'scor', we want to return 'scorn' and not - * 'scornarena', regardless of their order on the list so we only look at those - * regions with a longname set. - */ - if (strstr (rgn->name, name)) - return rgn; - } + /* + * This is not a bug, we want the region that is most identifiably a discrete + * area in the game, eg if we have 'scor', we want to return 'scorn' and not + * 'scornarena', regardless of their order on the list so we only look at those + * regions with a longname set. + */ + if (rgn->longname && rgn->name.contains (name)) + return rgn; for_all_regions (rgn) - { - if (strstr (rgn->name, name)) - return rgn; - } + if (rgn->name.contains (name)) + return rgn; return default_region (); }