forked from github/server
- BENENNE FREMDE ohne das Flag
- Neue Schiffe kriegen ihren Typ statt nur Schiff in den Namen
This commit is contained in:
parent
88e61c08cf
commit
3b29df22e7
|
@ -1587,11 +1587,19 @@ name_cmd(unit * u, struct order * ord)
|
|||
if (b->type == bt_find("generic")) {
|
||||
cmistake(u, ord, 278, MSG_EVENT);
|
||||
break;
|
||||
}
|
||||
|
||||
if(!fval(b,FL_UNNAMED)) {
|
||||
cmistake(u, ord, 246, MSG_EVENT);
|
||||
break;
|
||||
} else {
|
||||
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) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (lang==NULL) {
|
||||
cmistake(u, ord, 246, MSG_EVENT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uo = buildingowner(r, b);
|
||||
|
@ -1629,7 +1637,6 @@ name_cmd(unit * u, struct order * ord)
|
|||
break;
|
||||
}
|
||||
s = &u->building->name;
|
||||
freset(u->building, FL_UNNAMED);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1645,10 +1652,19 @@ name_cmd(unit * u, struct order * ord)
|
|||
if (f->age < 10) {
|
||||
cmistake(u, ord, 248, MSG_EVENT);
|
||||
break;
|
||||
}
|
||||
if (!fval(f,FL_UNNAMED)) {
|
||||
cmistake(u, ord, 247, MSG_EVENT);
|
||||
break;
|
||||
} else {
|
||||
const struct locale * lang = locales;
|
||||
for (;lang;lang=nextlocale(lang)) {
|
||||
const char * fdname = LOC(lang, "factiondefault");
|
||||
size_t fdlen = strlen(fdname);
|
||||
if (strlen(f->name)>=fdlen && strncmp(f->name, fdname, fdlen)==0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (lang==NULL) {
|
||||
cmistake(u, ord, 247, MSG_EVENT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (cansee(f, r, u, 0)) {
|
||||
add_message(&f->msgs, new_message(f,
|
||||
|
@ -1660,7 +1676,6 @@ name_cmd(unit * u, struct order * ord)
|
|||
s = &f->name;
|
||||
} else {
|
||||
s = &u->faction->name;
|
||||
freset(u->faction, FL_UNNAMED);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1672,10 +1687,26 @@ name_cmd(unit * u, struct order * ord)
|
|||
if (!sh) {
|
||||
cmistake(u, ord, 20, MSG_EVENT);
|
||||
break;
|
||||
}
|
||||
if (!fval(sh,FL_UNNAMED)) {
|
||||
cmistake(u, ord, 245, MSG_EVENT);
|
||||
break;
|
||||
} else {
|
||||
const struct locale * lang = locales;
|
||||
for (;lang;lang=nextlocale(lang)) {
|
||||
const char * sdname = LOC(lang, sh->type->name[0]);
|
||||
size_t sdlen = strlen(sdname);
|
||||
if (strlen(sh->name)>=sdlen && strncmp(sh->name, sdname, sdlen)==0) {
|
||||
break;
|
||||
}
|
||||
|
||||
sdname = LOC(lang, parameters[P_SHIP]);
|
||||
sdlen = strlen(sdname);
|
||||
if (strlen(sh->name)>=sdlen && strncmp(sh->name, sdname, sdlen)==0) {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
if (lang==NULL) {
|
||||
cmistake(u, ord, 245, MSG_EVENT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
uo = shipowner(sh);
|
||||
if (uo) {
|
||||
|
@ -1698,20 +1729,24 @@ name_cmd(unit * u, struct order * ord)
|
|||
break;
|
||||
}
|
||||
s = &u->ship->name;
|
||||
freset(u->ship, FL_UNNAMED);
|
||||
}
|
||||
break;
|
||||
|
||||
case P_UNIT:
|
||||
if (foreign == true) {
|
||||
unit *u2 = getunit(r, u->faction);
|
||||
|
||||
if (!u2 || !cansee(u->faction, r, u2, 0)) {
|
||||
cmistake(u, ord, 63, MSG_EVENT);
|
||||
break;
|
||||
}
|
||||
if (!fval(u,FL_UNNAMED)) {
|
||||
cmistake(u, ord, 244, MSG_EVENT);
|
||||
break;
|
||||
} else {
|
||||
const char * udefault = LOC(u2->faction->locale, "unitdefault");
|
||||
size_t udlen = strlen(udefault);
|
||||
size_t unlen = strlen(u2->name);
|
||||
if (unlen>=udlen && strncmp(u2->name, udefault, udlen)!=0) {
|
||||
cmistake(u2, ord, 244, MSG_EVENT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (cansee(u2->faction, r, u, 0)) {
|
||||
add_message(&u2->faction->msgs, new_message(u2->faction,
|
||||
|
@ -1723,7 +1758,6 @@ name_cmd(unit * u, struct order * ord)
|
|||
s = &u2->name;
|
||||
} else {
|
||||
s = &u->name;
|
||||
freset(u, FL_UNNAMED);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -1005,7 +1005,7 @@ create_ship(region * r, unit * u, const struct ship_type * newtype, int want)
|
|||
if (want>0) want = min(want, msize);
|
||||
else want = msize;
|
||||
|
||||
sh = new_ship(newtype, r);
|
||||
sh = new_ship(newtype, u->faction->locale, r);
|
||||
|
||||
addlist(&r->ships, sh);
|
||||
|
||||
|
|
|
@ -451,7 +451,6 @@ new_building(const struct building_type * btype, region * r, const struct locale
|
|||
|
||||
b->type = btype;
|
||||
set_string(&b->display, "");
|
||||
fset(b, FL_UNNAMED);
|
||||
b->region = r;
|
||||
addlist(&r->buildings, b);
|
||||
|
||||
|
|
|
@ -879,7 +879,6 @@ typedef struct strlist {
|
|||
|
||||
#define FL_MARK (1<<23) /* für markierende algorithmen, die das hinterher auch wieder
|
||||
löschen müssen! (Ist dafür nicht eigentlich FL_DH gedacht?) */
|
||||
#define FL_UNNAMED (1<<26) /* Partei/Einheit/Gebäude/Schiff ist unbenannt */
|
||||
|
||||
#define fval(u, i) ((u)->flags & (i))
|
||||
#define fset(u, i) ((u)->flags |= (i))
|
||||
|
|
|
@ -123,7 +123,6 @@ addfaction(const char *email, const char * password,
|
|||
|
||||
sprintf(buf, "%s %s", LOC(loc, "factiondefault"), factionid(f));
|
||||
set_string(&f->name, buf);
|
||||
fset(f, FL_UNNAMED);
|
||||
|
||||
addlist(&factions, f);
|
||||
|
||||
|
|
|
@ -715,6 +715,5 @@ name_unit(unit *u)
|
|||
} else {
|
||||
sprintf(name, "%s %s", LOC(u->faction->locale, "unitdefault"), itoa36(u->no));
|
||||
set_string(&u->name, name);
|
||||
fset(u, FL_UNNAMED);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -274,7 +274,7 @@ give_starting_equipment(struct region *r, struct unit *u)
|
|||
break;
|
||||
case RC_AQUARIAN:
|
||||
{
|
||||
ship *sh = new_ship(st_find("boat"), r);
|
||||
ship *sh = new_ship(st_find("boat"), u->faction->locale, r);
|
||||
sh->size = sh->type->construction->maxsize;
|
||||
addlist(&r->ships, sh);
|
||||
u->ship = sh;
|
||||
|
|
|
@ -164,7 +164,7 @@ captain(ship *sh, region *r)
|
|||
|
||||
|
||||
ship *
|
||||
new_ship(const ship_type * stype, region * r)
|
||||
new_ship(const ship_type * stype, const struct locale * lang, region * r)
|
||||
{
|
||||
static char buffer[7 + IDSIZE + 1];
|
||||
ship *sh = (ship *) calloc(1, sizeof(ship));
|
||||
|
@ -174,10 +174,9 @@ new_ship(const ship_type * stype, region * r)
|
|||
sh->type = stype;
|
||||
sh->region = r;
|
||||
|
||||
sprintf(buffer, "Schiff %s", shipid(sh));
|
||||
sprintf(buffer, "%s %s", LOC(lang, stype->name[0]), shipid(sh));
|
||||
set_string(&sh->name, buffer);
|
||||
set_string(&sh->display, "");
|
||||
fset(sh, FL_UNNAMED);
|
||||
shash(sh);
|
||||
return sh;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ extern struct unit *shipowner(const struct ship * sh);
|
|||
extern int shipcapacity(const struct ship * sh);
|
||||
extern void getshipweight(const struct ship * sh, int *weight, int *cabins);
|
||||
|
||||
extern ship *new_ship(const struct ship_type * stype, struct region * r);
|
||||
extern ship *new_ship(const struct ship_type * stype, const struct locale * lang, struct region * r);
|
||||
extern const char *shipname(const struct ship * sh);
|
||||
extern struct ship *findship(int n);
|
||||
extern struct ship *findshipr(const struct region *r, int n);
|
||||
|
|
|
@ -55,7 +55,7 @@ au
|
|||
#define UFL_WERE (1<<28)
|
||||
|
||||
/* Flags, die gespeichert werden sollen: */
|
||||
#define UFL_SAVEMASK (UFL_NOAID | UFL_OWNER | UFL_PARTEITARNUNG | UFL_LOCKED | UFL_HUNGER | FFL_NOIDLEOUT | UFL_TAKEALL | FL_UNNAMED)
|
||||
#define UFL_SAVEMASK (UFL_NOAID | UFL_OWNER | UFL_PARTEITARNUNG | UFL_LOCKED | UFL_HUNGER | FFL_NOIDLEOUT | UFL_TAKEALL)
|
||||
|
||||
typedef struct unit {
|
||||
struct unit *next; /* needs to be first entry, for region's unitlist */
|
||||
|
|
|
@ -79,7 +79,7 @@ xe_giveballon(unit *u, struct order *ord)
|
|||
return;
|
||||
}
|
||||
|
||||
sh = new_ship(st_find("balloon"),u2->region);
|
||||
sh = new_ship(st_find("balloon"), u2->faction->locale, u2->region);
|
||||
sh->size = 5;
|
||||
set_string(&sh->name,"Xontormia-Ballon");
|
||||
addlist(&u2->region->ships, sh);
|
||||
|
|
|
@ -310,28 +310,6 @@ show_newspells(void)
|
|||
}
|
||||
}
|
||||
|
||||
static int
|
||||
fix_foreign(void)
|
||||
{
|
||||
region * r;
|
||||
for (r=regions;r;r=r->next) {
|
||||
struct locale * lang;
|
||||
for (lang=locales;lang;lang=nextlocale(lang)) {
|
||||
const char * udefault = LOC(lang, "unitdefault");
|
||||
size_t udlen = strlen(udefault);
|
||||
unit * u;
|
||||
for (u=r->units;u;u=u->next) {
|
||||
size_t unlen = strlen(u->name);
|
||||
if (unlen<udlen) continue;
|
||||
if (strncmp(u->name, udefault, udlen)==0) {
|
||||
fset(u, FL_UNNAMED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern plane * arena;
|
||||
|
||||
static void
|
||||
|
@ -833,7 +811,6 @@ update_gmquests(void)
|
|||
}
|
||||
do_once("et02", secondfaction(f));
|
||||
}
|
||||
do_once("renm", fix_foreign());
|
||||
}
|
||||
|
||||
#define TEST_LOCALES 0
|
||||
|
|
|
@ -65,7 +65,6 @@ SpecialFunctionUnit(unit *u)
|
|||
set_string(&sh->name, "Ballon");
|
||||
set_string(&sh->display, "Eine große leuchtendrote Werbeaufschrift "
|
||||
"für den Xontormia Express prangt auf einer Seite des Luftgefährts.");
|
||||
freset(sh, FL_UNNAMED);
|
||||
sh->size = 5;
|
||||
leave(u->region, u);
|
||||
u->ship = sh;
|
||||
|
|
|
@ -3176,7 +3176,7 @@
|
|||
<arg name="region" type="region"/>
|
||||
<arg name="command" type="order"/>
|
||||
</type>
|
||||
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Schwimmer können keine Schiffe betreten."</text>
|
||||
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Dieser Typ Einheit kann keine Schiffe betreten."</text>
|
||||
<text locale="fr">"$unit($unit) in $region($region): '$order($command)' - Swimmers cannot enter ships."</text>
|
||||
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - Swimmers cannot enter ships."</text>
|
||||
</message>
|
||||
|
@ -3186,9 +3186,9 @@
|
|||
<arg name="region" type="region"/>
|
||||
<arg name="command" type="order"/>
|
||||
</type>
|
||||
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Schwimmer können keine Gebäude betreten."</text>
|
||||
<text locale="fr">"$unit($unit) in $region($region): '$order($command)' - Swimmers cannot enter a building."</text>
|
||||
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - Swimmers cannot enter a building."</text>
|
||||
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Dieser Typ Einheit kann keine Gebäude betreten."</text>
|
||||
<text locale="fr">"$unit($unit) in $region($region): '$order($command)' - this type of unit cannot enter a building."</text>
|
||||
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - this type of unit cannot enter a building."</text>
|
||||
</message>
|
||||
<message name="error231" section="errors">
|
||||
<type>
|
||||
|
|
Loading…
Reference in New Issue