forked from github/server
Merge pull request #610 from ennorehling/develop
house cleaning prior to 3.10
This commit is contained in:
commit
0cb8e36877
62 changed files with 518 additions and 661 deletions
|
@ -295,7 +295,7 @@ static void a_initeffect(attrib * a)
|
|||
a->data.v = calloc(sizeof(effect_data), 1);
|
||||
}
|
||||
|
||||
static void a_finalizeeffect(attrib * a)
|
||||
static void a_finalizeeffect(attrib * a) //-V524
|
||||
{
|
||||
free(a->data.v);
|
||||
}
|
||||
|
|
|
@ -765,7 +765,7 @@ bool missile)
|
|||
skill += CavalryBonus(tu, enemy, BONUS_SKILL);
|
||||
if (wtype)
|
||||
skill =
|
||||
skillmod(urace(tu)->attribs, tu, tu->region, wtype->skill, skill,
|
||||
skillmod(u_race(tu)->attribs, tu, tu->region, wtype->skill, skill,
|
||||
SMF_RIDING);
|
||||
}
|
||||
|
||||
|
@ -3984,7 +3984,7 @@ static bool start_battle(region * r, battle ** bp)
|
|||
while (a && a->type == &at_curse) {
|
||||
curse *c = (curse *)a->data.v;
|
||||
if (c->type == calm_ct
|
||||
&& curse_geteffect(c) == u2->faction->subscription) {
|
||||
&& curse_geteffect_int(c) == u2->faction->subscription) {
|
||||
if (curse_active(c)) {
|
||||
calm = true;
|
||||
break;
|
||||
|
@ -4275,10 +4275,8 @@ void do_battle(region * r)
|
|||
/* Hier ist das Gefecht beendet, und wir k<>nnen die
|
||||
* Hilfsstrukturen * wieder l<EFBFBD>schen: */
|
||||
|
||||
if (b) {
|
||||
free_battle(b);
|
||||
}
|
||||
}
|
||||
|
||||
void do_battles(void) {
|
||||
region *r;
|
||||
|
|
20
src/battle.h
20
src/battle.h
|
@ -30,7 +30,7 @@ extern "C" {
|
|||
#define FS_HELP 2
|
||||
|
||||
/***** Verteidigungslinien.
|
||||
* Eressea hat 4 Verteidigungslinien. 1 ist vorn, 5. enth<EFBFBD>lt Summen
|
||||
* Eressea hat 4 Verteidigungslinien. 1 ist vorn, 5. enthaelt Summen
|
||||
*/
|
||||
|
||||
#define NUMROWS 5
|
||||
|
@ -72,9 +72,9 @@ extern "C" {
|
|||
unsigned char relations[MAXSIDES];
|
||||
struct side *enemies[MAXSIDES];
|
||||
struct fighter *fighters;
|
||||
int index; /* Eintrag der Fraktion in b->matrix/b->enemies */
|
||||
unsigned int index; /* Eintrag der Fraktion in b->matrix/b->enemies */
|
||||
int size[NUMROWS]; /* Anzahl Personen in Reihe X. 0 = Summe */
|
||||
int nonblockers[NUMROWS]; /* Anzahl nichtblockierender K<EFBFBD>mpfer, z.B. Schattenritter. */
|
||||
int nonblockers[NUMROWS]; /* Anzahl nichtblockierender Kaempfer, z.B. Schattenritter. */
|
||||
int alive; /* Die Partei hat den Kampf verlassen */
|
||||
int removed; /* stoned */
|
||||
int flee;
|
||||
|
@ -131,7 +131,7 @@ extern "C" {
|
|||
|
||||
/*** fighter::person::flags ***/
|
||||
#define FL_TIRED 1
|
||||
#define FL_DAZZLED 2 /* durch Untote oder D<EFBFBD>monen eingesch<63>chtert */
|
||||
#define FL_DAZZLED 2 /* durch Untote oder Daemonen eingeschuechtert */
|
||||
#define FL_PANICED 4
|
||||
#define FL_COURAGE 8 /* Helden fliehen nie */
|
||||
#define FL_SLEEPING 16
|
||||
|
@ -156,17 +156,17 @@ extern "C" {
|
|||
typedef struct fighter {
|
||||
struct fighter *next;
|
||||
struct side *side;
|
||||
struct unit *unit; /* Die Einheit, die hier k<EFBFBD>mpft */
|
||||
struct building *building; /* Geb<EFBFBD>ude, in dem die Einheit evtl. steht */
|
||||
struct unit *unit; /* Die Einheit, die hier kaempft */
|
||||
struct building *building; /* Gebaeude, in dem die Einheit evtl. steht */
|
||||
status_t status; /* Kampfstatus */
|
||||
struct weapon *weapons;
|
||||
struct armor *armors; /* Anzahl R<EFBFBD>stungen jeden Typs */
|
||||
struct armor *armors; /* Anzahl Ruestungen jeden Typs */
|
||||
int alive; /* Anzahl der noch nicht Toten in der Einheit */
|
||||
int fighting; /* Anzahl der K<EFBFBD>mpfer in der aktuellen Runde */
|
||||
int fighting; /* Anzahl der Kaempfer in der aktuellen Runde */
|
||||
int removed; /* Anzahl Kaempfer, die nicht tot sind, aber
|
||||
aus dem Kampf raus sind (zB weil sie
|
||||
versteinert wurden). Diese werden auch
|
||||
in alive noch mitgez<EFBFBD>hlt! */
|
||||
in alive noch mitgezaehlt! */
|
||||
int magic; /* Magietalent der Einheit */
|
||||
int horses; /* Anzahl brauchbarer Pferde der Einheit */
|
||||
int elvenhorses; /* Anzahl brauchbarer Elfenpferde der Einheit */
|
||||
|
@ -179,7 +179,7 @@ extern "C" {
|
|||
int defence : 8; /* (Magie) Paradenbonus der Personen */
|
||||
int damage : 8; /* (Magie) Schadensbonus der Personen im Nahkampf */
|
||||
int damage_rear : 8; /* (Magie) Schadensbonus der Personen im Fernkampf */
|
||||
int flags : 8; /* (Magie) Diverse Flags auf K<EFBFBD>mpfern */
|
||||
int flags : 8; /* (Magie) Diverse Flags auf Kaempfern */
|
||||
int speed : 8; /* (Magie) Geschwindigkeitsmultiplkator. */
|
||||
int reload : 4; /* Anzahl Runden, die die Waffe x noch laden muss.
|
||||
* dahinter steckt ein array[RL_MAX] wenn er min. eine hat. */
|
||||
|
|
|
@ -756,10 +756,8 @@ static int tolua_unit_get_spells(lua_State * L)
|
|||
quicklist *slist = 0;
|
||||
if (sb) {
|
||||
quicklist **slist_ptr = &sb->spells;
|
||||
if (slist_ptr) {
|
||||
slist = *slist_ptr;
|
||||
}
|
||||
}
|
||||
return tolua_quicklist_push(L, "spellbook", "spell_entry", slist);
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ static request *nextentertainer;
|
|||
static int entertaining;
|
||||
|
||||
static unsigned int norders;
|
||||
static request *oa;
|
||||
static request *g_requests;
|
||||
|
||||
#define RECRUIT_MERGE 1
|
||||
static int rules_recruit = -1;
|
||||
|
@ -112,6 +112,23 @@ static void recruit_init(void)
|
|||
}
|
||||
}
|
||||
|
||||
int entertainmoney(const region * r)
|
||||
{
|
||||
double n;
|
||||
|
||||
if (is_cursed(r->attribs, C_DEPRESSION, 0)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
n = rmoney(r) / (double)ENTERTAINFRACTION;
|
||||
|
||||
if (is_cursed(r->attribs, C_GENEROUS, 0)) {
|
||||
n *= get_curseeffect(r->attribs, C_GENEROUS, 0);
|
||||
}
|
||||
|
||||
return (int)n;
|
||||
}
|
||||
|
||||
int income(const unit * u)
|
||||
{
|
||||
const race *rc = u_race(u);
|
||||
|
@ -154,21 +171,21 @@ static void expandorders(region * r, request * requests)
|
|||
|
||||
if (norders > 0) {
|
||||
int i = 0;
|
||||
oa = (request *)calloc(norders, sizeof(request));
|
||||
g_requests = (request *)calloc(norders, sizeof(request));
|
||||
for (o = requests; o; o = o->next) {
|
||||
if (o->qty > 0) {
|
||||
unsigned int j;
|
||||
for (j = o->qty; j; j--) {
|
||||
oa[i] = *o;
|
||||
oa[i].unit->n = 0;
|
||||
g_requests[i] = *o;
|
||||
g_requests[i].unit->n = 0;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
scramble(oa, norders, sizeof(request));
|
||||
scramble(g_requests, norders, sizeof(request));
|
||||
}
|
||||
else {
|
||||
oa = NULL;
|
||||
g_requests = NULL;
|
||||
}
|
||||
while (requests) {
|
||||
request *o = requests->next;
|
||||
|
@ -1458,16 +1475,16 @@ static void expandbuying(region * r, request * buyorders)
|
|||
|
||||
for (j = 0; j != norders; j++) {
|
||||
int price, multi;
|
||||
ltype = oa[j].type.ltype;
|
||||
ltype = g_requests[j].type.ltype;
|
||||
trade = trades;
|
||||
while (trade->type != ltype)
|
||||
++trade;
|
||||
multi = trade->multi;
|
||||
price = ltype->price * multi;
|
||||
|
||||
if (get_pooled(oa[j].unit, rsilver, GET_DEFAULT,
|
||||
if (get_pooled(g_requests[j].unit, rsilver, GET_DEFAULT,
|
||||
price) >= price) {
|
||||
unit *u = oa[j].unit;
|
||||
unit *u = g_requests[j].unit;
|
||||
item *items;
|
||||
|
||||
/* litems zählt die Güter, die verkauft wurden, u->n das Geld, das
|
||||
|
@ -1481,7 +1498,7 @@ static void expandbuying(region * r, request * buyorders)
|
|||
items = a->data.v;
|
||||
i_change(&items, ltype->itype, 1);
|
||||
a->data.v = items;
|
||||
i_change(&oa[j].unit->items, ltype->itype, 1);
|
||||
i_change(&g_requests[j].unit->items, ltype->itype, 1);
|
||||
use_pooled(u, rsilver, GET_DEFAULT, price);
|
||||
if (u->n < 0)
|
||||
u->n = 0;
|
||||
|
@ -1499,7 +1516,7 @@ static void expandbuying(region * r, request * buyorders)
|
|||
fset(u, UFL_LONGACTION | UFL_NOTMOVING);
|
||||
}
|
||||
}
|
||||
free(oa);
|
||||
free(g_requests);
|
||||
|
||||
/* Ausgabe an Einheiten */
|
||||
|
||||
|
@ -1736,7 +1753,7 @@ static void expandselling(region * r, request * sellorders, int limit)
|
|||
|
||||
for (j = 0; j != norders; j++) {
|
||||
const luxury_type *search = NULL;
|
||||
const luxury_type *ltype = oa[j].type.ltype;
|
||||
const luxury_type *ltype = g_requests[j].type.ltype;
|
||||
int multi = r_demand(r, ltype);
|
||||
int i;
|
||||
int use = 0;
|
||||
|
@ -1753,7 +1770,7 @@ static void expandselling(region * r, request * sellorders, int limit)
|
|||
if (money >= price) {
|
||||
int abgezogenhafen = 0;
|
||||
int abgezogensteuer = 0;
|
||||
unit *u = oa[j].unit;
|
||||
unit *u = g_requests[j].unit;
|
||||
item *itm;
|
||||
attrib *a = a_find(u->attribs, &at_luxuries);
|
||||
if (a == NULL)
|
||||
|
@ -1801,10 +1818,10 @@ static void expandselling(region * r, request * sellorders, int limit)
|
|||
}
|
||||
}
|
||||
if (use > 0) {
|
||||
use_pooled(oa[j].unit, ltype->itype->rtype, GET_DEFAULT, use);
|
||||
use_pooled(g_requests[j].unit, ltype->itype->rtype, GET_DEFAULT, use);
|
||||
}
|
||||
}
|
||||
free(oa);
|
||||
free(g_requests);
|
||||
|
||||
/* Steuern. Hier werden die Steuern dem Besitzer der größten Burg gegeben. */
|
||||
if (maxowner) {
|
||||
|
@ -1928,7 +1945,7 @@ static bool sell(unit * u, request ** sellorders, struct order *ord)
|
|||
s = gettoken(token, sizeof(token));
|
||||
itype = s ? finditemtype(s, u->faction->locale) : 0;
|
||||
ltype = itype ? resource2luxury(itype->rtype) : 0;
|
||||
if (ltype == NULL) {
|
||||
if (ltype == NULL || itype == NULL) {
|
||||
cmistake(u, ord, 126, MSG_COMMERCE);
|
||||
return false;
|
||||
}
|
||||
|
@ -2010,8 +2027,8 @@ static void expandstealing(region * r, request * stealorders)
|
|||
* u ist die beklaute unit. oa.unit ist die klauende unit.
|
||||
*/
|
||||
|
||||
for (j = 0; j != norders && oa[j].unit->n <= oa[j].unit->wants; j++) {
|
||||
unit *u = findunitg(oa[j].no, r);
|
||||
for (j = 0; j != norders && g_requests[j].unit->n <= g_requests[j].unit->wants; j++) {
|
||||
unit *u = findunitg(g_requests[j].no, r);
|
||||
int n = 0;
|
||||
if (u && u->region == r) {
|
||||
n = get_pooled(u, rsilver, GET_ALL, INT_MAX);
|
||||
|
@ -2035,17 +2052,17 @@ static void expandstealing(region * r, request * stealorders)
|
|||
n = 10;
|
||||
}
|
||||
if (n > 0) {
|
||||
n = _min(n, oa[j].unit->wants);
|
||||
n = _min(n, g_requests[j].unit->wants);
|
||||
use_pooled(u, rsilver, GET_ALL, n);
|
||||
oa[j].unit->n = n;
|
||||
change_money(oa[j].unit, n);
|
||||
g_requests[j].unit->n = n;
|
||||
change_money(g_requests[j].unit, n);
|
||||
ADDMSG(&u->faction->msgs, msg_message("stealeffect", "unit region amount",
|
||||
u, u->region, n));
|
||||
}
|
||||
add_income(oa[j].unit, IC_STEAL, oa[j].unit->wants, oa[j].unit->n);
|
||||
fset(oa[j].unit, UFL_LONGACTION | UFL_NOTMOVING);
|
||||
add_income(g_requests[j].unit, IC_STEAL, g_requests[j].unit->wants, g_requests[j].unit->n);
|
||||
fset(g_requests[j].unit, UFL_LONGACTION | UFL_NOTMOVING);
|
||||
}
|
||||
free(oa);
|
||||
free(g_requests);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
|
@ -2060,14 +2077,14 @@ static void plant(unit * u, int raw)
|
|||
if (!fval(r->terrain, LAND_REGION)) {
|
||||
return;
|
||||
}
|
||||
if (rherbtype(r) == NULL) {
|
||||
itype = rherbtype(r);
|
||||
if (itype == NULL) {
|
||||
cmistake(u, u->thisorder, 108, MSG_PRODUCE);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Skill prüfen */
|
||||
skill = effskill(u, SK_HERBALISM, 0);
|
||||
itype = rherbtype(r);
|
||||
if (skill < 6) {
|
||||
ADDMSG(&u->faction->msgs,
|
||||
msg_feedback(u, u->thisorder, "plant_skills",
|
||||
|
@ -2702,13 +2719,13 @@ static void expandloot(region * r, request * lootorders)
|
|||
return;
|
||||
|
||||
for (i = 0; i != norders && startmoney > looted + TAXFRACTION * 2; i++) {
|
||||
change_money(oa[i].unit, TAXFRACTION);
|
||||
oa[i].unit->n += TAXFRACTION;
|
||||
change_money(g_requests[i].unit, TAXFRACTION);
|
||||
g_requests[i].unit->n += TAXFRACTION;
|
||||
/*Looting destroys double the money*/
|
||||
looted += TAXFRACTION * 2;
|
||||
}
|
||||
rsetmoney(r, startmoney - looted);
|
||||
free(oa);
|
||||
free(g_requests);
|
||||
|
||||
/* Lowering morale by 1 depending on the looted money (+20%) */
|
||||
if (rng_int() % 100 < 20 + (looted * 80) / startmoney) {
|
||||
|
@ -2737,11 +2754,11 @@ void expandtax(region * r, request * taxorders)
|
|||
return;
|
||||
|
||||
for (i = 0; i != norders && rmoney(r) > TAXFRACTION; i++) {
|
||||
change_money(oa[i].unit, TAXFRACTION);
|
||||
oa[i].unit->n += TAXFRACTION;
|
||||
change_money(g_requests[i].unit, TAXFRACTION);
|
||||
g_requests[i].unit->n += TAXFRACTION;
|
||||
rsetmoney(r, rmoney(r) - TAXFRACTION);
|
||||
}
|
||||
free(oa);
|
||||
free(g_requests);
|
||||
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (u->n >= 0) {
|
||||
|
@ -2939,9 +2956,10 @@ static void peasant_taxes(region * r)
|
|||
maxsize = buildingeffsize(b, false);
|
||||
if (maxsize > 0) {
|
||||
double taxfactor = money * b->type->taxes(b, maxsize);
|
||||
double morale = money * region_get_morale(r) * MORALE_TAX_FACTOR;
|
||||
if (taxfactor > morale)
|
||||
double morale = MORALE_TAX_FACTOR * money * region_get_morale(r);
|
||||
if (taxfactor > morale) {
|
||||
taxfactor = morale;
|
||||
}
|
||||
if (taxfactor > 0) {
|
||||
int taxmoney = (int)taxfactor;
|
||||
change_money(u, taxmoney);
|
||||
|
|
|
@ -48,6 +48,7 @@ extern "C" {
|
|||
struct request;
|
||||
|
||||
int income(const struct unit *u);
|
||||
int entertainmoney(const struct region *r);
|
||||
|
||||
void economics(struct region *r);
|
||||
void produce(struct region *r);
|
||||
|
|
|
@ -137,7 +137,7 @@ int give_quota(const unit * src, const unit * dst, const item_type * type,
|
|||
}
|
||||
if (dst && src && src->faction != dst->faction) {
|
||||
divisor = config_get_flt("rules.items.give_divisor", 1);
|
||||
assert(divisor == 0 || divisor >= 1);
|
||||
assert(divisor <= 0 || divisor >= 1);
|
||||
if (divisor >= 1) {
|
||||
/* predictable > correct: */
|
||||
int x = (int)(n / divisor);
|
||||
|
@ -781,7 +781,7 @@ void give_cmd(unit * u, order * ord)
|
|||
}
|
||||
|
||||
if (u2 != NULL) {
|
||||
if ((u_race(u)->ec_flags & ECF_KEEP_ITEM) && u2 != NULL) {
|
||||
if ((u_race(u)->ec_flags & ECF_KEEP_ITEM)) {
|
||||
ADDMSG(&u->faction->msgs,
|
||||
msg_feedback(u, ord, "race_nogive", "race", u_race(u)));
|
||||
return;
|
||||
|
|
|
@ -184,7 +184,7 @@ map_region *mr_get(const view * vi, int xofs, int yofs)
|
|||
static point *coor2point(const coordinate * c, point * p)
|
||||
{
|
||||
assert(c && p);
|
||||
p->x = c->x * TWIDTH + c->y * TWIDTH / 2;
|
||||
p->x = c->x * TWIDTH + c->y * TWIDTH / 2; //-V537
|
||||
p->y = c->y * THEIGHT;
|
||||
return p;
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ static chtype mr_tile(const map_region * mr, int highlight)
|
|||
const region *r = mr->r;
|
||||
switch (r->terrain->_name[0]) {
|
||||
case 'o':
|
||||
return '.' | COLOR_PAIR(hl + COLOR_CYAN) | A_BOLD;
|
||||
return '.' | COLOR_PAIR(hl + COLOR_CYAN) | A_BOLD; //-V525
|
||||
case 'd':
|
||||
return 'D' | COLOR_PAIR(hl + COLOR_YELLOW) | A_BOLD;
|
||||
case 't':
|
||||
|
@ -1167,7 +1167,7 @@ static void handlekey(state * st, int c)
|
|||
region *first = (mr && mr->r && mr->r->next) ? mr->r->next : regions;
|
||||
|
||||
if (findmode == 'f') {
|
||||
sprintf(sbuffer, "find-faction: %s", locate);
|
||||
snprintf(sbuffer, sizeof(sbuffer), "find-faction: %s", locate);
|
||||
statusline(st->wnd_status->handle, sbuffer);
|
||||
f = findfaction(atoi36(locate));
|
||||
if (f == NULL) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "items.h"
|
||||
|
||||
#include "study.h"
|
||||
#include "economy.h"
|
||||
#include "move.h"
|
||||
#include "magic.h"
|
||||
|
||||
|
@ -114,10 +114,9 @@ struct order *ord)
|
|||
const resource_type *rt_crystal = NULL;
|
||||
int i;
|
||||
|
||||
if (rt_crystal == NULL) {
|
||||
rt_crystal = rt_find("antimagic");
|
||||
assert(rt_crystal != NULL);
|
||||
}
|
||||
|
||||
for (i = 0; i != amount; ++i) {
|
||||
int effect, duration = 2;
|
||||
double force;
|
||||
|
@ -138,7 +137,7 @@ struct order *ord)
|
|||
while (*ap && force > 0) {
|
||||
curse *c;
|
||||
attrib *a = *ap;
|
||||
if (!fval(a->type, ATF_CURSE)) {
|
||||
if (!(a->type->flags & ATF_CURSE)) {
|
||||
do {
|
||||
ap = &(*ap)->next;
|
||||
} while (*ap && a->type == (*ap)->type);
|
||||
|
|
17
src/json.c
17
src/json.c
|
@ -1,8 +1,9 @@
|
|||
#include "platform.h"
|
||||
#include <util/base36.h>
|
||||
|
||||
#include "json.h"
|
||||
|
||||
#include <util/base36.h>
|
||||
#include <util/log.h>
|
||||
#include <kernel/plane.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/faction.h>
|
||||
|
@ -22,12 +23,20 @@ int json_import(struct stream * out) {
|
|||
assert(out && out->api);
|
||||
while (!out->api->readln(out->handle, buffer, sizeof(buffer))) {
|
||||
size_t len = strlen(buffer);
|
||||
data = (char *)realloc(data, sz + len + 1);
|
||||
char *tmp;
|
||||
tmp = (char *)realloc(data, sz + len + 1);
|
||||
if (!tmp) {
|
||||
log_fatal("allocation failure in json_import");
|
||||
free(data);
|
||||
return 1;
|
||||
}
|
||||
data = tmp;
|
||||
memcpy(data + sz, buffer, len);
|
||||
sz += len;
|
||||
data[sz] = 0;
|
||||
}
|
||||
json = cJSON_Parse(data);
|
||||
free(data);
|
||||
child = cJSON_GetObjectItem(json, "regions");
|
||||
if (child && child->type == cJSON_Object) {
|
||||
cJSON *j;
|
||||
|
@ -64,7 +73,7 @@ int json_export(stream * out, int flags) {
|
|||
cJSON_AddItemToObject(root, "planes", json = cJSON_CreateObject());
|
||||
for (p = planes; p; p = p->next) {
|
||||
cJSON *data;
|
||||
_snprintf(id, sizeof(id), "%u", p->id);
|
||||
_snprintf(id, sizeof(id), "%d", p->id);
|
||||
cJSON_AddItemToObject(json, id, data = cJSON_CreateObject());
|
||||
cJSON_AddNumberToObject(data, "x", p->minx);
|
||||
cJSON_AddNumberToObject(data, "y", p->miny);
|
||||
|
@ -76,7 +85,7 @@ int json_export(stream * out, int flags) {
|
|||
cJSON_AddItemToObject(root, "regions", json = cJSON_CreateObject());
|
||||
for (r = regions; r; r = r->next) {
|
||||
cJSON *data;
|
||||
_snprintf(id, sizeof(id), "%u", r->uid);
|
||||
_snprintf(id, sizeof(id), "%d", r->uid);
|
||||
cJSON_AddItemToObject(json, id, data = cJSON_CreateObject());
|
||||
cJSON_AddNumberToObject(data, "x", r->x);
|
||||
cJSON_AddNumberToObject(data, "y", r->y);
|
||||
|
|
|
@ -249,7 +249,7 @@ int destroy_cmd(unit * u, struct order *ord)
|
|||
}
|
||||
|
||||
if (con) {
|
||||
/* TODO: Nicht an ZERSTÖRE mit Punktangabe angepasst! */
|
||||
/* TODO: Nicht an ZERST<EFBFBD>RE mit Punktangabe angepasst! */
|
||||
int c;
|
||||
for (c = 0; con->materials[c].number; ++c) {
|
||||
const requirement *rq = con->materials + c;
|
||||
|
@ -513,8 +513,8 @@ int build(unit * u, const construction * ctype, int completed, int want)
|
|||
|
||||
/* Hier ist entweder maxsize == -1, oder completed < maxsize.
|
||||
* Andernfalls ist das Datenfile oder sonstwas kaputt...
|
||||
* (enno): Nein, das ist für Dinge, bei denen die nächste Ausbaustufe
|
||||
* die gleiche wie die vorherige ist. z.b. gegenstände.
|
||||
* (enno): Nein, das ist f<EFBFBD>r Dinge, bei denen die n<EFBFBD>chste Ausbaustufe
|
||||
* die gleiche wie die vorherige ist. z.b. gegenst<EFBFBD>nde.
|
||||
*/
|
||||
if (type->maxsize > 0) {
|
||||
completed = completed % type->maxsize;
|
||||
|
@ -759,10 +759,8 @@ build_building(unit * u, const building_type * btype, int id, int want, order *
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (b)
|
||||
built = b->size;
|
||||
}
|
||||
if (n <= 0 || n == INT_MAX) {
|
||||
if (b == NULL) {
|
||||
if (btype->maxsize > 0) {
|
||||
|
@ -817,11 +815,11 @@ build_building(unit * u, const building_type * btype, int id, int want, order *
|
|||
btname = LOC(lang, btype->_name);
|
||||
|
||||
if (want - built <= 0) {
|
||||
/* gebäude fertig */
|
||||
/* geb<EFBFBD>ude fertig */
|
||||
new_order = default_order(lang);
|
||||
}
|
||||
else if (want != INT_MAX && btname) {
|
||||
/* reduzierte restgröße */
|
||||
/* reduzierte restgr<EFBFBD><EFBFBD>e */
|
||||
const char *hasspace = strchr(btname, ' ');
|
||||
if (hasspace) {
|
||||
new_order =
|
||||
|
@ -833,7 +831,7 @@ build_building(unit * u, const building_type * btype, int id, int want, order *
|
|||
}
|
||||
}
|
||||
else if (btname) {
|
||||
/* Neues Haus, Befehl mit Gebäudename */
|
||||
/* Neues Haus, Befehl mit Geb<EFBFBD>udename */
|
||||
const char *hasspace = strchr(btname, ' ');
|
||||
if (hasspace) {
|
||||
new_order = create_order(K_MAKE, lang, "\"%s\" %i", btname, b->no);
|
||||
|
|
|
@ -22,12 +22,14 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "building.h"
|
||||
|
||||
/* kernel includes */
|
||||
#include "curse.h"
|
||||
#include "item.h"
|
||||
#include "unit.h"
|
||||
#include "faction.h"
|
||||
#include "race.h"
|
||||
#include "region.h"
|
||||
#include "skill.h"
|
||||
#include "terrain.h"
|
||||
#include "lighthouse.h"
|
||||
|
||||
/* util includes */
|
||||
|
@ -52,6 +54,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <limits.h>
|
||||
|
||||
/* attributes includes */
|
||||
#include <attributes/reduceproduction.h>
|
||||
#include <attributes/matmod.h>
|
||||
|
||||
typedef struct building_typelist {
|
||||
|
@ -359,16 +362,6 @@ static int building_protection(const building * b, const unit * u, building_bonu
|
|||
}
|
||||
}
|
||||
|
||||
void register_buildings(void)
|
||||
{
|
||||
register_function((pf_generic)building_protection,
|
||||
"building_protection");
|
||||
register_function((pf_generic)init_smithy, "init_smithy");
|
||||
register_function((pf_generic)castle_name, "castle_name");
|
||||
register_function((pf_generic)castle_name_2, "castle_name_2");
|
||||
register_function((pf_generic)fort_name, "fort_name");
|
||||
}
|
||||
|
||||
void write_building_reference(const struct building *b, struct storage *store)
|
||||
{
|
||||
WRITE_INT(store, (b && b->region) ? b->no : 0);
|
||||
|
@ -456,8 +449,8 @@ void remove_building(building ** blist, building * b)
|
|||
update_lighthouse(b);
|
||||
bunhash(b);
|
||||
|
||||
/* Falls Karawanserei, Damm oder Tunnel einstürzen, wird die schon
|
||||
* gebaute Straße zur Hälfte vernichtet */
|
||||
/* Falls Karawanserei, Damm oder Tunnel einst<EFBFBD>rzen, wird die schon
|
||||
* gebaute Stra<EFBFBD>e zur H<EFBFBD>lfte vernichtet */
|
||||
// TODO: caravan, tunnel, dam modularization ? is_building_type ?
|
||||
if (b->type == bt_caravan || b->type == bt_dam || b->type == bt_tunnel) {
|
||||
region *r = b->region;
|
||||
|
@ -570,7 +563,7 @@ void building_set_owner(struct unit * owner)
|
|||
static unit *building_owner_ex(const building * bld, const struct faction * last_owner)
|
||||
{
|
||||
unit *u, *heir = 0;
|
||||
/* Eigentümer tot oder kein Eigentümer vorhanden. Erste lebende Einheit
|
||||
/* Eigent<EFBFBD>mer tot oder kein Eigent<6E>mer vorhanden. Erste lebende Einheit
|
||||
* nehmen. */
|
||||
for (u = bld->region->units; u; u = u->next) {
|
||||
if (u->building == bld) {
|
||||
|
@ -702,3 +695,228 @@ bool is_building_type(const struct building_type *btype, const char *name) {
|
|||
assert(btype);
|
||||
return name && strcmp(btype->_name, name)==0;
|
||||
}
|
||||
|
||||
building *largestbuilding(const region * r, cmp_building_cb cmp_gt,
|
||||
bool imaginary)
|
||||
{
|
||||
building *b, *best = NULL;
|
||||
|
||||
for (b = rbuildings(r); b; b = b->next) {
|
||||
if (cmp_gt(b, best) <= 0)
|
||||
continue;
|
||||
if (!imaginary) {
|
||||
const attrib *a = a_find(b->attribs, &at_icastle);
|
||||
if (a)
|
||||
continue;
|
||||
}
|
||||
best = b;
|
||||
}
|
||||
return best;
|
||||
}
|
||||
/* Lohn bei den einzelnen Burgstufen f<>r Normale Typen, Orks, Bauern,
|
||||
* Modifikation f<EFBFBD>r St<EFBFBD>dter. */
|
||||
|
||||
static const int wagetable[7][4] = {
|
||||
{ 10, 10, 11, -7 }, /* Baustelle */
|
||||
{ 10, 10, 11, -5 }, /* Handelsposten */
|
||||
{ 11, 11, 12, -3 }, /* Befestigung */
|
||||
{ 12, 11, 13, -1 }, /* Turm */
|
||||
{ 13, 12, 14, 0 }, /* Burg */
|
||||
{ 14, 12, 15, 1 }, /* Festung */
|
||||
{ 15, 13, 16, 2 } /* Zitadelle */
|
||||
};
|
||||
|
||||
static int
|
||||
default_wage(const region * r, const faction * f, const race * rc, int in_turn)
|
||||
{
|
||||
building *b = largestbuilding(r, &cmp_wage, false);
|
||||
int esize = 0;
|
||||
double wage;
|
||||
static int ct_cache;
|
||||
static const struct curse_type *drought_ct;
|
||||
|
||||
if (ct_changed(&ct_cache)) {
|
||||
drought_ct = ct_find("drought");
|
||||
}
|
||||
if (b != NULL) {
|
||||
/* TODO: this reveals imaginary castles */
|
||||
esize = buildingeffsize(b, false);
|
||||
}
|
||||
|
||||
if (f != NULL) {
|
||||
int index = 0;
|
||||
if (rc == get_race(RC_ORC) || rc == get_race(RC_SNOTLING)) {
|
||||
index = 1;
|
||||
}
|
||||
wage = wagetable[esize][index];
|
||||
}
|
||||
else {
|
||||
if (is_mourning(r, in_turn)) {
|
||||
wage = 10;
|
||||
}
|
||||
else if (fval(r->terrain, SEA_REGION)) {
|
||||
wage = 11;
|
||||
}
|
||||
else {
|
||||
wage = wagetable[esize][2];
|
||||
}
|
||||
if (rule_blessed_harvest() == HARVEST_WORK) {
|
||||
/* E1 rules */
|
||||
wage += curse_geteffect(get_curse(r->attribs, ct_find("blessedharvest")));
|
||||
}
|
||||
}
|
||||
|
||||
/* Artsculpture: Income +5 */
|
||||
for (b = r->buildings; b; b = b->next) {
|
||||
if (is_building_type(b->type, "artsculpture")) {
|
||||
wage += 5;
|
||||
}
|
||||
}
|
||||
|
||||
if (r->attribs) {
|
||||
attrib *a;
|
||||
const struct curse_type *ctype;
|
||||
/* Godcurse: Income -10 */
|
||||
ctype = ct_find("godcursezone");
|
||||
if (ctype && curse_active(get_curse(r->attribs, ctype))) {
|
||||
wage = _max(0, wage - 10);
|
||||
}
|
||||
|
||||
/* Bei einer D<>rre verdient man nur noch ein Viertel */
|
||||
if (drought_ct) {
|
||||
curse *c = get_curse(r->attribs, drought_ct);
|
||||
if (curse_active(c))
|
||||
wage /= curse_geteffect(c);
|
||||
}
|
||||
|
||||
a = a_find(r->attribs, &at_reduceproduction);
|
||||
if (a) {
|
||||
wage = (wage * a->data.sa[0]) / 100;
|
||||
}
|
||||
}
|
||||
return (int)wage;
|
||||
}
|
||||
|
||||
static int
|
||||
minimum_wage(const region * r, const faction * f, const race * rc, int in_turn)
|
||||
{
|
||||
if (f && rc) {
|
||||
return rc->maintenance;
|
||||
}
|
||||
return default_wage(r, f, rc, in_turn);
|
||||
}
|
||||
|
||||
/* Gibt Arbeitslohn f<>r entsprechende Rasse zur<75>ck, oder f<>r
|
||||
* die Bauern wenn f == NULL. */
|
||||
int wage(const region * r, const faction * f, const race * rc, int in_turn)
|
||||
{
|
||||
if (global.functions.wage) {
|
||||
return global.functions.wage(r, f, rc, in_turn);
|
||||
}
|
||||
return default_wage(r, f, rc, in_turn);
|
||||
}
|
||||
|
||||
int cmp_wage(const struct building *b, const building * a)
|
||||
{
|
||||
if (is_building_type(b->type, "castle")) {
|
||||
if (!a)
|
||||
return 1;
|
||||
if (b->size > a->size)
|
||||
return 1;
|
||||
if (b->size == a->size)
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool is_owner_building(const struct building * b)
|
||||
{
|
||||
region *r = b->region;
|
||||
if (b->type->taxes && r->land && r->land->ownership) {
|
||||
unit *u = building_owner(b);
|
||||
return u && u->faction == r->land->ownership->owner;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int cmp_taxes(const building * b, const building * a)
|
||||
{
|
||||
faction *f = region_get_owner(b->region);
|
||||
if (b->type->taxes) {
|
||||
unit *u = building_owner(b);
|
||||
if (!u) {
|
||||
return -1;
|
||||
}
|
||||
else if (a) {
|
||||
int newsize = buildingeffsize(b, false);
|
||||
double newtaxes = b->type->taxes(b, newsize);
|
||||
int oldsize = buildingeffsize(a, false);
|
||||
double oldtaxes = a->type->taxes(a, oldsize);
|
||||
|
||||
if (newtaxes < oldtaxes)
|
||||
return -1;
|
||||
else if (newtaxes > oldtaxes)
|
||||
return 1;
|
||||
else if (b->size < a->size)
|
||||
return -1;
|
||||
else if (b->size > a->size)
|
||||
return 1;
|
||||
else {
|
||||
if (u && u->faction == f) {
|
||||
u = building_owner(a);
|
||||
if (u && u->faction == f)
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int cmp_current_owner(const building * b, const building * a)
|
||||
{
|
||||
faction *f = region_get_owner(b->region);
|
||||
|
||||
assert(rule_region_owners());
|
||||
if (f && b->type->taxes) {
|
||||
unit *u = building_owner(b);
|
||||
if (!u || u->faction != f)
|
||||
return -1;
|
||||
if (a) {
|
||||
int newsize = buildingeffsize(b, false);
|
||||
double newtaxes = b->type->taxes(b, newsize);
|
||||
int oldsize = buildingeffsize(a, false);
|
||||
double oldtaxes = a->type->taxes(a, oldsize);
|
||||
|
||||
if (newtaxes > oldtaxes) {
|
||||
return 1;
|
||||
}
|
||||
if (newtaxes < oldtaxes) {
|
||||
return -1;
|
||||
}
|
||||
if (newsize != oldsize) {
|
||||
return newsize - oldsize;
|
||||
}
|
||||
return (b->size - a->size);
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void register_buildings(void)
|
||||
{
|
||||
register_function((pf_generic)minimum_wage, "minimum_wage");
|
||||
register_function((pf_generic)building_protection,
|
||||
"building_protection");
|
||||
register_function((pf_generic)init_smithy, "init_smithy");
|
||||
register_function((pf_generic)castle_name, "castle_name");
|
||||
register_function((pf_generic)castle_name_2, "castle_name_2");
|
||||
register_function((pf_generic)fort_name, "fort_name");
|
||||
}
|
||||
|
|
|
@ -60,8 +60,8 @@ extern "C" {
|
|||
char *_name;
|
||||
|
||||
int flags; /* flags */
|
||||
int capacity; /* Kapazität pro Größenpunkt */
|
||||
int maxcapacity; /* Max. Kapazität */
|
||||
int capacity; /* Kapazit<EFBFBD>t pro Gr<47><72>enpunkt */
|
||||
int maxcapacity; /* Max. Kapazit<EFBFBD>t */
|
||||
int maxsize; /* how big can it get, with all the extensions? */
|
||||
int magres; /* how well it resists against spells */
|
||||
int magresbonus; /* bonus it gives the target against spells */
|
||||
|
@ -131,7 +131,17 @@ extern "C" {
|
|||
int id, int size, struct order *ord);
|
||||
bool building_finished(const struct building *b);
|
||||
|
||||
/* Alte Gebäudetypen: */
|
||||
int wage(const struct region *r, const struct faction *f,
|
||||
const struct race *rc, int in_turn);
|
||||
|
||||
typedef int(*cmp_building_cb) (const struct building * b,
|
||||
const struct building * a);
|
||||
struct building *largestbuilding(const struct region *r, cmp_building_cb,
|
||||
bool imaginary);
|
||||
int cmp_wage(const struct building *b, const struct building *bother);
|
||||
int cmp_taxes(const struct building *b, const struct building *bother);
|
||||
int cmp_current_owner(const struct building *b,
|
||||
const struct building *bother);
|
||||
|
||||
/* old functions, still in build.c: */
|
||||
int buildingeffsize(const building * b, int imaginary);
|
||||
|
|
|
@ -405,8 +405,8 @@ static void test_buildingtype_exists(CuTest * tc)
|
|||
|
||||
r = findregion(-1, 0);
|
||||
b = new_building(btype, r, default_locale);
|
||||
b->size = 10;
|
||||
CuAssertPtrNotNull(tc, b);
|
||||
b->size = 10;
|
||||
|
||||
CuAssertTrue(tc, !buildingtype_exists(r, NULL, false));
|
||||
CuAssertTrue(tc, !buildingtype_exists(r, btype2, false));
|
||||
|
|
|
@ -19,9 +19,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
|
||||
/* attributes includes */
|
||||
#include <attributes/reduceproduction.h>
|
||||
|
||||
/* kernel includes */
|
||||
#include "alliance.h"
|
||||
#include "ally.h"
|
||||
|
@ -183,18 +180,6 @@ parse(keyword_t kword, int(*dofun) (unit *, struct order *), bool thisorder)
|
|||
}
|
||||
}
|
||||
|
||||
const struct race *findrace(const char *s, const struct locale *lang)
|
||||
{
|
||||
void **tokens = get_translations(lang, UT_RACES);
|
||||
variant token;
|
||||
|
||||
assert(lang);
|
||||
if (tokens && findtoken(*tokens, s, &token) == E_TOK_SUCCESS) {
|
||||
return (const struct race *)token.v;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int findoption(const char *s, const struct locale *lang)
|
||||
{
|
||||
void **tokens = get_translations(lang, UT_OPTIONS);
|
||||
|
@ -265,37 +250,6 @@ unit *getnewunit(const region * r, const faction * f)
|
|||
return findnewunit(r, f, n);
|
||||
}
|
||||
|
||||
/* - Namen der Strukturen -------------------------------------- */
|
||||
char *untilde(char *ibuf)
|
||||
{
|
||||
char *p = ibuf;
|
||||
|
||||
while (*p) {
|
||||
if (*p == '~') {
|
||||
*p = ' ';
|
||||
}
|
||||
++p;
|
||||
}
|
||||
return ibuf;
|
||||
}
|
||||
|
||||
building *largestbuilding(const region * r, cmp_building_cb cmp_gt,
|
||||
bool imaginary)
|
||||
{
|
||||
building *b, *best = NULL;
|
||||
|
||||
for (b = rbuildings(r); b; b = b->next) {
|
||||
if (cmp_gt(b, best) <= 0)
|
||||
continue;
|
||||
if (!imaginary) {
|
||||
const attrib *a = a_find(b->attribs, &at_icastle);
|
||||
if (a)
|
||||
continue;
|
||||
}
|
||||
best = b;
|
||||
}
|
||||
return best;
|
||||
}
|
||||
|
||||
/* -- Erschaffung neuer Einheiten ------------------------------ */
|
||||
|
||||
|
@ -652,108 +606,6 @@ char *_strdup(const char *s)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Lohn bei den einzelnen Burgstufen f<>r Normale Typen, Orks, Bauern,
|
||||
* Modifikation f<EFBFBD>r St<EFBFBD>dter. */
|
||||
|
||||
static const int wagetable[7][4] = {
|
||||
{ 10, 10, 11, -7 }, /* Baustelle */
|
||||
{ 10, 10, 11, -5 }, /* Handelsposten */
|
||||
{ 11, 11, 12, -3 }, /* Befestigung */
|
||||
{ 12, 11, 13, -1 }, /* Turm */
|
||||
{ 13, 12, 14, 0 }, /* Burg */
|
||||
{ 14, 12, 15, 1 }, /* Festung */
|
||||
{ 15, 13, 16, 2 } /* Zitadelle */
|
||||
};
|
||||
|
||||
int cmp_wage(const struct building *b, const building * a)
|
||||
{
|
||||
if (is_building_type(b->type, "castle")) {
|
||||
if (!a)
|
||||
return 1;
|
||||
if (b->size > a->size)
|
||||
return 1;
|
||||
if (b->size == a->size)
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool is_owner_building(const struct building * b)
|
||||
{
|
||||
region *r = b->region;
|
||||
if (b->type->taxes && r->land && r->land->ownership) {
|
||||
unit *u = building_owner(b);
|
||||
return u && u->faction == r->land->ownership->owner;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int cmp_taxes(const building * b, const building * a)
|
||||
{
|
||||
faction *f = region_get_owner(b->region);
|
||||
if (b->type->taxes) {
|
||||
unit *u = building_owner(b);
|
||||
if (!u) {
|
||||
return -1;
|
||||
}
|
||||
else if (a) {
|
||||
int newsize = buildingeffsize(b, false);
|
||||
double newtaxes = b->type->taxes(b, newsize);
|
||||
int oldsize = buildingeffsize(a, false);
|
||||
double oldtaxes = a->type->taxes(a, oldsize);
|
||||
|
||||
if (newtaxes < oldtaxes)
|
||||
return -1;
|
||||
else if (newtaxes > oldtaxes)
|
||||
return 1;
|
||||
else if (b->size < a->size)
|
||||
return -1;
|
||||
else if (b->size > a->size)
|
||||
return 1;
|
||||
else {
|
||||
if (u && u->faction == f) {
|
||||
u = building_owner(a);
|
||||
if (u && u->faction == f)
|
||||
return -1;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int cmp_current_owner(const building * b, const building * a)
|
||||
{
|
||||
faction *f = region_get_owner(b->region);
|
||||
|
||||
assert(rule_region_owners());
|
||||
if (f && b->type->taxes) {
|
||||
unit *u = building_owner(b);
|
||||
if (!u || u->faction != f)
|
||||
return -1;
|
||||
if (a) {
|
||||
int newsize = buildingeffsize(b, false);
|
||||
double newtaxes = b->type->taxes(b, newsize);
|
||||
int oldsize = buildingeffsize(a, false);
|
||||
double oldtaxes = a->type->taxes(a, oldsize);
|
||||
|
||||
if (newtaxes != oldtaxes)
|
||||
return (newtaxes > oldtaxes) ? 1 : -1;
|
||||
if (newsize != oldsize)
|
||||
return newsize - oldsize;
|
||||
return (b->size - a->size);
|
||||
}
|
||||
else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool rule_stealth_other(void)
|
||||
{
|
||||
static int rule, config;
|
||||
|
@ -814,102 +666,11 @@ int rule_faction_limit(void)
|
|||
return rule;
|
||||
}
|
||||
|
||||
static int
|
||||
default_wage(const region * r, const faction * f, const race * rc, int in_turn)
|
||||
{
|
||||
building *b = largestbuilding(r, &cmp_wage, false);
|
||||
int esize = 0;
|
||||
double wage;
|
||||
static int ct_cache;
|
||||
static const struct curse_type *drought_ct;
|
||||
|
||||
if (ct_changed(&ct_cache)) {
|
||||
drought_ct = ct_find("drought");
|
||||
}
|
||||
if (b != NULL) {
|
||||
/* TODO: this reveals imaginary castles */
|
||||
esize = buildingeffsize(b, false);
|
||||
}
|
||||
|
||||
if (f != NULL) {
|
||||
int index = 0;
|
||||
if (rc == get_race(RC_ORC) || rc == get_race(RC_SNOTLING)) {
|
||||
index = 1;
|
||||
}
|
||||
wage = wagetable[esize][index];
|
||||
}
|
||||
else {
|
||||
if (is_mourning(r, in_turn)) {
|
||||
wage = 10;
|
||||
}
|
||||
else if (fval(r->terrain, SEA_REGION)) {
|
||||
wage = 11;
|
||||
}
|
||||
else {
|
||||
wage = wagetable[esize][2];
|
||||
}
|
||||
if (rule_blessed_harvest() == HARVEST_WORK) {
|
||||
/* E1 rules */
|
||||
wage += curse_geteffect(get_curse(r->attribs, ct_find("blessedharvest")));
|
||||
}
|
||||
}
|
||||
|
||||
/* Artsculpture: Income +5 */
|
||||
for (b = r->buildings; b; b = b->next) {
|
||||
if (is_building_type(b->type, "artsculpture")) {
|
||||
wage += 5;
|
||||
}
|
||||
}
|
||||
|
||||
if (r->attribs) {
|
||||
attrib *a;
|
||||
const struct curse_type *ctype;
|
||||
/* Godcurse: Income -10 */
|
||||
ctype = ct_find("godcursezone");
|
||||
if (ctype && curse_active(get_curse(r->attribs, ctype))) {
|
||||
wage = _max(0, wage - 10);
|
||||
}
|
||||
|
||||
/* Bei einer D<>rre verdient man nur noch ein Viertel */
|
||||
if (drought_ct) {
|
||||
curse *c = get_curse(r->attribs, drought_ct);
|
||||
if (curse_active(c))
|
||||
wage /= curse_geteffect(c);
|
||||
}
|
||||
|
||||
a = a_find(r->attribs, &at_reduceproduction);
|
||||
if (a) {
|
||||
wage = (wage * a->data.sa[0]) / 100;
|
||||
}
|
||||
}
|
||||
return (int)wage;
|
||||
}
|
||||
|
||||
static int
|
||||
minimum_wage(const region * r, const faction * f, const race * rc, int in_turn)
|
||||
{
|
||||
if (f && rc) {
|
||||
return rc->maintenance;
|
||||
}
|
||||
return default_wage(r, f, rc, in_turn);
|
||||
}
|
||||
|
||||
/* Gibt Arbeitslohn f<>r entsprechende Rasse zur<75>ck, oder f<>r
|
||||
* die Bauern wenn f == NULL. */
|
||||
int wage(const region * r, const faction * f, const race * rc, int in_turn)
|
||||
{
|
||||
if (global.functions.wage) {
|
||||
return global.functions.wage(r, f, rc, in_turn);
|
||||
}
|
||||
return default_wage(r, f, rc, in_turn);
|
||||
}
|
||||
|
||||
void kernel_init(void)
|
||||
{
|
||||
register_reports();
|
||||
mt_clear();
|
||||
translation_init();
|
||||
register_function((pf_generic)minimum_wage, "minimum_wage");
|
||||
}
|
||||
|
||||
static order * defaults[MAXLOCALES];
|
||||
|
@ -936,23 +697,6 @@ order *default_order(const struct locale *lang)
|
|||
return result ? copy_order(result) : 0;
|
||||
}
|
||||
|
||||
int entertainmoney(const region * r)
|
||||
{
|
||||
double n;
|
||||
|
||||
if (is_cursed(r->attribs, C_DEPRESSION, 0)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
n = rmoney(r) / ENTERTAINFRACTION;
|
||||
|
||||
if (is_cursed(r->attribs, C_GENEROUS, 0)) {
|
||||
n *= get_curseeffect(r->attribs, C_GENEROUS, 0);
|
||||
}
|
||||
|
||||
return (int)n;
|
||||
}
|
||||
|
||||
int rule_give(void)
|
||||
{
|
||||
static int config;
|
||||
|
|
|
@ -54,17 +54,6 @@ struct param;
|
|||
int forbiddenid(int id);
|
||||
int newcontainerid(void);
|
||||
|
||||
char *untilde(char *s);
|
||||
|
||||
typedef int(*cmp_building_cb) (const struct building * b,
|
||||
const struct building * a);
|
||||
struct building *largestbuilding(const struct region *r, cmp_building_cb,
|
||||
bool imaginary);
|
||||
int cmp_wage(const struct building *b, const struct building *bother);
|
||||
int cmp_taxes(const struct building *b, const struct building *bother);
|
||||
int cmp_current_owner(const struct building *b,
|
||||
const struct building *bother);
|
||||
|
||||
bool rule_region_owners(void);
|
||||
bool rule_stealth_other(void); // units can pretend to be another faction, TARNE PARTEI <no>
|
||||
bool rule_stealth_anon(void); // units can anonymize their faction, TARNE PARTEI [NICHT]
|
||||
|
@ -83,8 +72,6 @@ struct param;
|
|||
#define GIVE_DEFAULT (GIVE_SELF|GIVE_PEASANTS|GIVE_LUXURIES|GIVE_HERBS|GIVE_GOODS)
|
||||
int rule_give(void);
|
||||
|
||||
const struct race *findrace(const char *, const struct locale *);
|
||||
|
||||
/* grammatik-flags: */
|
||||
#define GF_NONE 0
|
||||
/* singular, ohne was dran */
|
||||
|
@ -99,9 +86,6 @@ struct param;
|
|||
#define GF_PURE 64
|
||||
/* untranslated */
|
||||
|
||||
int wage(const struct region *r, const struct faction *f,
|
||||
const struct race *rc, int in_turn);
|
||||
|
||||
const char *datapath(void);
|
||||
void set_datapath(const char *path);
|
||||
|
||||
|
@ -147,7 +131,6 @@ struct param;
|
|||
|
||||
struct order *default_order(const struct locale *lang);
|
||||
|
||||
int entertainmoney(const struct region *r);
|
||||
void init_parameters(struct locale *lang);
|
||||
|
||||
void free_gamedata(void);
|
||||
|
|
|
@ -825,7 +825,7 @@ double destr_curse(curse * c, int cast_level, double force)
|
|||
c->type->change_vigour(c, -(cast_level + 1) / 2);
|
||||
}
|
||||
else {
|
||||
c->vigour -= cast_level + 1 / 2;
|
||||
c->vigour -= (cast_level + 1) / 2.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -827,7 +827,7 @@ int writepasswd(void)
|
|||
log_info("writing passwords...");
|
||||
|
||||
for (f = factions; f; f = f->next) {
|
||||
fprintf(F, "%s:%s:%s:%u\n",
|
||||
fprintf(F, "%s:%s:%s:%d\n",
|
||||
itoa36(f->no), f->email, f->_password, f->subscription);
|
||||
}
|
||||
fclose(F);
|
||||
|
|
|
@ -82,7 +82,7 @@ static void test_group_readwrite(CuTest * tc)
|
|||
mstream_init(&data.strm);
|
||||
gamedata_init(&data, &store, RELEASE_VERSION);
|
||||
f = test_create_faction(0);
|
||||
g = new_group(f, "NW", 42);
|
||||
new_group(f, "NW", 42);
|
||||
g = new_group(f, "Egoisten", 43);
|
||||
key_set(&g->attribs, 44);
|
||||
al = ally_add(&g->allies, f);
|
||||
|
|
|
@ -239,7 +239,6 @@ item_type *it_get_or_create(resource_type *rtype) {
|
|||
item_type * itype;
|
||||
assert(rtype);
|
||||
itype = it_find(rtype->_name);
|
||||
assert(!itype || !itype->rtype || itype->rtype == rtype);
|
||||
if (!itype) {
|
||||
itype = (item_type *)calloc(sizeof(item_type), 1);
|
||||
}
|
||||
|
@ -973,7 +972,7 @@ void init_resources(void)
|
|||
{
|
||||
resource_type *rtype;
|
||||
|
||||
rtype = rt_get_or_create(resourcenames[R_PERSON]); // lousy hack
|
||||
rt_get_or_create(resourcenames[R_PERSON]); // lousy hack
|
||||
|
||||
rtype = rt_get_or_create(resourcenames[R_PEASANT]);
|
||||
rtype->uchange = res_changepeasants;
|
||||
|
@ -1204,7 +1203,7 @@ void read_items(struct storage *store, item ** ilist)
|
|||
itype = it_find(ibuf);
|
||||
READ_INT(store, &i);
|
||||
if (i <= 0) {
|
||||
log_error("data contains an entry with %d %s", i, resourcename(itype->rtype, NMF_PLURAL));
|
||||
log_error("data contains an entry with %d %s", i, ibuf);
|
||||
}
|
||||
else {
|
||||
if (itype && itype->rtype) {
|
||||
|
|
|
@ -179,7 +179,7 @@ int count)
|
|||
if (u != v && (v->items || rtype->uget)) {
|
||||
int mask;
|
||||
|
||||
if ((urace(v)->ec_flags & ECF_KEEP_ITEM))
|
||||
if ((u_race(v)->ec_flags & ECF_KEEP_ITEM))
|
||||
continue;
|
||||
|
||||
if (v->faction == f) {
|
||||
|
@ -232,7 +232,7 @@ use_pooled(unit * u, const resource_type * rtype, unsigned int mode, int count)
|
|||
for (v = r->units; use > 0 && v != NULL; v = v->next) {
|
||||
if (u != v) {
|
||||
int mask;
|
||||
if ((urace(v)->ec_flags & ECF_KEEP_ITEM))
|
||||
if ((u_race(v)->ec_flags & ECF_KEEP_ITEM))
|
||||
continue;
|
||||
if (v->items == NULL && rtype->uget == NULL)
|
||||
continue;
|
||||
|
|
|
@ -39,6 +39,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <util/attrib.h>
|
||||
#include <util/bsdstring.h>
|
||||
#include <util/functions.h>
|
||||
#include <util/umlaut.h>
|
||||
#include <util/language.h>
|
||||
#include <util/log.h>
|
||||
#include <util/rng.h>
|
||||
|
@ -75,6 +76,18 @@ static const char *racenames[MAXRACES] = {
|
|||
"clone"
|
||||
};
|
||||
|
||||
const struct race *findrace(const char *s, const struct locale *lang)
|
||||
{
|
||||
void **tokens = get_translations(lang, UT_RACES);
|
||||
variant token;
|
||||
|
||||
assert(lang);
|
||||
if (tokens && findtoken(*tokens, s, &token) == E_TOK_SUCCESS) {
|
||||
return (const struct race *)token.v;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const struct race *get_race(race_t rt) {
|
||||
const char * name;
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ extern "C" {
|
|||
|
||||
struct param;
|
||||
struct spell;
|
||||
struct locale;
|
||||
|
||||
extern int num_races;
|
||||
|
||||
|
@ -163,6 +164,7 @@ extern "C" {
|
|||
void racelist_clear(struct race_list **rl);
|
||||
void racelist_insert(struct race_list **rl, const struct race *r);
|
||||
|
||||
const struct race *findrace(const char *, const struct locale *);
|
||||
|
||||
struct race_list *get_familiarraces(void);
|
||||
struct race *races;
|
||||
|
|
|
@ -46,7 +46,7 @@ extern int dice_rand(const char *s);
|
|||
|
||||
static void update_resource(struct rawmaterial *res, double modifier)
|
||||
{
|
||||
double amount = 1 + (res->level - res->startlevel) * res->divisor / 100.0;
|
||||
double amount = (res->level - res->startlevel) / 100.0 * res->divisor + 1;
|
||||
amount = ResourceFactor() * res->base * amount * modifier;
|
||||
if (amount < 1.0)
|
||||
res->amount = 1;
|
||||
|
|
|
@ -917,11 +917,6 @@ bool leave(unit * u, bool force)
|
|||
return true;
|
||||
}
|
||||
|
||||
const struct race *urace(const struct unit *u)
|
||||
{
|
||||
return u->_race;
|
||||
}
|
||||
|
||||
bool can_survive(const unit * u, const region * r)
|
||||
{
|
||||
if ((fval(r->terrain, WALK_INTO) && (u_race(u)->flags & RCF_WALK))
|
||||
|
|
|
@ -141,8 +141,6 @@ extern "C" {
|
|||
struct unit *utarget(const struct unit *u);
|
||||
void usettarget(struct unit *u, const struct unit *b);
|
||||
|
||||
extern const struct race *urace(const struct unit *u);
|
||||
|
||||
const char *uprivate(const struct unit *u);
|
||||
void usetprivate(struct unit *u, const char *c);
|
||||
|
||||
|
|
11
src/laws.c
11
src/laws.c
|
@ -648,7 +648,7 @@ growing_trees(region * r, const int current_season, const int last_weeks_season)
|
|||
* verfügbaren Fläche ab. In Gletschern gibt es weniger
|
||||
* Möglichkeiten als in Ebenen. */
|
||||
sprout = 0;
|
||||
seedchance = (1000 * region_maxworkers(r2)) / r2->terrain->size;
|
||||
seedchance = (1000.0 * region_maxworkers(r2)) / r2->terrain->size;
|
||||
for (i = 0; i < seeds / MAXDIRECTIONS; i++) {
|
||||
if (rng_int() % 10000 < seedchance)
|
||||
sprout++;
|
||||
|
@ -1269,7 +1269,6 @@ static void remove_idle_players(void)
|
|||
} else {
|
||||
if (fval(f, FFL_NOIDLEOUT)) {
|
||||
f->lastorders = turn;
|
||||
fp = &f->next;
|
||||
}
|
||||
else if (turn != f->lastorders) {
|
||||
char info[256];
|
||||
|
@ -2997,7 +2996,7 @@ static void ageing(void)
|
|||
a_age(&u->attribs, u);
|
||||
if (u == *up)
|
||||
handle_event(u->attribs, "timer", u);
|
||||
if (u == *up)
|
||||
if (u == *up) //-V581
|
||||
up = &(*up)->next;
|
||||
}
|
||||
|
||||
|
@ -3007,7 +3006,7 @@ static void ageing(void)
|
|||
a_age(&s->attribs, s);
|
||||
if (s == *sp)
|
||||
handle_event(s->attribs, "timer", s);
|
||||
if (s == *sp)
|
||||
if (s == *sp) //-V581
|
||||
sp = &(*sp)->next;
|
||||
}
|
||||
|
||||
|
@ -3636,7 +3635,7 @@ int pay_cmd(unit * u, struct order *ord)
|
|||
static int reserve_i(unit * u, struct order *ord, int flags)
|
||||
{
|
||||
char token[128];
|
||||
if (u->number > 0 && (urace(u)->ec_flags & GETITEM)) {
|
||||
if (u->number > 0 && (u_race(u)->ec_flags & GETITEM)) {
|
||||
int use, count, para;
|
||||
const item_type *itype;
|
||||
const char *s;
|
||||
|
@ -3945,7 +3944,7 @@ int armedmen(const unit * u, bool siege_weapons)
|
|||
{
|
||||
item *itm;
|
||||
int n = 0;
|
||||
if (!(urace(u)->flags & RCF_NOWEAPONS)) {
|
||||
if (!(u_race(u)->flags & RCF_NOWEAPONS)) {
|
||||
if (effskill(u, SK_WEAPONLESS, 0) >= 1) {
|
||||
/* kann ohne waffen bewachen: fuer drachen */
|
||||
n = u->number;
|
||||
|
|
|
@ -173,7 +173,7 @@ static void a_initicastle(struct attrib *a)
|
|||
a->data.v = calloc(sizeof(icastle_data), 1);
|
||||
}
|
||||
|
||||
static void a_finalizeicastle(struct attrib *a)
|
||||
static void a_finalizeicastle(struct attrib *a) //-V524
|
||||
{
|
||||
free(a->data.v);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include <items/demonseye.h>
|
||||
#include <attributes/key.h>
|
||||
#include <triggers/gate.h>
|
||||
#include <triggers/unguard.h>
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/building.h>
|
||||
|
|
|
@ -76,17 +76,13 @@ bool monster_is_waiting(const unit * u)
|
|||
static void eaten_by_monster(unit * u)
|
||||
{
|
||||
/* adjustment for smaller worlds */
|
||||
static double multi = 0.0;
|
||||
double multi = RESOURCE_QUANTITY * newterrain(T_PLAIN)->size / 10000.0;
|
||||
int n = 0;
|
||||
int horse = -1;
|
||||
const resource_type *rhorse = get_resourcetype(R_HORSE);
|
||||
const race *rc = u_race(u);
|
||||
attrib *a;
|
||||
|
||||
if (multi == 0.0) {
|
||||
multi = RESOURCE_QUANTITY * newterrain(T_PLAIN)->size / 10000.0;
|
||||
}
|
||||
|
||||
a = a_find(rc->attribs, &at_scare);
|
||||
if (a) {
|
||||
n = rng_int() & a->data.i * u->number;
|
||||
|
|
|
@ -695,7 +695,7 @@ static order *plan_dragon(unit * u)
|
|||
int attempts = 0;
|
||||
skill_t sk = SK_PERCEPTION;
|
||||
/* study perception (or a random useful skill) */
|
||||
while ((!skill_enabled(sk) || (attempts < MAXSKILLS && u_race(u)->bonus[sk] < (++attempts < 10?1:-5 )))) {
|
||||
while (!skill_enabled(sk) || (attempts < MAXSKILLS && u_race(u)->bonus[sk] < (++attempts < 10?1:-5 ))) {
|
||||
sk = (skill_t)(rng_int() % MAXSKILLS);
|
||||
}
|
||||
long_order = create_order(K_STUDY, u->faction->locale, "'%s'",
|
||||
|
|
13
src/prefix.c
13
src/prefix.c
|
@ -1,6 +1,8 @@
|
|||
#include <platform.h>
|
||||
#include "prefix.h"
|
||||
|
||||
#include <util/log.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -10,7 +12,7 @@ char **race_prefixes = NULL;
|
|||
static size_t size = 4;
|
||||
static unsigned int next = 0;
|
||||
|
||||
void add_raceprefix(const char *prefix)
|
||||
int add_raceprefix(const char *prefix)
|
||||
{
|
||||
assert(prefix);
|
||||
if (race_prefixes == NULL) {
|
||||
|
@ -19,11 +21,18 @@ void add_raceprefix(const char *prefix)
|
|||
race_prefixes = malloc(size * sizeof(char *));
|
||||
}
|
||||
if (next + 1 == size) {
|
||||
char **tmp;
|
||||
tmp = realloc(race_prefixes, 2 * size * sizeof(char *));
|
||||
if (!tmp) {
|
||||
log_fatal("allocation failure");
|
||||
return 1;
|
||||
}
|
||||
race_prefixes = tmp;
|
||||
size *= 2;
|
||||
race_prefixes = realloc(race_prefixes, size * sizeof(char *));
|
||||
}
|
||||
race_prefixes[next++] = _strdup(prefix);
|
||||
race_prefixes[next] = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void free_prefixes(void) {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
void add_raceprefix(const char *);
|
||||
int add_raceprefix(const char *);
|
||||
char **race_prefixes; // zero-terminated array of valid prefixes
|
||||
void free_prefixes(void);
|
||||
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
static void test_add_prefix(CuTest *tc) {
|
||||
test_setup();
|
||||
CuAssertPtrEquals(tc, 0, race_prefixes);
|
||||
add_raceprefix("sea");
|
||||
CuAssertIntEquals(tc, 0, add_raceprefix("sea"));
|
||||
CuAssertPtrNotNull(tc, race_prefixes);
|
||||
CuAssertStrEquals(tc, "sea", race_prefixes[0]);
|
||||
CuAssertPtrEquals(tc, 0, race_prefixes[1]);
|
||||
add_raceprefix("moon");
|
||||
CuAssertIntEquals(tc, 0, add_raceprefix("moon"));
|
||||
CuAssertStrEquals(tc, "sea", race_prefixes[0]);
|
||||
CuAssertStrEquals(tc, "moon", race_prefixes[1]);
|
||||
CuAssertPtrEquals(tc, 0, race_prefixes[2]);
|
||||
|
|
|
@ -69,7 +69,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
extern struct attrib_type at_unitdissolve;
|
||||
|
||||
/* In a->data.ca[1] steht der Prozentsatz mit dem sich die Einheit
|
||||
* auflöst, in a->data.ca[0] kann angegeben werden, wohin die Personen
|
||||
* aufl<EFBFBD>st, in a->data.ca[0] kann angegeben werden, wohin die Personen
|
||||
* verschwinden. Passiert bereits in der ersten Runde! */
|
||||
static void dissolve_units(void)
|
||||
{
|
||||
|
@ -442,12 +442,12 @@ static void melt_iceberg(region * r)
|
|||
ADDMSG(&u->faction->msgs, msg_message("iceberg_melt", "region", r));
|
||||
}
|
||||
|
||||
/* driftrichtung löschen */
|
||||
/* driftrichtung l<EFBFBD>schen */
|
||||
a = a_find(r->attribs, &at_iceberg);
|
||||
if (a)
|
||||
a_remove(&r->attribs, a);
|
||||
|
||||
/* Gebäude löschen */
|
||||
/* Geb<EFBFBD>ude l<>schen */
|
||||
while (r->buildings) {
|
||||
remove_building(&r->buildings, r->buildings);
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ static void melt_iceberg(region * r)
|
|||
/* in Ozean wandeln */
|
||||
terraform_region(r, newterrain(T_OCEAN));
|
||||
|
||||
/* Einheiten, die nicht schwimmen können oder in Schiffen sind,
|
||||
/* Einheiten, die nicht schwimmen k<EFBFBD>nnen oder in Schiffen sind,
|
||||
* ertrinken */
|
||||
drown(r);
|
||||
}
|
||||
|
@ -519,13 +519,13 @@ static void move_iceberg(region * r)
|
|||
freset(sh, SF_SELECT);
|
||||
|
||||
for (sh = r->ships; sh; sh = sh->next) {
|
||||
/* Meldung an Kapitän */
|
||||
/* Meldung an Kapit<EFBFBD>n */
|
||||
double dmg = config_get_flt("rules.ship.damage.intoiceberg", 0.1);
|
||||
damage_ship(sh, dmg);
|
||||
fset(sh, SF_SELECT);
|
||||
}
|
||||
|
||||
/* Personen, Schiffe und Gebäude verschieben */
|
||||
/* Personen, Schiffe und Geb<EFBFBD>ude verschieben */
|
||||
while (rc->buildings) {
|
||||
rc->buildings->region = r;
|
||||
translist(&rc->buildings, &r->buildings, rc->buildings);
|
||||
|
@ -544,7 +544,7 @@ static void move_iceberg(region * r)
|
|||
u_set_building(u, b); /* undo leave-prevention */
|
||||
}
|
||||
|
||||
/* Beschädigte Schiffe können sinken */
|
||||
/* Besch<EFBFBD>digte Schiffe k<>nnen sinken */
|
||||
|
||||
for (sh = r->ships; sh;) {
|
||||
shn = sh->next;
|
||||
|
@ -725,7 +725,7 @@ static void orc_growth(void)
|
|||
}
|
||||
}
|
||||
|
||||
/** Talente von Dämonen verschieben sich.
|
||||
/** Talente von D<EFBFBD>monen verschieben sich.
|
||||
*/
|
||||
static void demon_skillchanges(void)
|
||||
{
|
||||
|
@ -760,7 +760,7 @@ static void icebergs(void)
|
|||
}
|
||||
|
||||
#define HERBS_ROT /* herbs owned by units have a chance to rot. */
|
||||
#define HERBROTCHANCE 5 /* Verrottchance für Kräuter (ifdef HERBS_ROT) */
|
||||
#define HERBROTCHANCE 5 /* Verrottchance f<EFBFBD>r Kr<4B>uter (ifdef HERBS_ROT) */
|
||||
#ifdef HERBS_ROT
|
||||
static void rotting_herbs(void)
|
||||
{
|
||||
|
|
14
src/report.c
14
src/report.c
|
@ -915,14 +915,16 @@ static void describe(struct stream *out, const region * r, faction * f)
|
|||
bool transparent = b->type->transparent(b, f);
|
||||
const char *name = border_name(b, r, f, GF_DETAILED | GF_ARTICLE);
|
||||
|
||||
if (!transparent)
|
||||
if (!transparent) {
|
||||
see[d] = false;
|
||||
}
|
||||
if (!see_border(b, f, r)) {
|
||||
b = b->next;
|
||||
continue;
|
||||
}
|
||||
while (e && (e->transparent != transparent || strcmp(name, e->name)))
|
||||
while (e && (e->transparent != transparent || strcmp(name, e->name)!=0)) {
|
||||
e = e->next;
|
||||
}
|
||||
if (!e) {
|
||||
e = calloc(sizeof(struct edge), 1);
|
||||
e->name = _strdup(name);
|
||||
|
@ -1730,7 +1732,7 @@ static void rpline(struct stream *out)
|
|||
memset(line, '-', sizeof(line));
|
||||
line[REPORTWIDTH] = '\n';
|
||||
}
|
||||
swrite(line, sizeof(char), sizeof(line), out);
|
||||
swrite(line, sizeof(line), 1, out);
|
||||
}
|
||||
|
||||
static void list_address(struct stream *out, const faction * uf, quicklist * seenfactions)
|
||||
|
@ -2248,10 +2250,8 @@ report_plaintext(const char *filename, report_context * ctx,
|
|||
*bufp = 0;
|
||||
centre(out, buf, true);
|
||||
newline(out);
|
||||
if (description == NULL) {
|
||||
const char *potiontext = mkname("potion", pname);
|
||||
description = LOC(f->locale, potiontext);
|
||||
}
|
||||
description = mkname("potion", pname);
|
||||
description = LOC(f->locale, description);
|
||||
centre(out, description, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -720,7 +720,7 @@ size_t size)
|
|||
}
|
||||
}
|
||||
if (!isbattle) {
|
||||
bool printed = 0;
|
||||
int printed = 0;
|
||||
order *ord;;
|
||||
for (ord = u->old_orders; ord; ord = ord->next) {
|
||||
keyword_t kwd = getkeyword(ord);
|
||||
|
@ -1587,7 +1587,7 @@ static void var_free_resources(variant x)
|
|||
x.v = 0;
|
||||
}
|
||||
|
||||
static void var_free_regions(variant x)
|
||||
static void var_free_regions(variant x) //-V524
|
||||
{
|
||||
free(x.v);
|
||||
}
|
||||
|
@ -1716,18 +1716,6 @@ static void eval_curse(struct opstack **stack, const void *userdata)
|
|||
opush(stack, var);
|
||||
}
|
||||
|
||||
static void eval_unitname(struct opstack **stack, const void *userdata)
|
||||
{ /* unit -> string */
|
||||
const struct faction *f = (const struct faction *)userdata;
|
||||
const struct unit *u = (const struct unit *)opop(stack).v;
|
||||
const char *c = u ? unit_getname(u) : LOC(f->locale, "an_unknown_unit");
|
||||
size_t len = strlen(c);
|
||||
variant var;
|
||||
|
||||
var.v = strcpy(balloc(len + 1), c);
|
||||
opush(stack, var);
|
||||
}
|
||||
|
||||
static void eval_unitid(struct opstack **stack, const void *userdata)
|
||||
{ /* unit -> int */
|
||||
const struct faction *f = (const struct faction *)userdata;
|
||||
|
@ -1836,16 +1824,16 @@ static void eval_weight(struct opstack **stack, const void *userdata)
|
|||
sprintf(buffer, "1 %s", LOC(lang, "weight_unit"));
|
||||
}
|
||||
else {
|
||||
sprintf(buffer, "%u %s", weight / SCALEWEIGHT, LOC(lang,
|
||||
sprintf(buffer, "%d %s", weight / SCALEWEIGHT, LOC(lang,
|
||||
"weight_unit_p"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (weight == 1) {
|
||||
sprintf(buffer, "1 %s %u", LOC(lang, "weight_per"), SCALEWEIGHT);
|
||||
sprintf(buffer, "1 %s %d", LOC(lang, "weight_per"), SCALEWEIGHT);
|
||||
}
|
||||
else {
|
||||
sprintf(buffer, "%u %s %u", weight, LOC(lang, "weight_per_p"),
|
||||
sprintf(buffer, "%d %s %d", weight, LOC(lang, "weight_per_p"),
|
||||
SCALEWEIGHT);
|
||||
}
|
||||
}
|
||||
|
@ -2136,7 +2124,6 @@ void register_reports(void)
|
|||
add_function("ship", &eval_ship);
|
||||
add_function("unit", &eval_unit);
|
||||
add_function("unit.dative", &eval_unit_dative);
|
||||
add_function("unit.name", &eval_unitname);
|
||||
add_function("unit.id", &eval_unitid);
|
||||
add_function("unit.size", &eval_unitsize);
|
||||
add_function("building", &eval_building);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#undef NEWATSROI
|
||||
|
||||
/* Vermehrungsrate Bauern in 1/10000.
|
||||
* TODO: Evt. Berechnungsfehler, reale Vermehrungsraten scheinen höher. */
|
||||
* TODO: Evt. Berechnungsfehler, reale Vermehrungsraten scheinen hoeher. */
|
||||
#define PEASANTGROWTH 10
|
||||
#define PEASANTLUCK 10
|
||||
|
||||
|
@ -37,22 +37,21 @@
|
|||
|
||||
/* experimental gameplay features (that don't affect the savefile) */
|
||||
/* TODO: move these settings to settings.h or into configuration files */
|
||||
#define GOBLINKILL /* Goblin-Spezialklau kann tödlich enden */
|
||||
#define INSECT_POTION /* Spezialtrank für Insekten */
|
||||
#define ORCIFICATION /* giving snotlings to the peasants gets counted */
|
||||
#define GOBLINKILL /* Goblin-Spezialklau kann toedlich enden */
|
||||
#define INSECT_POTION /* Spezialtrank fuer Insekten */
|
||||
|
||||
#define TREESIZE (8) /* space used by trees (in #peasants) */
|
||||
|
||||
#define PEASANTFORCE 0.75 /* Chance einer Vermehrung trotz 90% Auslastung */
|
||||
|
||||
/* Gebäudegröße = Minimalbelagerer */
|
||||
/* Gebaeudegroesse = Minimalbelagerer */
|
||||
#define SIEGEFACTOR 2
|
||||
|
||||
/** Magic */
|
||||
#define MAXMAGICIANS 3
|
||||
#define MAXALCHEMISTS 3
|
||||
|
||||
#define ENCCHANCE 10 /* %-Chance für einmalige Zufallsbegegnung */
|
||||
#define BAGCAPACITY 20000 /* soviel paßt in einen Bag of Holding */
|
||||
#define ENCCHANCE 10 /* %-Chance fuer einmalige Zufallsbegegnung */
|
||||
#define BAGCAPACITY 20000 /* soviel passt in einen Bag of Holding */
|
||||
#define PERSON_WEIGHT 1000 /* weight of a "normal" human unit */
|
||||
#define STAMINA_AFFECTS_HP 1<<0
|
||||
|
|
28
src/spy.c
28
src/spy.c
|
@ -17,7 +17,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "spy.h"
|
||||
#include "guard.h"
|
||||
#include "laws.h"
|
||||
|
@ -26,6 +25,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "study.h"
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/config.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/messages.h>
|
||||
|
@ -44,11 +44,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
/* util includes */
|
||||
#include <util/attrib.h>
|
||||
#include <util/base36.h>
|
||||
#include <util/bsdstring.h>
|
||||
#include <util/parser.h>
|
||||
#include <quicklist.h>
|
||||
#include <util/rand.h>
|
||||
#include <util/rng.h>
|
||||
|
||||
#include <quicklist.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
@ -98,13 +100,13 @@ void spy_message(int spy, const unit * u, const unit * target)
|
|||
first = 0;
|
||||
}
|
||||
else {
|
||||
strncat(buf, ", ", sizeof(buf) - 1);
|
||||
strlcat(buf, ", ", sizeof(buf));
|
||||
}
|
||||
strncat(buf, (const char *)skillname((skill_t)sv->id, u->faction->locale),
|
||||
sizeof(buf) - 1);
|
||||
strncat(buf, " ", sizeof(buf) - 1);
|
||||
strncat(buf, itoa10(eff_skill(target, sv, target->region)),
|
||||
sizeof(buf) - 1);
|
||||
strlcat(buf, (const char *)skillname((skill_t)sv->id, u->faction->locale),
|
||||
sizeof(buf));
|
||||
strlcat(buf, " ", sizeof(buf));
|
||||
strlcat(buf, itoa10(eff_skill(target, sv, target->region)),
|
||||
sizeof(buf));
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
|
@ -297,7 +299,7 @@ int setstealth_cmd(unit * u, struct order *ord)
|
|||
break;
|
||||
}
|
||||
else if (findparam(s, u->faction->locale) == P_NOT) {
|
||||
freset(u, UFL_ANON_FACTION);
|
||||
u->flags |= ~UFL_ANON_FACTION;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -414,18 +416,18 @@ static void sink_ship(region * r, ship * sh, unit * saboteur)
|
|||
/* slight optimization to avoid dereferencing u->faction each time */
|
||||
if (f != u->faction) {
|
||||
f = u->faction;
|
||||
freset(f, FFL_SELECT);
|
||||
f->flags |= ~FFL_SELECT;
|
||||
}
|
||||
}
|
||||
|
||||
/* figure out what a unit's chances of survival are: */
|
||||
if (!fval(r->terrain, SEA_REGION)) {
|
||||
if (!(r->terrain->flags & SEA_REGION)) {
|
||||
probability = CANAL_SWIMMER_CHANCE;
|
||||
}
|
||||
else {
|
||||
for (d = 0; d != MAXDIRECTIONS; ++d) {
|
||||
region *rn = rconnect(r, d);
|
||||
if (rn && !fval(rn->terrain, SEA_REGION) && !move_blocked(NULL, r, rn)) {
|
||||
if (rn && !(rn->terrain->flags & SEA_REGION) && !move_blocked(NULL, r, rn)) {
|
||||
safety = rn;
|
||||
probability = OCEAN_SWIMMER_CHANCE;
|
||||
break;
|
||||
|
@ -436,7 +438,7 @@ static void sink_ship(region * r, ship * sh, unit * saboteur)
|
|||
unit *u = *ui;
|
||||
|
||||
/* inform this faction about the sinking ship: */
|
||||
if (!fval(u->faction, FFL_SELECT)) {
|
||||
if (!(u->faction->flags & FFL_SELECT)) {
|
||||
fset(u->faction, FFL_SELECT);
|
||||
if (sink_msg == NULL) {
|
||||
sink_msg = msg_message("sink_msg", "ship region", sh, r);
|
||||
|
|
|
@ -25,6 +25,7 @@ extern "C" {
|
|||
struct unit;
|
||||
struct region;
|
||||
struct strlist;
|
||||
struct order;
|
||||
|
||||
extern int setstealth_cmd(struct unit *u, struct order *ord);
|
||||
extern int spy_cmd(struct unit *u, struct order *ord);
|
||||
|
|
|
@ -220,7 +220,7 @@ void report_summary(summary * s, summary * o, bool full)
|
|||
fprintf(F, " Helden: %s\n", pcomp(s->heroes, o->heroes));
|
||||
|
||||
if (full) {
|
||||
fprintf(F, "Regionen: %d\n", listlen(regions));
|
||||
fprintf(F, "Regionen: %d\n", (int)listlen(regions));
|
||||
fprintf(F, "Bewohnte Regionen: %d\n", s->inhabitedregions);
|
||||
fprintf(F, "Landregionen: %d\n", s->landregionen);
|
||||
fprintf(F, "Spielerregionen: %d\n", s->regionen_mit_spielern);
|
||||
|
|
|
@ -11,7 +11,6 @@ killunit.c
|
|||
shock.c
|
||||
timeout.c
|
||||
triggers.c
|
||||
unguard.c
|
||||
unitmessage.c
|
||||
)
|
||||
FOREACH(_FILE ${_FILES})
|
||||
|
|
|
@ -17,7 +17,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "createcurse.h"
|
||||
|
||||
/* kernel includes */
|
||||
|
|
|
@ -17,7 +17,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "createunit.h"
|
||||
|
||||
/* kernel includes */
|
||||
|
|
|
@ -28,6 +28,7 @@ extern "C" {
|
|||
struct region;
|
||||
struct faction;
|
||||
struct unit;
|
||||
struct race;
|
||||
|
||||
extern struct trigger_type tt_createunit;
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "gate.h"
|
||||
|
||||
/* kernel includes */
|
||||
|
|
|
@ -17,7 +17,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "giveitem.h"
|
||||
|
||||
/* kernel includes */
|
||||
|
|
|
@ -17,7 +17,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "killunit.h"
|
||||
|
||||
#include <kernel/region.h>
|
||||
|
|
|
@ -17,7 +17,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "shock.h"
|
||||
|
||||
#include "magic.h"
|
||||
|
@ -84,7 +83,7 @@ static void do_shock(unit * u, const char *reason)
|
|||
}
|
||||
|
||||
/* Dies ist ein Hack, um das skillmod und familiar-Attribut beim Mage
|
||||
* zu löschen wenn der Familiar getötet wird. Da sollten wir über eine
|
||||
* zu l<EFBFBD>schen wenn der Familiar get<EFBFBD>tet wird. Da sollten wir <EFBFBD>ber eine
|
||||
* saubere Implementation nachdenken. */
|
||||
|
||||
if (strcmp(reason, "trigger") == 0) {
|
||||
|
|
|
@ -17,7 +17,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "timeout.h"
|
||||
|
||||
/* util includes */
|
||||
|
|
|
@ -17,7 +17,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
|
||||
/* triggers includes */
|
||||
#include <triggers/changefaction.h>
|
||||
|
@ -25,7 +24,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <triggers/createcurse.h>
|
||||
#include <triggers/createunit.h>
|
||||
#include <triggers/gate.h>
|
||||
#include <triggers/unguard.h>
|
||||
#include <triggers/giveitem.h>
|
||||
#include <triggers/killunit.h>
|
||||
#include <triggers/shock.h>
|
||||
|
@ -46,7 +44,6 @@ void register_triggers(void)
|
|||
tt_register(&tt_createcurse);
|
||||
tt_register(&tt_createunit);
|
||||
tt_register(&tt_gate);
|
||||
tt_register(&tt_unguard);
|
||||
tt_register(&tt_giveitem);
|
||||
tt_register(&tt_killunit);
|
||||
tt_register(&tt_shock);
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
/*
|
||||
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| (c) 1998 - 2003 | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
|
||||
+-------------------+ Stefan Reich <reich@halbling.de>
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "unguard.h"
|
||||
|
||||
/* kernel includes */
|
||||
#include <util/attrib.h>
|
||||
#include <kernel/building.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/unit.h>
|
||||
|
||||
/* util includes */
|
||||
#include <util/attrib.h>
|
||||
#include <util/event.h>
|
||||
#include <util/gamedata.h>
|
||||
#include <util/log.h>
|
||||
#include <util/resolve.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <stdlib.h>
|
||||
|
||||
static int unguard_handle(trigger * t, void *data)
|
||||
{
|
||||
building *b = (building *)t->data.v;
|
||||
|
||||
if (b) {
|
||||
fset(b, BLD_UNGUARDED);
|
||||
}
|
||||
else {
|
||||
log_error("could not perform unguard::handle()\n");
|
||||
return -1;
|
||||
}
|
||||
unused_arg(data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void unguard_write(const trigger * t, struct storage *store)
|
||||
{
|
||||
write_building_reference((building *)t->data.v, store);
|
||||
}
|
||||
|
||||
static int unguard_read(trigger * t, gamedata *data)
|
||||
{
|
||||
int rb = read_reference(&t->data.v, data, read_building_reference,
|
||||
resolve_building);
|
||||
if (rb == 0 && !t->data.v) {
|
||||
return AT_READ_FAIL;
|
||||
}
|
||||
return AT_READ_OK;
|
||||
}
|
||||
|
||||
struct trigger_type tt_unguard = {
|
||||
"building",
|
||||
NULL,
|
||||
NULL,
|
||||
unguard_handle,
|
||||
unguard_write,
|
||||
unguard_read
|
||||
};
|
||||
|
||||
trigger *trigger_unguard(building * b)
|
||||
{
|
||||
trigger *t = t_new(&tt_unguard);
|
||||
t->data.v = (void *)b;
|
||||
return t;
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| (c) 1998 - 2003 | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
|
||||
+-------------------+ Stefan Reich <reich@halbling.de>
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifndef UNGUARD_H
|
||||
#define UNGUARD_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* all types we use are defined here to reduce dependencies */
|
||||
struct trigger_type;
|
||||
struct trigger;
|
||||
struct region;
|
||||
struct building;
|
||||
|
||||
extern struct trigger_type tt_unguard;
|
||||
|
||||
extern struct trigger *trigger_unguard(struct building *b);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -8,7 +8,6 @@ without prior permission by the authors of Eressea.
|
|||
*/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "unitmessage.h"
|
||||
|
||||
/* kernel includes */
|
||||
|
|
|
@ -32,7 +32,7 @@ static void test_strlcpy(CuTest * tc)
|
|||
CuAssertIntEquals(tc, 4, (int)strlcpy(buffer, "herp", 4));
|
||||
CuAssertStrEquals(tc, "her", buffer);
|
||||
|
||||
CuAssertIntEquals(tc, 4, (int)strlcpy(buffer, "herp", 8));
|
||||
CuAssertIntEquals(tc, 4, (int)strlcpy(buffer, "herp", 8)); //-V666
|
||||
CuAssertStrEquals(tc, "herp", buffer);
|
||||
CuAssertIntEquals(tc, 0x7f, buffer[5]);
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@ void tt_register(trigger_type * tt)
|
|||
trigger_type *tt_find(const char *name)
|
||||
{
|
||||
trigger_type *tt = triggertypes;
|
||||
while (tt && strcmp(tt->name, name))
|
||||
while (tt && strcmp(tt->name, name)!=0)
|
||||
tt = tt->next;
|
||||
return tt;
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ void log_fatal(const char *format, ...)
|
|||
va_end(args);
|
||||
}
|
||||
|
||||
void log_error(const char *format, ...)
|
||||
void log_error(const char *format, ...) //-V524
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
|
|
@ -103,13 +103,13 @@ void random_source_inject_constant(double value) {
|
|||
r_source = &constant_provider;
|
||||
}
|
||||
|
||||
static int i = 0;
|
||||
static double *values;
|
||||
static int value_size = 0;
|
||||
static int value_size;
|
||||
static int value_index;
|
||||
|
||||
static double array_source (void) {
|
||||
assert(i<value_size);
|
||||
return values[i++];
|
||||
assert(value_index<value_size);
|
||||
return values[value_index++];
|
||||
}
|
||||
|
||||
struct random_source array_provider = {
|
||||
|
@ -117,6 +117,7 @@ struct random_source array_provider = {
|
|||
};
|
||||
|
||||
void random_source_inject_array(double inject[], int size) {
|
||||
int i;
|
||||
assert(size > 0);
|
||||
value_size = size;
|
||||
if (values)
|
||||
|
@ -125,7 +126,7 @@ void random_source_inject_array(double inject[], int size) {
|
|||
for (i=0; i < size; ++i) {
|
||||
values[i] = inject[i];
|
||||
}
|
||||
i = 0;
|
||||
value_index = 0;
|
||||
r_source = &array_provider;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ static void test_unicode_trim(CuTest * tc)
|
|||
CuAssertIntEquals(tc, 3, unicode_utf8_trim(buffer));
|
||||
CuAssertStrEquals(tc, "Hello Word", buffer);
|
||||
|
||||
buffer[9] = (char)0xc3;
|
||||
buffer[9] = -61;
|
||||
CuAssertIntEquals(tc, 1, unicode_utf8_trim(buffer));
|
||||
CuAssertStrEquals(tc, "Hello Wor?", buffer);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue