Gewicht von < 1 GE Objekten besser angezeigt.
Rasseninfo aus richtigem folder gelesen.
Issue: 574
This commit is contained in:
Enno Rehling 2005-06-27 21:06:27 +00:00
parent 7d20502772
commit 68bb7d548b
2 changed files with 30 additions and 2 deletions

View File

@ -2306,7 +2306,7 @@ display_item(faction *f, unit *u, const item_type * itype)
}
}
ADDMSG(&f->msgs, msg_message("displayitem", "weight item description",
itype->weight/1000, itype->rtype, strdup(info)));
itype->weight, itype->rtype, strdup(info)));
return true;
}
@ -2354,7 +2354,7 @@ display_race(faction *f, unit *u, const race * rc)
size -= rsize;
bufp += rsize;
sprintf(filename, "showdata/%s", LOC(default_locale, name));
sprintf(filename, "%s/%s/items/%s", resourcepath(), locale_name(default_locale), LOC(default_locale, name));
fp = fopen(filename, "r");
if(fp) {
while (fgets(t, NAMESIZE, fp) != NULL) {

View File

@ -3674,6 +3674,33 @@ eval_building(struct opstack ** stack, const void * userdata) /* building -> str
opush(stack, var);
}
static void
eval_weight(struct opstack ** stack, const void * userdata) /* region -> string */
{
char buffer[32];
const struct faction * f = (const struct faction *)userdata;
const struct locale * lang = f->locale;
int weight = opop_i(stack);
variant var;
if (weight % SCALEWEIGHT == 0) {
if (weight==SCALEWEIGHT) {
sprintf(buffer, "1 %s", LOC(lang, "weight_unit"));
} else {
sprintf(buffer, "%u %s", weight/SCALEWEIGHT, LOC(lang, "weight_unit_p"));
}
} else {
if (weight==1) {
sprintf(buffer, "1 %s %u", LOC(lang, "weight_per"), SCALEWEIGHT);
} else {
sprintf(buffer, "%u %s %u", weight, LOC(lang, "weight_per_p"), SCALEWEIGHT);
}
}
var.v = strcpy(balloc(strlen(buffer)+1), buffer);
opush(stack, var);
}
static void
eval_resource(struct opstack ** stack, const void * userdata)
{
@ -3787,6 +3814,7 @@ report_init(void)
{
add_function("alliance", &eval_alliance);
add_function("region", &eval_region);
add_function("weight", &eval_weight);
add_function("resource", &eval_resource);
add_function("race", &eval_race);
add_function("faction", &eval_faction);