Unicode WIP:

- building name changes
- locale optimization
- fixing some error messages
This commit is contained in:
Enno Rehling 2007-08-13 07:29:39 +00:00
parent 77bb331bc5
commit 67184b0c96
12 changed files with 40 additions and 76 deletions

View file

@ -1543,6 +1543,7 @@ creport_init(void)
tsf_register("direction", &cr_int);
tsf_register("alliance", &cr_alliance);
tsf_register("resources", &cr_resources);
tsf_register("items", &cr_resources);
tsf_register("regions", &cr_regions);
register_reporttype("cr", &report_computer, 1<<O_COMPUTER);

View file

@ -1343,16 +1343,8 @@ display_cmd(unit * u, struct order * ord)
cmistake(u, ord, 5, MSG_PRODUCE);
break;
}
if (b->type == bt_find("generic")) {
cmistake(u, ord, 279, MSG_PRODUCE);
break;
}
if (b->type == bt_find("monument") && b->display && b->display[0] != 0) {
cmistake(u, ord, 29, MSG_PRODUCE);
break;
}
if (b->type == bt_find("artsculpture") && b->display && b->display[0] != 0) {
cmistake(u, ord, 29, MSG_PRODUCE);
if (!fval(b->type, BTF_NAMECHANGE) && b->display && b->display[0] != 0) {
cmistake(u, ord, 278, MSG_EVENT);
break;
}
s = &b->display;
@ -1485,7 +1477,6 @@ name_cmd(unit * u, struct order * ord)
}
s = &b->name;
} else {
// TODO: building types static speichern um lookups zu sparen
if (!b) {
cmistake(u, ord, 145, MSG_PRODUCE);
break;
@ -1494,20 +1485,10 @@ name_cmd(unit * u, struct order * ord)
cmistake(u, ord, 148, MSG_PRODUCE);
break;
}
if (b->type == bt_find("genericbuilding")) {
if (!fval(b->type, BTF_NAMECHANGE)) {
cmistake(u, ord, 278, MSG_EVENT);
break;
}
if (b->type == bt_find("monument")) {
if (renamed_building(b)) {
cmistake(u, ord, 29, MSG_EVENT);
break;
}
}
if (b->type == bt_find("artsculpture")) {
cmistake(u, ord, 29, MSG_EVENT);
break;
}
s = &b->name;
}
break;

View file

@ -131,7 +131,6 @@ bt_find(const char* name)
}
while (btl && strcmp(btl->type->_name, name)) btl = btl->next;
if (btl==NULL) {
log_error(("could not locate building type '%s'.\n", name));
return NULL;
}
return btl->type;

View file

@ -40,6 +40,7 @@ typedef struct maintenance {
#define BTF_PROTECTION 0x20 /* protection in combat */
#define BTF_MAGIC 0x40 /* magical effect */
#define BTF_ONEPERTURN 0x80 /* one one sizepoint can be added per turn */
#define BTF_NAMECHANGE 0x100 /* name and description can be changed more than once */
typedef struct building_type {
const char * _name;

View file

@ -1542,10 +1542,7 @@ ship_ready(const region * r, unit * u)
return false;
}
if (!cansail(r, u->ship)) {
if( is_cursed(u->ship->attribs, C_SHIP_FLYING, 0) )
cmistake(u, u->thisorder, 17, MSG_MOVE);
else
cmistake(u, u->thisorder, 18, MSG_MOVE);
cmistake(u, u->thisorder, 18, MSG_MOVE);
return false;
}
return true;

View file

@ -262,6 +262,7 @@ parse_buildings(xmlDocPtr doc)
if (xml_bvalue(node, "nodestroy", false)) btype->flags |= BTF_INDESTRUCTIBLE;
if (xml_bvalue(node, "oneperturn", false)) btype->flags |= BTF_ONEPERTURN;
if (xml_bvalue(node, "nobuild", false)) btype->flags |= BTF_NOBUILD;
if (xml_bvalue(node, "namechange", true)) btype->flags |= BTF_NAMECHANGE;
if (xml_bvalue(node, "unique", false)) btype->flags |= BTF_UNIQUE;
if (xml_bvalue(node, "decay", false)) btype->flags |= BTF_DECAY;
if (xml_bvalue(node, "magic", false)) btype->flags |= BTF_MAGIC;

View file

@ -40,7 +40,7 @@ killunit_handle(trigger * t, void * data)
if (u!=NULL) {
destroy_unit(u);
} else {
log_error(("could not perform killunit::handle()\n"));
log_warning(("could not perform killunit::handle()\n"));
}
unused(data);
return 0;

View file

@ -52,17 +52,17 @@ make_locale(const char * name)
{
unsigned int hkey = hashstring(name);
locale * l = (locale *)calloc(sizeof(locale), 1);
#ifndef NDEBUG
locale * lp = locales;
while (lp && lp->hashkey!=hkey) lp=lp->next;
assert(lp == NULL);
#endif
locale ** lp = &locales;
while (*lp && (*lp)->hashkey!=hkey) lp=&(*lp)->next;
assert(*lp == NULL);
l->hashkey = hkey;
l->name = strdup(name);
l->next = locales;
l->next = NULL;
l->index = nextlocaleindex++;
assert(nextlocaleindex<=MAXLOCALES);
locales = l;
*lp = l;
if (default_locale==NULL) default_locale = l;
return l;
}
@ -70,6 +70,7 @@ make_locale(const char * name)
/** creates a list of locales
* This function takes a comma-delimited list of locale-names and creates
* the locales using the make_locale function (useful for ini-files).
* For maximum performance, locales should be created in order of popularity.
*/
void
make_locales(const char * str)

View file

@ -169,7 +169,7 @@ typedef struct _stat stat_type;
# define strdup _strdup
# define HAVE_STRDUP
# define sleep(sec) _sleep(sec*1000000)
# define sleep(sec) _sleep(sec)
# define HAVE_SLEEP
# define stricmp(a, b) _stricmp(a, b)

View file

@ -804,7 +804,9 @@ check_mages(void)
int maxmages = max_skill(f, SK_MAGIC);
for (u = f->units;u!=NULL;u=u->nextF) {
if (is_mage(u) && !is_familiar(u)) ++mages;
if (is_mage(u) && !is_familiar(u)) {
++mages;
}
}
if (mages>maxmages) {
log_error(("faction %s has %d of max %d magicians.\n",

View file

@ -3,9 +3,9 @@
<building name="illusioncastle" capacity="0" maxcapacity="0" maxsize="0" nobuild="yes"/>
<building name="xmas_exit" maxsize="10" maxcapacity="2" nobuild="yes" nodestroy="yes" unique="yes"/>
<building name="caldera" capacity="1" nodestroy="yes" nobuild="yes"/>
<building name="genericbuilding" maxsize="1" nobuild="yes"/>
<building name="genericbuilding" namechange="no" maxsize="1" nobuild="yes"/>
<building name="artacademy" maxsize="100" nobuild="yes" nodestroy="yes" unique="yes"/>
<building name="artsculpture" maxsize="100" nobuild="yes" nodestroy="yes" unique="yes"/>
<building name="artsculpture" namechange="no" maxsize="100" nobuild="yes" nodestroy="yes" unique="yes"/>
<building name="blessedstonecircle" maxcapacity="3" maxsize="100" nobuild="yes" magic="yes" magres="60" magresbonus="30" auraregen="1.50">
<construction skill="building" minskill="2" reqsize="100" maxsize="100">
@ -64,7 +64,7 @@
</construction>
</building>
<building name="monument" capacity="1">
<building name="monument" namechange="no" capacity="1">
<construction skill="building" minskill="4" reqsize="1">
<requirement type="log" quantity="1"/>
<requirement type="stone" quantity="1"/>

View file

@ -2345,7 +2345,7 @@
<arg name="race" type="race"/>
</type>
<text locale="de">"$unit($mage) ruft einen Vertrauten. $race($race, 0) können $skills lernen."</text>
<text locale="en">"$unit($mage) summons a familiar. $race($race, 0) can learn $skills."</text>
<text locale="en">"$unit($mage) summons a familiar. $race($race, 0) can learn ${skills}."</text>
</message>
<message name="babbler_resist" section="magic">
@ -3475,8 +3475,8 @@
<arg name="target" type="unit"/>
<arg name="skills" type="string"/>
</type>
<text locale="de">"$unit($target) beherrscht $skills."</text>
<text locale="en">"$unit($target) has the skills $skills"</text>
<text locale="de">"$unit($target) beherrscht ${skills}."</text>
<text locale="en">"$unit($target) has the skills ${skills}."</text>
</message>
<message name="spyreport_items" section="events">
<type>
@ -4048,21 +4048,14 @@
</type>
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Dazu muss erst die Spezialeigenschaft erworben werden."</text>
</message>
<message name="error279" section="errors">
<type>
<arg name="unit" type="unit"/>
<arg name="region" type="region"/>
<arg name="command" type="order"/>
</type>
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Die Beschreibung des Gebäudes kann nicht geändert werden."</text>
</message>
<message name="error278" section="errors">
<type>
<arg name="unit" type="unit"/>
<arg name="region" type="region"/>
<arg name="command" type="order"/>
</type>
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Der Name des Gebäudes kann nicht geändert werden."</text>
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Name und Beschreibung des Gebäudes können nicht geändert werden."</text>
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - You cannot change the name and description of this building."</text>
</message>
<message name="error277" section="errors">
<type>
@ -6579,19 +6572,8 @@
<arg name="command" type="order"/>
</type>
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Die Botschaft enthält keinen Text."</text>
<text locale="fr">"$unit($unit) in $region($region): '$order($command)' - The message does not contain text."</text>
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - The message does not contain text."</text>
</message>
<message name="error29" section="errors">
<type>
<arg name="unit" type="unit"/>
<arg name="region" type="region"/>
<arg name="command" type="order"/>
</type>
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Die Beschreibung von Monumenten kann man nicht verändern."</text>
<text locale="fr">"$unit($unit) in $region($region): '$order($command)' - The description of a monument can not be changed anymore."</text>
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - The description of a monument can not be changed anymore."</text>
</message>
<message name="error28" section="errors">
<type>
<arg name="unit" type="unit"/>
@ -6607,7 +6589,6 @@
<arg name="command" type="order"/>
</type>
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Die Anzahl zu verkaufender Produkte fehlt."</text>
<text locale="fr">"$unit($unit) in $region($region): '$order($command)' - The amount of items for sale is missing."</text>
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - The amount of items for sale is missing."</text>
</message>
<message name="error26" section="errors">
@ -6617,7 +6598,6 @@
<arg name="command" type="order"/>
</type>
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Die Anzahl zu kaufender Produkte fehlt."</text>
<text locale="fr">"$unit($unit) in $region($region): '$order($command)' - The amount of items to buy is missing."</text>
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - The amount of items to buy is missing."</text>
</message>
<message name="error25" section="errors">
@ -6627,7 +6607,6 @@
<arg name="command" type="order"/>
</type>
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Der Fluch verhindert das."</text>
<text locale="fr">"$unit($unit) in $region($region): '$order($command)' - The escape prevented that from happening."</text>
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - The escape prevented that from happening."</text>
</message>
<message name="error24" section="errors">
@ -6637,7 +6616,6 @@
<arg name="command" type="order"/>
</type>
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Der Belagerungszustand macht Spionage unmöglich."</text>
<text locale="fr">"$unit($unit) in $region($region): '$order($command)' - Espionage was not possible due to siege."</text>
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - Espionage was not possible due to siege."</text>
</message>
<message name="error23" section="errors">
@ -6647,7 +6625,6 @@
<arg name="command" type="order"/>
</type>
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Der Belagerungszustand macht die Kontaktaufnahme unmöglich."</text>
<text locale="fr">"$unit($unit) in $region($region): '$order($command)' - Contact was not possible due to siege."</text>
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - Contact was not possible due to siege."</text>
</message>
<message name="error22" section="errors">
@ -6657,7 +6634,6 @@
<arg name="command" type="order"/>
</type>
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Der Befehl wurde nicht erkannt."</text>
<text locale="fr">"$unit($unit) in $region($region): '$order($command)' - Unknown command."</text>
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - Unknown command."</text>
</message>
<message name="error21" section="errors">
@ -6667,7 +6643,6 @@
<arg name="command" type="order"/>
</type>
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Dazu gibt es keine Informationen."</text>
<text locale="fr">"$unit($unit) in $region($region): '$order($command)' - There is no information available for the request."</text>
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - There is no information available for the request."</text>
</message>
<message name="error20" section="errors">
@ -6677,7 +6652,6 @@
<arg name="command" type="order"/>
</type>
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Das Schiff wurde nicht gefunden."</text>
<text locale="fr">"$unit($unit) in $region($region): '$order($command)' - The ship could not be found."</text>
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - The ship could not be found."</text>
</message>
<message name="error19" section="errors">
@ -6687,7 +6661,6 @@
<arg name="command" type="order"/>
</type>
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Das Schiff muß erst verlassen werden."</text>
<text locale="fr">"$unit($unit) in $region($region): '$order($command)' - First you have to leave the ship."</text>
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - First you have to leave the ship."</text>
</message>
<message name="error18" section="errors">
@ -6697,17 +6670,17 @@
<arg name="command" type="order"/>
</type>
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Das Schiff ist zu schwer beladen, um in See zu stechen."</text>
<text locale="fr">"$unit($unit) en $region($region): '$order($command)' - L'unité est trop chargée pour se déplacer."</text>
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - The ship is too heavily loaded to sail."</text>
</message>
<message name="error17" section="errors">
<message name="error_flying_ship_too_big" section="errors">
<type>
<arg name="unit" type="unit"/>
<arg name="region" type="region"/>
<arg name="ship" type="ship"/>
<arg name="command" type="order"/>
</type>
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - Das Schiff ist zu schwer beladen, um fliegen zu können."</text>
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - There is too much cargo on board this ship to fly."</text>
<text locale="de">"$unit($unit) in $region($region): '$order($command)' - $ship($ship) ist zu groß, um fliegen zu können."</text>
<text locale="en">"$unit($unit) in $region($region): '$order($command)' - $ship($ship) is too bulky to fly."</text>
</message>
<message name="error16" section="errors">
<type>
@ -7952,6 +7925,14 @@
<text locale="en">"The $ship($ship) is blessed with favourable winds$if($lt($duration,3),", but the spell is starting to wear thin",""). ($int36($id))"</text>
</message>
<message name="curseinfo::flyingship" section="magic">
<type>
<arg name="id" type="int"/>
</type>
<text locale="de">"Kräftige Stürme haben dieses Schiff in die Luft gehoben. ($int36($id))"</text>
<text locale="en">"Powerful storms have lifted this ship high into the air. ($int36($id))"</text>
</message>
<message name="curseinfo::astralblock" section="magic">
<type>
<arg name="id" type="int"/>