forked from github/server
Benennung und Beschreibung eines Monumentes klappt jetzt, habe das erkennen von bereits benannten Gebäuden vereinheitlicht.
This commit is contained in:
parent
a1daf2f3b2
commit
130adacb43
|
@ -1495,6 +1495,20 @@ display_cmd(unit * u, struct order * ord)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static boolean
|
||||||
|
renamed_building(const building * b)
|
||||||
|
{
|
||||||
|
const struct locale * lang = locales;
|
||||||
|
for (;lang;lang=nextlocale(lang)) {
|
||||||
|
const char * bdname = LOC(lang, b->type->_name);
|
||||||
|
size_t bdlen = strlen(bdname);
|
||||||
|
if (strlen(b->name)>=bdlen && strncmp(b->name, bdname, bdlen)==0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
name_cmd(unit * u, struct order * ord)
|
name_cmd(unit * u, struct order * ord)
|
||||||
{
|
{
|
||||||
|
@ -1529,15 +1543,7 @@ name_cmd(unit * u, struct order * ord)
|
||||||
cmistake(u, ord, 278, MSG_EVENT);
|
cmistake(u, ord, 278, MSG_EVENT);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
const struct locale * lang = locales;
|
if (renamed_building(b)) {
|
||||||
for (;lang;lang=nextlocale(lang)) {
|
|
||||||
const char * bdname = LOC(lang, b->type->_name);
|
|
||||||
size_t bdlen = strlen(bdname);
|
|
||||||
if (strlen(b->name)>=bdlen && strncmp(b->name, bdname, bdlen)==0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (lang==NULL) {
|
|
||||||
cmistake(u, ord, 246, MSG_EVENT);
|
cmistake(u, ord, 246, MSG_EVENT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1568,8 +1574,7 @@ name_cmd(unit * u, struct order * ord)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (b->type == bt_find("monument")) {
|
if (b->type == bt_find("monument")) {
|
||||||
sprintf(buf, "Monument %d", b->no);
|
if (renamed_building(b)) {
|
||||||
if (strcmp(b->name, buf)!=0) {
|
|
||||||
cmistake(u, ord, 29, MSG_EVENT);
|
cmistake(u, ord, 29, MSG_EVENT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue