forked from github/server
move skill_t into a separate file, give it unit tests.
name functions the same as we did for keyword/direction earlier. to do: json configuration and lua test.
This commit is contained in:
parent
ceabbebc90
commit
bff25f3c51
55 changed files with 404 additions and 326 deletions
|
@ -60,6 +60,7 @@ set (ERESSEA_SRC
|
||||||
eressea.c
|
eressea.c
|
||||||
direction.c
|
direction.c
|
||||||
keyword.c
|
keyword.c
|
||||||
|
skill.c
|
||||||
json.c
|
json.c
|
||||||
creation.c
|
creation.c
|
||||||
creport.c
|
creport.c
|
||||||
|
@ -146,6 +147,7 @@ set(TESTS_SRC
|
||||||
tests.test.c
|
tests.test.c
|
||||||
direction.test.c
|
direction.test.c
|
||||||
keyword.test.c
|
keyword.test.c
|
||||||
|
skill.test.c
|
||||||
json.test.c
|
json.test.c
|
||||||
economy.test.c
|
economy.test.c
|
||||||
market.test.c
|
market.test.c
|
||||||
|
|
|
@ -39,7 +39,6 @@ without prior permission by the authors of Eressea.
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/spellbook.h>
|
#include <kernel/spellbook.h>
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/spell.h>
|
#include <kernel/spell.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
||||||
|
@ -393,10 +392,10 @@ static int tolua_unit_getskill(lua_State * L)
|
||||||
{
|
{
|
||||||
unit *self = (unit *) tolua_tousertype(L, 1, 0);
|
unit *self = (unit *) tolua_tousertype(L, 1, 0);
|
||||||
const char *skname = tolua_tostring(L, 2, 0);
|
const char *skname = tolua_tostring(L, 2, 0);
|
||||||
skill_t sk = sk_find(skname);
|
skill_t sk = findskill(skname);
|
||||||
int value = -1;
|
int value = -1;
|
||||||
if (sk != NOSKILL) {
|
if (sk != NOSKILL) {
|
||||||
skill *sv = get_skill(self, sk);
|
skill *sv = unit_skill(self, sk);
|
||||||
if (sv) {
|
if (sv) {
|
||||||
value = sv->level;
|
value = sv->level;
|
||||||
} else
|
} else
|
||||||
|
@ -410,7 +409,7 @@ static int tolua_unit_effskill(lua_State * L)
|
||||||
{
|
{
|
||||||
unit *self = (unit *) tolua_tousertype(L, 1, 0);
|
unit *self = (unit *) tolua_tousertype(L, 1, 0);
|
||||||
const char *skname = tolua_tostring(L, 2, 0);
|
const char *skname = tolua_tostring(L, 2, 0);
|
||||||
skill_t sk = sk_find(skname);
|
skill_t sk = findskill(skname);
|
||||||
int value = (sk == NOSKILL) ? -1 : eff_skill(self, sk, self->region);
|
int value = (sk == NOSKILL) ? -1 : eff_skill(self, sk, self->region);
|
||||||
lua_pushinteger(L, value);
|
lua_pushinteger(L, value);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -572,7 +571,7 @@ static int tolua_unit_setskill(lua_State * L)
|
||||||
unit *self = (unit *) tolua_tousertype(L, 1, 0);
|
unit *self = (unit *) tolua_tousertype(L, 1, 0);
|
||||||
const char *skname = tolua_tostring(L, 2, 0);
|
const char *skname = tolua_tostring(L, 2, 0);
|
||||||
int level = (int)tolua_tonumber(L, 3, 0);
|
int level = (int)tolua_tonumber(L, 3, 0);
|
||||||
skill_t sk = sk_find(skname);
|
skill_t sk = findskill(skname);
|
||||||
if (sk != NOSKILL) {
|
if (sk != NOSKILL) {
|
||||||
set_level(self, sk, level);
|
set_level(self, sk, level);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -30,7 +30,6 @@ without prior permission by the authors of Eressea.
|
||||||
#include <kernel/alliance.h>
|
#include <kernel/alliance.h>
|
||||||
#include <kernel/building.h>
|
#include <kernel/building.h>
|
||||||
#include <kernel/curse.h>
|
#include <kernel/curse.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/equipment.h>
|
#include <kernel/equipment.h>
|
||||||
#include <kernel/calendar.h>
|
#include <kernel/calendar.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
@ -376,7 +375,7 @@ static int tolua_learn_skill(lua_State * L)
|
||||||
unit *u = (unit *) tolua_tousertype(L, 1, 0);
|
unit *u = (unit *) tolua_tousertype(L, 1, 0);
|
||||||
const char *skname = tolua_tostring(L, 2, 0);
|
const char *skname = tolua_tostring(L, 2, 0);
|
||||||
float chances = (float)tolua_tonumber(L, 3, 0);
|
float chances = (float)tolua_tonumber(L, 3, 0);
|
||||||
skill_t sk = sk_find(skname);
|
skill_t sk = findskill(skname);
|
||||||
if (sk != NOSKILL) {
|
if (sk != NOSKILL) {
|
||||||
learn_skill(u, sk, chances);
|
learn_skill(u, sk, chances);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,6 @@ without prior permission by the authors of Eressea.
|
||||||
#include <kernel/reports.h>
|
#include <kernel/reports.h>
|
||||||
#include <kernel/resources.h>
|
#include <kernel/resources.h>
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/spell.h>
|
#include <kernel/spell.h>
|
||||||
#include <kernel/spellbook.h>
|
#include <kernel/spellbook.h>
|
||||||
#include <kernel/teleport.h>
|
#include <kernel/teleport.h>
|
||||||
|
@ -827,7 +826,7 @@ static void cr_output_unit(FILE * F, const region * r, const faction * f,
|
||||||
fprintf(F, "\"%s\";Typ\n",
|
fprintf(F, "\"%s\";Typ\n",
|
||||||
translate(zRace, locale_string(f->locale, zRace)));
|
translate(zRace, locale_string(f->locale, zRace)));
|
||||||
if (u->faction == f && irace != u_race(u)) {
|
if (u->faction == f && irace != u_race(u)) {
|
||||||
assert(skill_enabled[SK_STEALTH]
|
assert(skill_enabled(SK_STEALTH)
|
||||||
|| !"we're resetting this on load, so.. ircase should never be used");
|
|| !"we're resetting this on load, so.. ircase should never be used");
|
||||||
zRace = rc_name(u_race(u), 1);
|
zRace = rc_name(u_race(u), 1);
|
||||||
fprintf(F, "\"%s\";wahrerTyp\n",
|
fprintf(F, "\"%s\";wahrerTyp\n",
|
||||||
|
@ -1298,7 +1297,7 @@ static void cr_output_region(FILE * F, report_context * ctx, seen_region * sr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fprintf(F, "%d;Silber\n", rmoney(r));
|
fprintf(F, "%d;Silber\n", rmoney(r));
|
||||||
if (skill_enabled[SK_ENTERTAINMENT]) {
|
if (skill_enabled(SK_ENTERTAINMENT)) {
|
||||||
fprintf(F, "%d;Unterh\n", entertainmoney(r));
|
fprintf(F, "%d;Unterh\n", entertainmoney(r));
|
||||||
}
|
}
|
||||||
if (is_cursed(r->attribs, C_RIOT, 0)) {
|
if (is_cursed(r->attribs, C_RIOT, 0)) {
|
||||||
|
|
|
@ -46,7 +46,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/reports.h>
|
#include <kernel/reports.h>
|
||||||
#include <kernel/resources.h>
|
#include <kernel/resources.h>
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/terrainid.h>
|
#include <kernel/terrainid.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
@ -192,7 +191,7 @@ static void expandorders(region * r, request * requests)
|
||||||
|
|
||||||
static void change_level(unit * u, skill_t sk, int bylevel)
|
static void change_level(unit * u, skill_t sk, int bylevel)
|
||||||
{
|
{
|
||||||
skill *sv = get_skill(u, sk);
|
skill *sv = unit_skill(u, sk);
|
||||||
assert(bylevel > 0);
|
assert(bylevel > 0);
|
||||||
if (sv == 0)
|
if (sv == 0)
|
||||||
sv = add_skill(u, sk);
|
sv = add_skill(u, sk);
|
||||||
|
@ -968,7 +967,7 @@ static int forget_cmd(unit * u, order * ord)
|
||||||
skip_token();
|
skip_token();
|
||||||
s = getstrtoken();
|
s = getstrtoken();
|
||||||
|
|
||||||
if ((sk = findskill(s, u->faction->locale)) != NOSKILL) {
|
if ((sk = get_skill(s, u->faction->locale)) != NOSKILL) {
|
||||||
ADDMSG(&u->faction->msgs, msg_message("forget", "unit skill", u, sk));
|
ADDMSG(&u->faction->msgs, msg_message("forget", "unit skill", u, sk));
|
||||||
set_level(u, sk, 0);
|
set_level(u, sk, 0);
|
||||||
}
|
}
|
||||||
|
@ -2762,7 +2761,7 @@ static void steal_cmd(unit * u, struct order *ord, request ** stealorders)
|
||||||
faction *f = NULL;
|
faction *f = NULL;
|
||||||
plane *pl;
|
plane *pl;
|
||||||
|
|
||||||
assert(skill_enabled[SK_PERCEPTION] && skill_enabled[SK_STEALTH]);
|
assert(skill_enabled(SK_PERCEPTION) && skill_enabled(SK_STEALTH));
|
||||||
|
|
||||||
if (!fval(u_race(u), RCF_CANSTEAL)) {
|
if (!fval(u_race(u), RCF_CANSTEAL)) {
|
||||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "race_nosteal", "race",
|
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "race_nosteal", "race",
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/reports.h>
|
#include <kernel/reports.h>
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include <kernel/pool.h>
|
#include <kernel/pool.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/spell.h>
|
#include <kernel/spell.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
||||||
|
@ -41,8 +40,8 @@ use_studypotion(struct unit *u, const struct item_type *itype, int amount,
|
||||||
|
|
||||||
init_tokens(u->thisorder);
|
init_tokens(u->thisorder);
|
||||||
skip_token();
|
skip_token();
|
||||||
sk = findskill(getstrtoken(), u->faction->locale);
|
sk = get_skill(getstrtoken(), u->faction->locale);
|
||||||
sv = get_skill(u, sk);
|
sv = unit_skill(u, sk);
|
||||||
|
|
||||||
if (sv && sv->level > 2) {
|
if (sv && sv->level > 2) {
|
||||||
/* TODO: message */
|
/* TODO: message */
|
||||||
|
|
|
@ -27,7 +27,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
#include <kernel/save.h>
|
#include <kernel/save.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/curse.h>
|
#include <kernel/curse.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/magic.h>
|
#include <kernel/magic.h>
|
||||||
|
|
|
@ -25,7 +25,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/curse.h>
|
#include <kernel/curse.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/magic.h>
|
#include <kernel/magic.h>
|
||||||
|
|
|
@ -49,7 +49,7 @@ reports.c
|
||||||
resources.c
|
resources.c
|
||||||
save.c
|
save.c
|
||||||
ship.c
|
ship.c
|
||||||
skill.c
|
skills.c
|
||||||
spellbook.c
|
spellbook.c
|
||||||
spell.c
|
spell.c
|
||||||
teleport.c
|
teleport.c
|
||||||
|
|
|
@ -980,7 +980,7 @@ void drain_exp(struct unit *u, int n)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sk != NOSKILL) {
|
if (sk != NOSKILL) {
|
||||||
skill *sv = get_skill(u, sk);
|
skill *sv = unit_skill(u, sk);
|
||||||
while (n > 0) {
|
while (n > 0) {
|
||||||
if (n >= 30 * u->number) {
|
if (n >= 30 * u->number) {
|
||||||
reduce_skill(u, sv, 1);
|
reduce_skill(u, sv, 1);
|
||||||
|
|
|
@ -26,8 +26,8 @@ static void test_make_fighter(CuTest * tc)
|
||||||
r = findregion(0, 0);
|
r = findregion(0, 0);
|
||||||
f = test_create_faction(rc_find("human"));
|
f = test_create_faction(rc_find("human"));
|
||||||
au = test_create_unit(f, r);
|
au = test_create_unit(f, r);
|
||||||
skill_enabled[SK_MAGIC] = 1;
|
enable_skill(SK_MAGIC, true);
|
||||||
skill_enabled[SK_RIDING] = 1;
|
enable_skill(SK_RIDING, true);
|
||||||
set_level(au, SK_MAGIC, 3);
|
set_level(au, SK_MAGIC, 3);
|
||||||
set_level(au, SK_RIDING, 3);
|
set_level(au, SK_RIDING, 3);
|
||||||
au->status = ST_BEHIND;
|
au->status = ST_BEHIND;
|
||||||
|
|
|
@ -21,6 +21,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "direction.h"
|
#include "direction.h"
|
||||||
|
#include "skill.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -416,29 +416,6 @@ const char *options[MAXOPTIONS] = {
|
||||||
"SHOWSKCHANGE"
|
"SHOWSKCHANGE"
|
||||||
};
|
};
|
||||||
|
|
||||||
static int allied_skillcount(const faction * f, skill_t sk)
|
|
||||||
{
|
|
||||||
int num = 0;
|
|
||||||
alliance *a = f_get_alliance(f);
|
|
||||||
quicklist *members = a->members;
|
|
||||||
int qi;
|
|
||||||
|
|
||||||
for (qi = 0; members; ql_advance(&members, &qi, 1)) {
|
|
||||||
faction *m = (faction *) ql_get(members, qi);
|
|
||||||
num += count_skill(m, sk);
|
|
||||||
}
|
|
||||||
return num;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int allied_skilllimit(const faction * f, skill_t sk)
|
|
||||||
{
|
|
||||||
static int value = -1;
|
|
||||||
if (value < 0) {
|
|
||||||
value = get_param_int(global.parameters, "alliance.skilllimit", 0);
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void init_maxmagicians(struct attrib *a)
|
static void init_maxmagicians(struct attrib *a)
|
||||||
{
|
{
|
||||||
a->data.i = MAXMAGICIANS;
|
a->data.i = MAXMAGICIANS;
|
||||||
|
@ -454,21 +431,6 @@ static attrib_type at_maxmagicians = {
|
||||||
ATF_UNIQUE
|
ATF_UNIQUE
|
||||||
};
|
};
|
||||||
|
|
||||||
static void init_npcfaction(struct attrib *a)
|
|
||||||
{
|
|
||||||
a->data.i = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static attrib_type at_npcfaction = {
|
|
||||||
"npcfaction",
|
|
||||||
init_npcfaction,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
a_writeint,
|
|
||||||
a_readint,
|
|
||||||
ATF_UNIQUE
|
|
||||||
};
|
|
||||||
|
|
||||||
int max_magicians(const faction * f)
|
int max_magicians(const faction * f)
|
||||||
{
|
{
|
||||||
int m =
|
int m =
|
||||||
|
@ -483,46 +445,20 @@ int max_magicians(const faction * f)
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
int skill_limit(faction * f, skill_t sk)
|
static void init_npcfaction(struct attrib *a)
|
||||||
{
|
{
|
||||||
int m = INT_MAX;
|
a->data.i = 1;
|
||||||
int al = allied_skilllimit(f, sk);
|
|
||||||
if (al > 0) {
|
|
||||||
if (sk != SK_ALCHEMY && sk != SK_MAGIC)
|
|
||||||
return INT_MAX;
|
|
||||||
if (f_get_alliance(f)) {
|
|
||||||
int ac = listlen(f->alliance->members); /* number of factions */
|
|
||||||
int fl = (al + ac - 1) / ac; /* faction limit, rounded up */
|
|
||||||
/* the faction limit may not be achievable because it would break the alliance-limit */
|
|
||||||
int sc = al - allied_skillcount(f, sk);
|
|
||||||
if (sc <= 0)
|
|
||||||
return 0;
|
|
||||||
return fl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (sk == SK_MAGIC) {
|
|
||||||
m = max_magicians(f);
|
|
||||||
} else if (sk == SK_ALCHEMY) {
|
|
||||||
m = get_param_int(global.parameters, "rules.maxskills.alchemy",
|
|
||||||
MAXALCHEMISTS);
|
|
||||||
}
|
|
||||||
return m;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int count_skill(faction * f, skill_t sk)
|
static attrib_type at_npcfaction = {
|
||||||
{
|
"npcfaction",
|
||||||
int n = 0;
|
init_npcfaction,
|
||||||
unit *u;
|
NULL,
|
||||||
|
NULL,
|
||||||
for (u = f->units; u; u = u->nextF) {
|
a_writeint,
|
||||||
if (has_skill(u, sk)) {
|
a_readint,
|
||||||
if (!is_familiar(u)) {
|
ATF_UNIQUE
|
||||||
n += u->number;
|
};
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
int verbosity = 1;
|
int verbosity = 1;
|
||||||
|
|
||||||
|
@ -738,17 +674,12 @@ region *findunitregion(const unit * su)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int effskill(const unit * u, skill_t sk)
|
|
||||||
{
|
|
||||||
return eff_skill(u, sk, u->region);
|
|
||||||
}
|
|
||||||
|
|
||||||
int eff_stealth(const unit * u, const region * r)
|
int eff_stealth(const unit * u, const region * r)
|
||||||
{
|
{
|
||||||
int e = 0;
|
int e = 0;
|
||||||
|
|
||||||
/* Auf Schiffen keine Tarnung! */
|
/* Auf Schiffen keine Tarnung! */
|
||||||
if (!u->ship && skill_enabled[SK_STEALTH]) {
|
if (!u->ship && skill_enabled(SK_STEALTH)) {
|
||||||
e = eff_skill(u, SK_STEALTH, r);
|
e = eff_skill(u, SK_STEALTH, r);
|
||||||
|
|
||||||
if (fval(u, UFL_STEALTH)) {
|
if (fval(u, UFL_STEALTH)) {
|
||||||
|
@ -949,7 +880,7 @@ cansee(const faction * f, const region * r, const unit * u, int modifier)
|
||||||
|
|
||||||
while (u2) {
|
while (u2) {
|
||||||
if (rings < u->number || invisible(u, u2) < u->number) {
|
if (rings < u->number || invisible(u, u2) < u->number) {
|
||||||
if (skill_enabled[SK_PERCEPTION]) {
|
if (skill_enabled(SK_PERCEPTION)) {
|
||||||
int observation = eff_skill(u2, SK_PERCEPTION, r);
|
int observation = eff_skill(u2, SK_PERCEPTION, r);
|
||||||
|
|
||||||
if (observation >= stealth) {
|
if (observation >= stealth) {
|
||||||
|
@ -992,7 +923,7 @@ bool cansee_unit(const unit * u, const unit * target, int modifier)
|
||||||
if (rings && invisible(target, u) >= target->number) {
|
if (rings && invisible(target, u) >= target->number) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (skill_enabled[SK_PERCEPTION]) {
|
if (skill_enabled(SK_PERCEPTION)) {
|
||||||
o = eff_skill(u, SK_PERCEPTION, target->region);
|
o = eff_skill(u, SK_PERCEPTION, target->region);
|
||||||
if (o >= n) {
|
if (o >= n) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1245,25 +1176,6 @@ int findoption(const char *s, const struct locale *lang)
|
||||||
return NODIRECTION;
|
return NODIRECTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
skill_t findskill(const char *s, const struct locale * lang)
|
|
||||||
{
|
|
||||||
param_t result = NOSKILL;
|
|
||||||
char buffer[64];
|
|
||||||
char * str = transliterate(buffer, sizeof(buffer)-sizeof(int), s);
|
|
||||||
|
|
||||||
if (str) {
|
|
||||||
int i;
|
|
||||||
const void * match;
|
|
||||||
void **tokens = get_translations(lang, UT_SKILLS);
|
|
||||||
struct critbit_tree *cb = (critbit_tree *)*tokens;
|
|
||||||
if (cb && cb_find_prefix(cb, str, strlen(str), &match, 1, 0)) {
|
|
||||||
cb_get_kv(match, &i, sizeof(int));
|
|
||||||
result = (skill_t)i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
param_t findparam(const char *s, const struct locale * lang)
|
param_t findparam(const char *s, const struct locale * lang)
|
||||||
{
|
{
|
||||||
param_t result = NOPARAM;
|
param_t result = NOPARAM;
|
||||||
|
@ -1626,7 +1538,7 @@ int lighthouse_range(const building * b, const faction * f)
|
||||||
if (fval(b, BLD_WORKING) && b->size >= 10) {
|
if (fval(b, BLD_WORKING) && b->size >= 10) {
|
||||||
int maxd = (int)log10(b->size) + 1;
|
int maxd = (int)log10(b->size) + 1;
|
||||||
|
|
||||||
if (skill_enabled[SK_PERCEPTION]) {
|
if (skill_enabled(SK_PERCEPTION)) {
|
||||||
region *r = b->region;
|
region *r = b->region;
|
||||||
int c = 0;
|
int c = 0;
|
||||||
unit *u;
|
unit *u;
|
||||||
|
@ -1668,7 +1580,7 @@ bool check_leuchtturm(region * r, faction * f)
|
||||||
if (fval(b, BLD_WORKING) && b->size >= 10) {
|
if (fval(b, BLD_WORKING) && b->size >= 10) {
|
||||||
int maxd = (int)log10(b->size) + 1;
|
int maxd = (int)log10(b->size) + 1;
|
||||||
|
|
||||||
if (skill_enabled[SK_PERCEPTION]) {
|
if (skill_enabled(SK_PERCEPTION)) {
|
||||||
region *r2 = b->region;
|
region *r2 = b->region;
|
||||||
unit *u;
|
unit *u;
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
@ -1837,12 +1749,6 @@ static const char * parameter_key(int i)
|
||||||
return parameters[i];
|
return parameters[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char * skill_key(int sk)
|
|
||||||
{
|
|
||||||
assert(sk<MAXPARAMS && sk>=0);
|
|
||||||
return skill_enabled[sk] ? mkname("skill", skillnames[sk]) : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void init_locale(const struct locale *lang)
|
static void init_locale(const struct locale *lang)
|
||||||
{
|
{
|
||||||
variant var;
|
variant var;
|
||||||
|
@ -1884,7 +1790,6 @@ static void init_locale(const struct locale *lang)
|
||||||
}
|
}
|
||||||
|
|
||||||
init_translations(lang, UT_PARAMS, parameter_key, MAXPARAMS);
|
init_translations(lang, UT_PARAMS, parameter_key, MAXPARAMS);
|
||||||
init_translations(lang, UT_SKILLS, skill_key, MAXSKILLS);
|
|
||||||
|
|
||||||
tokens = get_translations(lang, UT_OPTIONS);
|
tokens = get_translations(lang, UT_OPTIONS);
|
||||||
for (i = 0; i != MAXOPTIONS; ++i) {
|
for (i = 0; i != MAXOPTIONS; ++i) {
|
||||||
|
|
|
@ -132,16 +132,13 @@ extern "C" {
|
||||||
/* parteinummern */
|
/* parteinummern */
|
||||||
bool faction_id_is_unused(int);
|
bool faction_id_is_unused(int);
|
||||||
|
|
||||||
|
int max_magicians(const struct faction * f);
|
||||||
/* leuchtturm */
|
/* leuchtturm */
|
||||||
bool check_leuchtturm(struct region *r, struct faction *f);
|
bool check_leuchtturm(struct region *r, struct faction *f);
|
||||||
void update_lighthouse(struct building *lh);
|
void update_lighthouse(struct building *lh);
|
||||||
int lighthouse_range(const struct building *b,
|
int lighthouse_range(const struct building *b,
|
||||||
const struct faction *f);
|
const struct faction *f);
|
||||||
|
|
||||||
/* skills */
|
|
||||||
int skill_limit(struct faction *f, skill_t sk);
|
|
||||||
int count_skill(struct faction *f, skill_t sk);
|
|
||||||
|
|
||||||
int findoption(const char *s, const struct locale *lang);
|
int findoption(const char *s, const struct locale *lang);
|
||||||
|
|
||||||
/* special units */
|
/* special units */
|
||||||
|
@ -157,8 +154,6 @@ extern "C" {
|
||||||
|
|
||||||
const char *igetstrtoken(const char *s);
|
const char *igetstrtoken(const char *s);
|
||||||
|
|
||||||
skill_t findskill(const char *s, const struct locale *lang);
|
|
||||||
|
|
||||||
param_t findparam(const char *s, const struct locale *lang);
|
param_t findparam(const char *s, const struct locale *lang);
|
||||||
param_t findparam_ex(const char *s, const struct locale * lang);
|
param_t findparam_ex(const char *s, const struct locale * lang);
|
||||||
bool isparam(const char *s, const struct locale * lang, param_t param);
|
bool isparam(const char *s, const struct locale * lang, param_t param);
|
||||||
|
@ -183,7 +178,6 @@ extern "C" {
|
||||||
int modifier);
|
int modifier);
|
||||||
bool seefaction(const struct faction *f, const struct region *r,
|
bool seefaction(const struct faction *f, const struct region *r,
|
||||||
const struct unit *u, int modifier);
|
const struct unit *u, int modifier);
|
||||||
int effskill(const struct unit *u, skill_t sk);
|
|
||||||
|
|
||||||
int lovar(double xpct_x2);
|
int lovar(double xpct_x2);
|
||||||
/* returns a value between [0..xpct_2], generated with two dice */
|
/* returns a value between [0..xpct_2], generated with two dice */
|
||||||
|
@ -402,8 +396,6 @@ extern "C" {
|
||||||
} settings;
|
} settings;
|
||||||
extern settings global;
|
extern settings global;
|
||||||
|
|
||||||
int produceexp(struct unit *u, skill_t sk, int n);
|
|
||||||
|
|
||||||
extern bool battledebug;
|
extern bool battledebug;
|
||||||
extern bool sqlpatch;
|
extern bool sqlpatch;
|
||||||
extern bool lomem; /* save memory */
|
extern bool lomem; /* save memory */
|
||||||
|
@ -418,7 +410,6 @@ extern "C" {
|
||||||
bool ExpensiveMigrants(void);
|
bool ExpensiveMigrants(void);
|
||||||
int NMRTimeout(void);
|
int NMRTimeout(void);
|
||||||
int LongHunger(const struct unit *u);
|
int LongHunger(const struct unit *u);
|
||||||
int SkillCap(skill_t sk);
|
|
||||||
int NewbieImmunity(void);
|
int NewbieImmunity(void);
|
||||||
bool IsImmune(const struct faction *f);
|
bool IsImmune(const struct faction *f);
|
||||||
int AllianceAuto(void); /* flags that allied factions get automatically */
|
int AllianceAuto(void); /* flags that allied factions get automatically */
|
||||||
|
|
|
@ -18,6 +18,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
#ifndef H_KRNL_EQUIPMENT_H
|
#ifndef H_KRNL_EQUIPMENT_H
|
||||||
#define H_KRNL_EQUIPMENT_H
|
#define H_KRNL_EQUIPMENT_H
|
||||||
|
|
||||||
|
#include "skill.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
#include <kernel/magic.h>
|
#include <kernel/magic.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/spell.h>
|
#include <kernel/spell.h>
|
||||||
|
|
||||||
#include <quicklist.h>
|
#include <quicklist.h>
|
||||||
|
@ -24,7 +23,7 @@ void test_equipment(CuTest * tc)
|
||||||
|
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
test_create_race("human");
|
test_create_race("human");
|
||||||
skill_enabled[SK_MAGIC] = 1;
|
enable_skill(SK_MAGIC, true);
|
||||||
it_horses = test_create_itemtype(names);
|
it_horses = test_create_itemtype(names);
|
||||||
CuAssertPtrNotNull(tc, it_horses);
|
CuAssertPtrNotNull(tc, it_horses);
|
||||||
sp = create_spell("testspell", 0);
|
sp = create_spell("testspell", 0);
|
||||||
|
|
|
@ -57,6 +57,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
faction *factions;
|
faction *factions;
|
||||||
|
|
||||||
|
@ -518,3 +519,68 @@ struct spellbook * faction_get_spellbook(struct faction *f)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int allied_skillcount(const faction * f, skill_t sk)
|
||||||
|
{
|
||||||
|
int num = 0;
|
||||||
|
alliance *a = f_get_alliance(f);
|
||||||
|
quicklist *members = a->members;
|
||||||
|
int qi;
|
||||||
|
|
||||||
|
for (qi = 0; members; ql_advance(&members, &qi, 1)) {
|
||||||
|
faction *m = (faction *) ql_get(members, qi);
|
||||||
|
num += count_skill(m, sk);
|
||||||
|
}
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int allied_skilllimit(const faction * f, skill_t sk)
|
||||||
|
{
|
||||||
|
static int value = -1;
|
||||||
|
if (value < 0) {
|
||||||
|
value = get_param_int(global.parameters, "alliance.skilllimit", 0);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
int count_skill(faction * f, skill_t sk)
|
||||||
|
{
|
||||||
|
int n = 0;
|
||||||
|
unit *u;
|
||||||
|
|
||||||
|
for (u = f->units; u; u = u->nextF) {
|
||||||
|
if (has_skill(u, sk)) {
|
||||||
|
if (!is_familiar(u)) {
|
||||||
|
n += u->number;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
int skill_limit(faction * f, skill_t sk)
|
||||||
|
{
|
||||||
|
int m = INT_MAX;
|
||||||
|
int al = allied_skilllimit(f, sk);
|
||||||
|
if (al > 0) {
|
||||||
|
if (sk != SK_ALCHEMY && sk != SK_MAGIC)
|
||||||
|
return INT_MAX;
|
||||||
|
if (f_get_alliance(f)) {
|
||||||
|
int ac = listlen(f->alliance->members); /* number of factions */
|
||||||
|
int fl = (al + ac - 1) / ac; /* faction limit, rounded up */
|
||||||
|
/* the faction limit may not be achievable because it would break the alliance-limit */
|
||||||
|
int sc = al - allied_skillcount(f, sk);
|
||||||
|
if (sc <= 0)
|
||||||
|
return 0;
|
||||||
|
return fl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (sk == SK_MAGIC) {
|
||||||
|
m = max_magicians(f);
|
||||||
|
} else if (sk == SK_ALCHEMY) {
|
||||||
|
m = get_param_int(global.parameters, "rules.maxskills.alchemy",
|
||||||
|
MAXALCHEMISTS);
|
||||||
|
}
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
#ifndef H_KRNL_FACTION
|
#ifndef H_KRNL_FACTION
|
||||||
#define H_KRNL_FACTION
|
#define H_KRNL_FACTION
|
||||||
|
|
||||||
|
#include "skill.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -111,6 +114,8 @@ extern "C" {
|
||||||
|
|
||||||
extern struct faction *factions;
|
extern struct faction *factions;
|
||||||
|
|
||||||
|
int max_magicians(const faction * f);
|
||||||
|
|
||||||
extern const struct unit *random_unit_in_faction(const struct faction *f);
|
extern const struct unit *random_unit_in_faction(const struct faction *f);
|
||||||
extern const char *factionname(const struct faction *f);
|
extern const char *factionname(const struct faction *f);
|
||||||
extern struct unit *addplayer(struct region *r, faction * f);
|
extern struct unit *addplayer(struct region *r, faction * f);
|
||||||
|
@ -151,6 +156,11 @@ extern "C" {
|
||||||
bool valid_race(const struct faction *f, const struct race *rc);
|
bool valid_race(const struct faction *f, const struct race *rc);
|
||||||
|
|
||||||
struct spellbook * faction_get_spellbook(struct faction *f);
|
struct spellbook * faction_get_spellbook(struct faction *f);
|
||||||
|
|
||||||
|
/* skills */
|
||||||
|
int skill_limit(struct faction *f, skill_t sk);
|
||||||
|
int count_skill(struct faction *f, skill_t sk);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -919,7 +919,7 @@ use_magicboost(struct unit *user, const struct item_type *itype, int amount,
|
||||||
user->number);
|
user->number);
|
||||||
|
|
||||||
a_add(&f->attribs, make_key(atoi36("mbst")));
|
a_add(&f->attribs, make_key(atoi36("mbst")));
|
||||||
set_level(user, sk_find("magic"), 3);
|
set_level(user, findskill("magic"), 3);
|
||||||
|
|
||||||
ADDMSG(&user->faction->msgs, msg_message("use_item",
|
ADDMSG(&user->faction->msgs, msg_message("use_item",
|
||||||
"unit item", user, itype->rtype));
|
"unit item", user, itype->rtype));
|
||||||
|
|
|
@ -20,6 +20,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#define H_KRNL_ITEM
|
#define H_KRNL_ITEM
|
||||||
|
|
||||||
#include <util/variant.h>
|
#include <util/variant.h>
|
||||||
|
#include "skill.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/magic.h>
|
#include <kernel/magic.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/spell.h>
|
#include <kernel/spell.h>
|
||||||
#include <kernel/spellbook.h>
|
#include <kernel/spellbook.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
@ -174,7 +173,7 @@ void test_getspell_unit(CuTest * tc)
|
||||||
f = test_create_faction(0);
|
f = test_create_faction(0);
|
||||||
u = test_create_unit(f, r);
|
u = test_create_unit(f, r);
|
||||||
create_mage(u, M_GRAY);
|
create_mage(u, M_GRAY);
|
||||||
skill_enabled[SK_MAGIC] = 1;
|
enable_skill(SK_MAGIC, true);
|
||||||
|
|
||||||
set_level(u, SK_MAGIC, 1);
|
set_level(u, SK_MAGIC, 1);
|
||||||
|
|
||||||
|
@ -203,7 +202,7 @@ void test_getspell_faction(CuTest * tc)
|
||||||
f->magiegebiet = M_TYBIED;
|
f->magiegebiet = M_TYBIED;
|
||||||
u = test_create_unit(f, r);
|
u = test_create_unit(f, r);
|
||||||
create_mage(u, f->magiegebiet);
|
create_mage(u, f->magiegebiet);
|
||||||
skill_enabled[SK_MAGIC] = 1;
|
enable_skill(SK_MAGIC, true);
|
||||||
|
|
||||||
set_level(u, SK_MAGIC, 1);
|
set_level(u, SK_MAGIC, 1);
|
||||||
|
|
||||||
|
@ -234,7 +233,7 @@ void test_getspell_school(CuTest * tc)
|
||||||
f->magiegebiet = M_TYBIED;
|
f->magiegebiet = M_TYBIED;
|
||||||
u = test_create_unit(f, r);
|
u = test_create_unit(f, r);
|
||||||
create_mage(u, f->magiegebiet);
|
create_mage(u, f->magiegebiet);
|
||||||
skill_enabled[SK_MAGIC] = 1;
|
enable_skill(SK_MAGIC, true);
|
||||||
set_level(u, SK_MAGIC, 1);
|
set_level(u, SK_MAGIC, 1);
|
||||||
|
|
||||||
lang = get_locale("de");
|
lang = get_locale("de");
|
||||||
|
@ -263,7 +262,7 @@ void test_set_pre_combatspell(CuTest * tc)
|
||||||
f = test_create_faction(0);
|
f = test_create_faction(0);
|
||||||
f->magiegebiet = M_TYBIED;
|
f->magiegebiet = M_TYBIED;
|
||||||
u = test_create_unit(f, r);
|
u = test_create_unit(f, r);
|
||||||
skill_enabled[SK_MAGIC] = 1;
|
enable_skill(SK_MAGIC, true);
|
||||||
set_level(u, SK_MAGIC, 1);
|
set_level(u, SK_MAGIC, 1);
|
||||||
sp = create_spell("testspell", 0);
|
sp = create_spell("testspell", 0);
|
||||||
sp->sptyp |= PRECOMBATSPELL;
|
sp->sptyp |= PRECOMBATSPELL;
|
||||||
|
@ -295,7 +294,7 @@ void test_set_main_combatspell(CuTest * tc)
|
||||||
f = test_create_faction(0);
|
f = test_create_faction(0);
|
||||||
f->magiegebiet = M_TYBIED;
|
f->magiegebiet = M_TYBIED;
|
||||||
u = test_create_unit(f, r);
|
u = test_create_unit(f, r);
|
||||||
skill_enabled[SK_MAGIC] = 1;
|
enable_skill(SK_MAGIC, true);
|
||||||
set_level(u, SK_MAGIC, 1);
|
set_level(u, SK_MAGIC, 1);
|
||||||
sp = create_spell("testspell", 0);
|
sp = create_spell("testspell", 0);
|
||||||
sp->sptyp |= COMBATSPELL;
|
sp->sptyp |= COMBATSPELL;
|
||||||
|
@ -327,7 +326,7 @@ void test_set_post_combatspell(CuTest * tc)
|
||||||
f = test_create_faction(0);
|
f = test_create_faction(0);
|
||||||
f->magiegebiet = M_TYBIED;
|
f->magiegebiet = M_TYBIED;
|
||||||
u = test_create_unit(f, r);
|
u = test_create_unit(f, r);
|
||||||
skill_enabled[SK_MAGIC] = 1;
|
enable_skill(SK_MAGIC, true);
|
||||||
set_level(u, SK_MAGIC, 1);
|
set_level(u, SK_MAGIC, 1);
|
||||||
sp = create_spell("testspell", 0);
|
sp = create_spell("testspell", 0);
|
||||||
sp->sptyp |= POSTCOMBATSPELL;
|
sp->sptyp |= POSTCOMBATSPELL;
|
||||||
|
@ -358,7 +357,7 @@ void test_hasspell(CuTest * tc)
|
||||||
f = test_create_faction(0);
|
f = test_create_faction(0);
|
||||||
f->magiegebiet = M_TYBIED;
|
f->magiegebiet = M_TYBIED;
|
||||||
u = test_create_unit(f, r);
|
u = test_create_unit(f, r);
|
||||||
skill_enabled[SK_MAGIC] = 1;
|
enable_skill(SK_MAGIC, true);
|
||||||
sp = create_spell("testspell", 0);
|
sp = create_spell("testspell", 0);
|
||||||
sp->sptyp |= POSTCOMBATSPELL;
|
sp->sptyp |= POSTCOMBATSPELL;
|
||||||
|
|
||||||
|
|
|
@ -192,7 +192,7 @@ static order_data *create_data(keyword_t kwd, const char *sptr, int lindex)
|
||||||
|
|
||||||
/* learning, only one order_data per skill required */
|
/* learning, only one order_data per skill required */
|
||||||
if (kwd == K_STUDY) {
|
if (kwd == K_STUDY) {
|
||||||
skill_t sk = findskill(parse_token(&sptr), lang);
|
skill_t sk = get_skill(parse_token(&sptr), lang);
|
||||||
switch (sk) {
|
switch (sk) {
|
||||||
case NOSKILL: /* fehler */
|
case NOSKILL: /* fehler */
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -21,7 +21,7 @@ void test_change_resource(CuTest * tc)
|
||||||
|
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
test_create_world();
|
test_create_world();
|
||||||
skill_enabled[SK_MAGIC] = 1;
|
enable_skill(SK_MAGIC, true);
|
||||||
|
|
||||||
r = findregion(0, 0);
|
r = findregion(0, 0);
|
||||||
f = test_create_faction(0);
|
f = test_create_faction(0);
|
||||||
|
|
|
@ -23,6 +23,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "magic.h" /* wegen MAXMAGIETYP */
|
#include "magic.h" /* wegen MAXMAGIETYP */
|
||||||
|
#include "skill.h"
|
||||||
|
|
||||||
#define AT_NONE 0
|
#define AT_NONE 0
|
||||||
#define AT_STANDARD 1
|
#define AT_STANDARD 1
|
||||||
|
|
|
@ -36,7 +36,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/resources.h>
|
#include <kernel/resources.h>
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/spell.h>
|
#include <kernel/spell.h>
|
||||||
#include <kernel/spellbook.h>
|
#include <kernel/spellbook.h>
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
|
|
|
@ -664,7 +664,7 @@ unit *read_unit(struct gamedata *data)
|
||||||
} else {
|
} else {
|
||||||
READ_TOK(data->store, rname, sizeof(rname));
|
READ_TOK(data->store, rname, sizeof(rname));
|
||||||
}
|
}
|
||||||
if (rname[0] && skill_enabled[SK_STEALTH])
|
if (rname[0] && skill_enabled(SK_STEALTH))
|
||||||
u->irace = rc_find(rname);
|
u->irace = rc_find(rname);
|
||||||
else
|
else
|
||||||
u->irace = NULL;
|
u->irace = NULL;
|
||||||
|
|
|
@ -41,76 +41,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
const char *skillnames[MAXSKILLS] = {
|
|
||||||
"alchemy",
|
|
||||||
"crossbow",
|
|
||||||
"mining",
|
|
||||||
"bow",
|
|
||||||
"building",
|
|
||||||
"trade",
|
|
||||||
"forestry",
|
|
||||||
"catapult",
|
|
||||||
"herbalism",
|
|
||||||
"magic",
|
|
||||||
"training",
|
|
||||||
"riding",
|
|
||||||
"armorer",
|
|
||||||
"shipcraft",
|
|
||||||
"melee",
|
|
||||||
"sailing",
|
|
||||||
"polearm",
|
|
||||||
"espionage",
|
|
||||||
"quarrying",
|
|
||||||
"roadwork",
|
|
||||||
"tactics",
|
|
||||||
"stealth",
|
|
||||||
"entertainment",
|
|
||||||
"weaponsmithing",
|
|
||||||
"cartmaking",
|
|
||||||
"perception",
|
|
||||||
"taxation",
|
|
||||||
"stamina",
|
|
||||||
"unarmed"
|
|
||||||
};
|
|
||||||
|
|
||||||
bool skill_enabled[MAXSKILLS];
|
|
||||||
|
|
||||||
const char *skillname(skill_t sk, const struct locale *lang)
|
|
||||||
{
|
|
||||||
if (skill_enabled[sk]) {
|
|
||||||
return locale_string(lang, mkname("skill", skillnames[sk]));
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void enable_skill(const char *skname, bool value)
|
|
||||||
{
|
|
||||||
skill_t sk;
|
|
||||||
for (sk = 0; sk != MAXSKILLS; ++sk) {
|
|
||||||
if (strcmp(skillnames[sk], skname) == 0) {
|
|
||||||
skill_enabled[sk] = value;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
log_error("Trying to set unknown skill %s to %u", skname, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
skill_t sk_find(const char *name)
|
|
||||||
{
|
|
||||||
skill_t i;
|
|
||||||
if (name == NULL)
|
|
||||||
return NOSKILL;
|
|
||||||
if (strncmp(name, "sk_", 3) == 0)
|
|
||||||
name += 3;
|
|
||||||
for (i = 0; i != MAXSKILLS; ++i) {
|
|
||||||
if (skill_enabled[i]) {
|
|
||||||
if (strcmp(name, skillnames[i]) == 0)
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NOSKILL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** skillmod attribut **/
|
/** skillmod attribut **/
|
||||||
static void init_skillmod(attrib * a)
|
static void init_skillmod(attrib * a)
|
||||||
{
|
{
|
||||||
|
@ -223,7 +153,7 @@ int rc_skillmod(const struct race *rc, const region * r, skill_t sk)
|
||||||
{
|
{
|
||||||
int mods = 0;
|
int mods = 0;
|
||||||
|
|
||||||
if (!skill_enabled[sk]) {
|
if (!skill_enabled(sk)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#ifdef FASTER_SKILLMOD
|
#ifdef FASTER_SKILLMOD
|
|
@ -12,6 +12,9 @@
|
||||||
|
|
||||||
#ifndef H_KRNL_SKILL
|
#ifndef H_KRNL_SKILL
|
||||||
#define H_KRNL_SKILL
|
#define H_KRNL_SKILL
|
||||||
|
|
||||||
|
#include <skill.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -46,9 +49,6 @@ extern "C" {
|
||||||
extern struct attrib *make_skillmod(skill_t sk, unsigned int flags,
|
extern struct attrib *make_skillmod(skill_t sk, unsigned int flags,
|
||||||
skillmod_fun special, double multiplier, int bonus);
|
skillmod_fun special, double multiplier, int bonus);
|
||||||
|
|
||||||
extern const char *skillname(skill_t, const struct locale *);
|
|
||||||
extern skill_t sk_find(const char *name);
|
|
||||||
extern void enable_skill(const char *name, bool value);
|
|
||||||
extern int level_days(int level);
|
extern int level_days(int level);
|
||||||
extern int level(int days);
|
extern int level(int days);
|
||||||
|
|
||||||
|
@ -59,9 +59,6 @@ extern "C" {
|
||||||
|
|
||||||
extern void sk_set(skill * sv, int level);
|
extern void sk_set(skill * sv, int level);
|
||||||
|
|
||||||
extern const char *skillnames[];
|
|
||||||
extern bool skill_enabled[];
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
|
@ -186,42 +186,6 @@ enum {
|
||||||
MAXOPTIONS
|
MAXOPTIONS
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ------------------ Talente ---------------------------------- */
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
SK_ALCHEMY,
|
|
||||||
SK_CROSSBOW,
|
|
||||||
SK_MINING,
|
|
||||||
SK_LONGBOW,
|
|
||||||
SK_BUILDING,
|
|
||||||
SK_TRADE,
|
|
||||||
SK_LUMBERJACK,
|
|
||||||
SK_CATAPULT,
|
|
||||||
SK_HERBALISM,
|
|
||||||
SK_MAGIC,
|
|
||||||
SK_HORSE_TRAINING, /* 10 */
|
|
||||||
SK_RIDING,
|
|
||||||
SK_ARMORER,
|
|
||||||
SK_SHIPBUILDING,
|
|
||||||
SK_MELEE,
|
|
||||||
SK_SAILING,
|
|
||||||
SK_SPEAR,
|
|
||||||
SK_SPY,
|
|
||||||
SK_QUARRYING,
|
|
||||||
SK_ROAD_BUILDING,
|
|
||||||
SK_TACTICS, /* 20 */
|
|
||||||
SK_STEALTH,
|
|
||||||
SK_ENTERTAINMENT,
|
|
||||||
SK_WEAPONSMITH,
|
|
||||||
SK_CARTMAKER,
|
|
||||||
SK_PERCEPTION,
|
|
||||||
SK_TAXING,
|
|
||||||
SK_STAMINA,
|
|
||||||
SK_WEAPONLESS,
|
|
||||||
MAXSKILLS,
|
|
||||||
NOSKILL = -1
|
|
||||||
} skill_t;
|
|
||||||
|
|
||||||
/* ------------- Typ von Einheiten ----------------------------- */
|
/* ------------- Typ von Einheiten ----------------------------- */
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
|
@ -679,7 +679,7 @@ attrib_type at_stealth = {
|
||||||
|
|
||||||
void u_seteffstealth(unit * u, int value)
|
void u_seteffstealth(unit * u, int value)
|
||||||
{
|
{
|
||||||
if (skill_enabled[SK_STEALTH]) {
|
if (skill_enabled(SK_STEALTH)) {
|
||||||
attrib *a = NULL;
|
attrib *a = NULL;
|
||||||
if (fval(u, UFL_STEALTH)) {
|
if (fval(u, UFL_STEALTH)) {
|
||||||
a = a_find(u->attribs, &at_stealth);
|
a = a_find(u->attribs, &at_stealth);
|
||||||
|
@ -701,7 +701,7 @@ void u_seteffstealth(unit * u, int value)
|
||||||
|
|
||||||
int u_geteffstealth(const struct unit *u)
|
int u_geteffstealth(const struct unit *u)
|
||||||
{
|
{
|
||||||
if (skill_enabled[SK_STEALTH]) {
|
if (skill_enabled(SK_STEALTH)) {
|
||||||
if (fval(u, UFL_STEALTH)) {
|
if (fval(u, UFL_STEALTH)) {
|
||||||
attrib *a = a_find(u->attribs, &at_stealth);
|
attrib *a = a_find(u->attribs, &at_stealth);
|
||||||
if (a != NULL)
|
if (a != NULL)
|
||||||
|
@ -713,7 +713,7 @@ int u_geteffstealth(const struct unit *u)
|
||||||
|
|
||||||
int get_level(const unit * u, skill_t id)
|
int get_level(const unit * u, skill_t id)
|
||||||
{
|
{
|
||||||
if (skill_enabled[id]) {
|
if (skill_enabled(id)) {
|
||||||
skill *sv = u->skills;
|
skill *sv = u->skills;
|
||||||
while (sv != u->skills + u->skill_size) {
|
while (sv != u->skills + u->skill_size) {
|
||||||
if (sv->id == id) {
|
if (sv->id == id) {
|
||||||
|
@ -729,7 +729,7 @@ void set_level(unit * u, skill_t sk, int value)
|
||||||
{
|
{
|
||||||
skill *sv = u->skills;
|
skill *sv = u->skills;
|
||||||
|
|
||||||
if (!skill_enabled[sk])
|
if (!skill_enabled(sk))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (value == 0) {
|
if (value == 0) {
|
||||||
|
@ -939,8 +939,8 @@ void transfermen(unit * u, unit * u2, int n)
|
||||||
for (sk = 0; sk != MAXSKILLS; ++sk) {
|
for (sk = 0; sk != MAXSKILLS; ++sk) {
|
||||||
int weeks, level = 0;
|
int weeks, level = 0;
|
||||||
|
|
||||||
sv = get_skill(u, sk);
|
sv = unit_skill(u, sk);
|
||||||
sn = get_skill(u2, sk);
|
sn = unit_skill(u2, sk);
|
||||||
|
|
||||||
if (sv == NULL && sn == NULL)
|
if (sv == NULL && sn == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1185,7 +1185,7 @@ skill *add_skill(unit * u, skill_t id)
|
||||||
return sv;
|
return sv;
|
||||||
}
|
}
|
||||||
|
|
||||||
skill *get_skill(const unit * u, skill_t sk)
|
skill *unit_skill(const unit * u, skill_t sk)
|
||||||
{
|
{
|
||||||
skill *sv = u->skills;
|
skill *sv = u->skills;
|
||||||
while (sv != u->skills + u->skill_size) {
|
while (sv != u->skills + u->skill_size) {
|
||||||
|
@ -1326,7 +1326,7 @@ get_modifier(const unit * u, skill_t sk, int level, const region * r,
|
||||||
|
|
||||||
int eff_skill(const unit * u, skill_t sk, const region * r)
|
int eff_skill(const unit * u, skill_t sk, const region * r)
|
||||||
{
|
{
|
||||||
if (skill_enabled[sk]) {
|
if (skill_enabled(sk)) {
|
||||||
int level = get_level(u, sk);
|
int level = get_level(u, sk);
|
||||||
if (level > 0) {
|
if (level > 0) {
|
||||||
int mlevel = level + get_modifier(u, sk, level, r, false);
|
int mlevel = level + get_modifier(u, sk, level, r, false);
|
||||||
|
@ -1740,7 +1740,7 @@ void scale_number(unit * u, int n)
|
||||||
|
|
||||||
const struct race *u_irace(const struct unit *u)
|
const struct race *u_irace(const struct unit *u)
|
||||||
{
|
{
|
||||||
if (u->irace && skill_enabled[SK_STEALTH]) {
|
if (u->irace && skill_enabled(SK_STEALTH)) {
|
||||||
return u->irace;
|
return u->irace;
|
||||||
}
|
}
|
||||||
return u->race_;
|
return u->race_;
|
||||||
|
@ -1784,3 +1784,9 @@ struct spellbook * unit_get_spellbook(const struct unit * u)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int effskill(const unit * u, skill_t sk)
|
||||||
|
{
|
||||||
|
return eff_skill(u, sk, u->region);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
#include <util/variant.h>
|
#include <util/variant.h>
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
#include "skills.h"
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -155,11 +155,14 @@ extern "C" {
|
||||||
struct unit *findnewunit(const struct region *r, const struct faction *f,
|
struct unit *findnewunit(const struct region *r, const struct faction *f,
|
||||||
int alias);
|
int alias);
|
||||||
|
|
||||||
extern const char *u_description(const unit * u, const struct locale *lang);
|
const char *u_description(const unit * u, const struct locale *lang);
|
||||||
extern struct skill *add_skill(struct unit *u, skill_t id);
|
struct skill *add_skill(struct unit *u, skill_t id);
|
||||||
extern void remove_skill(struct unit *u, skill_t sk);
|
void remove_skill(struct unit *u, skill_t sk);
|
||||||
extern struct skill *get_skill(const struct unit *u, skill_t id);
|
struct skill *unit_skill(const struct unit *u, skill_t id);
|
||||||
extern bool has_skill(const unit * u, skill_t sk);
|
bool has_skill(const unit * u, skill_t sk);
|
||||||
|
int effskill(const struct unit *u, skill_t sk);
|
||||||
|
int produceexp(struct unit *u, skill_t sk, int n);
|
||||||
|
int SkillCap(skill_t sk);
|
||||||
|
|
||||||
extern void set_level(struct unit *u, skill_t id, int level);
|
extern void set_level(struct unit *u, skill_t id, int level);
|
||||||
extern int get_level(const struct unit *u, skill_t id);
|
extern int get_level(const struct unit *u, skill_t id);
|
||||||
|
|
|
@ -24,7 +24,7 @@ without prior permission by the authors of Eressea.
|
||||||
#include "resources.h"
|
#include "resources.h"
|
||||||
#include "ship.h"
|
#include "ship.h"
|
||||||
#include "terrain.h"
|
#include "terrain.h"
|
||||||
#include "skill.h"
|
#include "skills.h"
|
||||||
#include "spell.h"
|
#include "spell.h"
|
||||||
#include "spellbook.h"
|
#include "spellbook.h"
|
||||||
#include "calendar.h"
|
#include "calendar.h"
|
||||||
|
@ -164,7 +164,7 @@ xml_readconstruction(xmlXPathContextPtr xpath, xmlNodeSetPtr nodeSet,
|
||||||
|
|
||||||
propValue = xmlGetProp(node, BAD_CAST "skill");
|
propValue = xmlGetProp(node, BAD_CAST "skill");
|
||||||
if (propValue != NULL) {
|
if (propValue != NULL) {
|
||||||
sk = sk_find((const char *)propValue);
|
sk = findskill((const char *)propValue);
|
||||||
if (sk == NOSKILL) {
|
if (sk == NOSKILL) {
|
||||||
log_error("construction requires skill '%s' that does not exist.\n", (const char *)propValue);
|
log_error("construction requires skill '%s' that does not exist.\n", (const char *)propValue);
|
||||||
xmlFree(propValue);
|
xmlFree(propValue);
|
||||||
|
@ -698,7 +698,7 @@ static weapon_type *xml_readweapon(xmlXPathContextPtr xpath, item_type * itype)
|
||||||
|
|
||||||
propValue = xmlGetProp(node, BAD_CAST "skill");
|
propValue = xmlGetProp(node, BAD_CAST "skill");
|
||||||
assert(propValue != NULL);
|
assert(propValue != NULL);
|
||||||
sk = sk_find((const char *)propValue);
|
sk = findskill((const char *)propValue);
|
||||||
assert(sk != NOSKILL);
|
assert(sk != NOSKILL);
|
||||||
xmlFree(propValue);
|
xmlFree(propValue);
|
||||||
|
|
||||||
|
@ -1295,7 +1295,7 @@ static void add_skills(equipment * eq, xmlNodeSetPtr nsetSkills)
|
||||||
|
|
||||||
propValue = xmlGetProp(node, BAD_CAST "name");
|
propValue = xmlGetProp(node, BAD_CAST "name");
|
||||||
assert(propValue != NULL);
|
assert(propValue != NULL);
|
||||||
sk = sk_find((const char *)propValue);
|
sk = findskill((const char *)propValue);
|
||||||
if (sk == NOSKILL) {
|
if (sk == NOSKILL) {
|
||||||
log_error("unknown skill '%s' in equipment-set %s\n", (const char *)propValue, eq->name);
|
log_error("unknown skill '%s' in equipment-set %s\n", (const char *)propValue, eq->name);
|
||||||
xmlFree(propValue);
|
xmlFree(propValue);
|
||||||
|
@ -1819,7 +1819,7 @@ static int parse_races(xmlDocPtr doc)
|
||||||
|
|
||||||
propValue = xmlGetProp(node, BAD_CAST "name");
|
propValue = xmlGetProp(node, BAD_CAST "name");
|
||||||
assert(propValue != NULL);
|
assert(propValue != NULL);
|
||||||
sk = sk_find((const char *)propValue);
|
sk = findskill((const char *)propValue);
|
||||||
if (sk != NOSKILL) {
|
if (sk != NOSKILL) {
|
||||||
rc->bonus[sk] = (char)mod;
|
rc->bonus[sk] = (char)mod;
|
||||||
if (speed) {
|
if (speed) {
|
||||||
|
@ -2324,8 +2324,11 @@ static int parse_main(xmlDocPtr doc)
|
||||||
for (i = 0; i != nodes->nodeNr; ++i) {
|
for (i = 0; i != nodes->nodeNr; ++i) {
|
||||||
xmlNodePtr node = nodes->nodeTab[i];
|
xmlNodePtr node = nodes->nodeTab[i];
|
||||||
xmlChar *propName = xmlGetProp(node, BAD_CAST "name");
|
xmlChar *propName = xmlGetProp(node, BAD_CAST "name");
|
||||||
|
skill_t sk = findskill((const char *)propName);
|
||||||
|
if (sk!=NOSKILL) {
|
||||||
bool enable = xml_bvalue(node, "enable", true);
|
bool enable = xml_bvalue(node, "enable", true);
|
||||||
enable_skill((const char *)propName, enable);
|
enable_skill(sk, enable);
|
||||||
|
}
|
||||||
xmlFree(propName);
|
xmlFree(propName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,10 @@ void init_keyword(const struct locale *lang, keyword_t kwd, const char *str) {
|
||||||
add_translation(cb, str, (int)kwd);
|
add_translation(cb, str, (int)kwd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void init_keywords(const struct locale *lang) {
|
||||||
|
init_translations(lang, UT_KEYWORDS, keyword_key, MAXKEYWORDS);
|
||||||
|
}
|
||||||
|
|
||||||
keyword_t findkeyword(const char *s) {
|
keyword_t findkeyword(const char *s) {
|
||||||
int i;
|
int i;
|
||||||
for (i=0;i!=MAXKEYWORDS;++i) {
|
for (i=0;i!=MAXKEYWORDS;++i) {
|
||||||
|
@ -32,11 +36,6 @@ keyword_t findkeyword(const char *s) {
|
||||||
return NOKEYWORD;
|
return NOKEYWORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void init_keywords(const struct locale *lang) {
|
|
||||||
init_translations(lang, UT_KEYWORDS, keyword_key, MAXKEYWORDS);
|
|
||||||
}
|
|
||||||
|
|
||||||
keyword_t get_keyword(const char *s, const struct locale *lang) {
|
keyword_t get_keyword(const char *s, const struct locale *lang) {
|
||||||
keyword_t result = NOKEYWORD;
|
keyword_t result = NOKEYWORD;
|
||||||
char buffer[64];
|
char buffer[64];
|
||||||
|
|
|
@ -54,7 +54,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/resources.h>
|
#include <kernel/resources.h>
|
||||||
#include <kernel/save.h>
|
#include <kernel/save.h>
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/spell.h>
|
#include <kernel/spell.h>
|
||||||
#include <kernel/spellbook.h>
|
#include <kernel/spellbook.h>
|
||||||
#include <kernel/teleport.h>
|
#include <kernel/teleport.h>
|
||||||
|
|
|
@ -41,7 +41,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/reports.h>
|
#include <kernel/reports.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/terrainid.h>
|
#include <kernel/terrainid.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
|
@ -206,7 +206,7 @@ static int tagbegin(xml_stack * stack)
|
||||||
} else {
|
} else {
|
||||||
dungeon *d = (dungeon *) stack->state;
|
dungeon *d = (dungeon *) stack->state;
|
||||||
if (strcmp(tag->name, "skilllimit") == 0) {
|
if (strcmp(tag->name, "skilllimit") == 0) {
|
||||||
skill_t sk = sk_find(xml_value(tag, "name"));
|
skill_t sk = findskill(xml_value(tag, "name"));
|
||||||
if (sk != NOSKILL) {
|
if (sk != NOSKILL) {
|
||||||
skilllimit *skl = calloc(sizeof(skilllimit), 1);
|
skilllimit *skl = calloc(sizeof(skilllimit), 1);
|
||||||
skl->skill = sk;
|
skl->skill = sk;
|
||||||
|
|
|
@ -30,7 +30,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
#include <kernel/pool.h>
|
#include <kernel/pool.h>
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/reports.h>
|
#include <kernel/reports.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/terrainid.h>
|
#include <kernel/terrainid.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
|
@ -48,7 +48,6 @@
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/reports.h>
|
#include <kernel/reports.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/terrainid.h>
|
#include <kernel/terrainid.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
@ -729,7 +728,7 @@ static order *plan_dragon(unit * u)
|
||||||
if (long_order == NULL) {
|
if (long_order == NULL) {
|
||||||
skill_t sk = SK_PERCEPTION;
|
skill_t sk = SK_PERCEPTION;
|
||||||
/* study perception (or a random useful skill) */
|
/* study perception (or a random useful skill) */
|
||||||
while (!skill_enabled[sk] || u_race(u)->bonus[sk] < -5) {
|
while (!skill_enabled(sk) || u_race(u)->bonus[sk] < -5) {
|
||||||
sk = (skill_t) (rng_int() % MAXSKILLS);
|
sk = (skill_t) (rng_int() % MAXSKILLS);
|
||||||
}
|
}
|
||||||
long_order = create_order(K_STUDY, u->faction->locale, "'%s'",
|
long_order = create_order(K_STUDY, u->faction->locale, "'%s'",
|
||||||
|
@ -768,7 +767,7 @@ void plan_monsters(faction * f)
|
||||||
setstatus(u, ST_FIGHT);
|
setstatus(u, ST_FIGHT);
|
||||||
/* all monsters fight */
|
/* all monsters fight */
|
||||||
}
|
}
|
||||||
if (skill_enabled[SK_PERCEPTION]) {
|
if (skill_enabled(SK_PERCEPTION)) {
|
||||||
/* Monster bekommen jede Runde ein paar Tage Wahrnehmung dazu */
|
/* Monster bekommen jede Runde ein paar Tage Wahrnehmung dazu */
|
||||||
/* TODO: this only works for playerrace */
|
/* TODO: this only works for playerrace */
|
||||||
produceexp(u, SK_PERCEPTION, u->number);
|
produceexp(u, SK_PERCEPTION, u->number);
|
||||||
|
|
|
@ -41,7 +41,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/terrainid.h>
|
#include <kernel/terrainid.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
|
@ -60,7 +60,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/resources.h>
|
#include <kernel/resources.h>
|
||||||
#include <kernel/save.h>
|
#include <kernel/save.h>
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/spell.h>
|
#include <kernel/spell.h>
|
||||||
#include <kernel/spellbook.h>
|
#include <kernel/spellbook.h>
|
||||||
#include <kernel/teleport.h>
|
#include <kernel/teleport.h>
|
||||||
|
@ -1292,7 +1291,7 @@ static void statistics(FILE * F, const region * r, const faction * f)
|
||||||
rnl(F);
|
rnl(F);
|
||||||
|
|
||||||
/* Region */
|
/* Region */
|
||||||
if (skill_enabled[SK_ENTERTAINMENT] && fval(r->terrain, LAND_REGION)
|
if (skill_enabled(SK_ENTERTAINMENT) && fval(r->terrain, LAND_REGION)
|
||||||
&& rmoney(r)) {
|
&& rmoney(r)) {
|
||||||
m = msg_message("nr_stat_maxentertainment", "max", entertainmoney(r));
|
m = msg_message("nr_stat_maxentertainment", "max", entertainmoney(r));
|
||||||
nr_render(m, f->locale, buf, sizeof(buf), f);
|
nr_render(m, f->locale, buf, sizeof(buf), f);
|
||||||
|
|
109
src/skill.c
Normal file
109
src/skill.c
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
#include <platform.h>
|
||||||
|
#include <kernel/config.h>
|
||||||
|
#include "skill.h"
|
||||||
|
|
||||||
|
#include <util/umlaut.h>
|
||||||
|
#include <util/language.h>
|
||||||
|
#include <util/log.h>
|
||||||
|
#include <critbit.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
const char *skillnames[MAXSKILLS] = {
|
||||||
|
"alchemy",
|
||||||
|
"crossbow",
|
||||||
|
"mining",
|
||||||
|
"bow",
|
||||||
|
"building",
|
||||||
|
"trade",
|
||||||
|
"forestry",
|
||||||
|
"catapult",
|
||||||
|
"herbalism",
|
||||||
|
"magic",
|
||||||
|
"training",
|
||||||
|
"riding",
|
||||||
|
"armorer",
|
||||||
|
"shipcraft",
|
||||||
|
"melee",
|
||||||
|
"sailing",
|
||||||
|
"polearm",
|
||||||
|
"espionage",
|
||||||
|
"quarrying",
|
||||||
|
"roadwork",
|
||||||
|
"tactics",
|
||||||
|
"stealth",
|
||||||
|
"entertainment",
|
||||||
|
"weaponsmithing",
|
||||||
|
"cartmaking",
|
||||||
|
"perception",
|
||||||
|
"taxation",
|
||||||
|
"stamina",
|
||||||
|
"unarmed"
|
||||||
|
};
|
||||||
|
|
||||||
|
bool skill_disabled[MAXSKILLS];
|
||||||
|
|
||||||
|
bool skill_enabled(skill_t sk) {
|
||||||
|
return !skill_disabled[sk];
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char * skill_key(int sk) {
|
||||||
|
assert(sk<MAXPARAMS && sk>=0);
|
||||||
|
return skill_disabled[sk] ? 0 : mkname("skill", skillnames[sk]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void init_skill(const struct locale *lang, skill_t kwd, const char *str) {
|
||||||
|
void **tokens = get_translations(lang, UT_SKILLS);
|
||||||
|
struct critbit_tree **cb = (critbit_tree **)tokens;
|
||||||
|
add_translation(cb, str, (int)kwd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void init_skills(const struct locale *lang) {
|
||||||
|
init_translations(lang, UT_SKILLS, skill_key, MAXSKILLS);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *skillname(skill_t sk, const struct locale *lang)
|
||||||
|
{
|
||||||
|
if (skill_disabled[sk]) return 0;
|
||||||
|
return locale_string(lang, mkname("skill", skillnames[sk]));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void enable_skill(skill_t sk, bool value)
|
||||||
|
{
|
||||||
|
skill_disabled[sk] = !value;
|
||||||
|
}
|
||||||
|
|
||||||
|
skill_t findskill(const char *name)
|
||||||
|
{
|
||||||
|
skill_t i;
|
||||||
|
if (name == NULL) return NOSKILL;
|
||||||
|
if (strncmp(name, "sk_", 3) == 0) name += 3;
|
||||||
|
for (i = 0; i != MAXSKILLS; ++i) {
|
||||||
|
if (!skill_disabled[i] && strcmp(name, skillnames[i]) == 0) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NOSKILL;
|
||||||
|
}
|
||||||
|
|
||||||
|
skill_t get_skill(const char *s, const struct locale * lang)
|
||||||
|
{
|
||||||
|
param_t result = NOSKILL;
|
||||||
|
char buffer[64];
|
||||||
|
char * str = transliterate(buffer, sizeof(buffer)-sizeof(int), s);
|
||||||
|
|
||||||
|
if (str) {
|
||||||
|
int i;
|
||||||
|
const void * match;
|
||||||
|
void **tokens = get_translations(lang, UT_SKILLS);
|
||||||
|
struct critbit_tree *cb = (critbit_tree *)*tokens;
|
||||||
|
if (cb && cb_find_prefix(cb, str, strlen(str), &match, 1, 0)) {
|
||||||
|
cb_get_kv(match, &i, sizeof(int));
|
||||||
|
result = (skill_t)i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
50
src/skill.h
Normal file
50
src/skill.h
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
#ifndef H_SKILL_H
|
||||||
|
#define H_SKILL_H
|
||||||
|
|
||||||
|
struct locale;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SK_ALCHEMY,
|
||||||
|
SK_CROSSBOW,
|
||||||
|
SK_MINING,
|
||||||
|
SK_LONGBOW,
|
||||||
|
SK_BUILDING,
|
||||||
|
SK_TRADE,
|
||||||
|
SK_LUMBERJACK,
|
||||||
|
SK_CATAPULT,
|
||||||
|
SK_HERBALISM,
|
||||||
|
SK_MAGIC,
|
||||||
|
SK_HORSE_TRAINING, /* 10 */
|
||||||
|
SK_RIDING,
|
||||||
|
SK_ARMORER,
|
||||||
|
SK_SHIPBUILDING,
|
||||||
|
SK_MELEE,
|
||||||
|
SK_SAILING,
|
||||||
|
SK_SPEAR,
|
||||||
|
SK_SPY,
|
||||||
|
SK_QUARRYING,
|
||||||
|
SK_ROAD_BUILDING,
|
||||||
|
SK_TACTICS, /* 20 */
|
||||||
|
SK_STEALTH,
|
||||||
|
SK_ENTERTAINMENT,
|
||||||
|
SK_WEAPONSMITH,
|
||||||
|
SK_CARTMAKER,
|
||||||
|
SK_PERCEPTION,
|
||||||
|
SK_TAXING,
|
||||||
|
SK_STAMINA,
|
||||||
|
SK_WEAPONLESS,
|
||||||
|
MAXSKILLS,
|
||||||
|
NOSKILL = -1
|
||||||
|
} skill_t;
|
||||||
|
|
||||||
|
extern const char *skillnames[];
|
||||||
|
|
||||||
|
skill_t get_skill(const char *s, const struct locale *lang);
|
||||||
|
const char *skillname(skill_t, const struct locale *);
|
||||||
|
skill_t findskill(const char *name);
|
||||||
|
void init_skills(const struct locale *lang);
|
||||||
|
void init_skill(const struct locale *lang, skill_t kwd, const char *str);
|
||||||
|
void enable_skill(skill_t sk, bool enabled);
|
||||||
|
bool skill_enabled(skill_t sk);
|
||||||
|
|
||||||
|
#endif
|
59
src/skill.test.c
Normal file
59
src/skill.test.c
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
#include <platform.h>
|
||||||
|
#include "kernel/types.h"
|
||||||
|
#include "skill.h"
|
||||||
|
#include "util/language.h"
|
||||||
|
#include "tests.h"
|
||||||
|
|
||||||
|
#include <CuTest.h>
|
||||||
|
|
||||||
|
static void test_init_skills(CuTest *tc) {
|
||||||
|
struct locale *lang;
|
||||||
|
|
||||||
|
test_cleanup();
|
||||||
|
lang = get_or_create_locale("de");
|
||||||
|
locale_setstring(lang, "alchemy", "Alchemie");
|
||||||
|
init_skills(lang);
|
||||||
|
CuAssertIntEquals(tc, SK_ALCHEMY, get_skill("alchemie", lang));
|
||||||
|
test_cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_init_skill(CuTest *tc) {
|
||||||
|
struct locale *lang;
|
||||||
|
test_cleanup();
|
||||||
|
|
||||||
|
lang = get_or_create_locale("de");
|
||||||
|
init_skill(lang, SK_ALCHEMY, "Alchemie");
|
||||||
|
CuAssertIntEquals(tc, SK_ALCHEMY, get_skill("alchemie", lang));
|
||||||
|
CuAssertIntEquals(tc, NOSKILL, get_skill("east", lang));
|
||||||
|
test_cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_get_skill(CuTest *tc) {
|
||||||
|
test_cleanup();
|
||||||
|
CuAssertIntEquals(tc, SK_ALCHEMY, findskill("alchemy"));
|
||||||
|
CuAssertIntEquals(tc, SK_CROSSBOW, findskill("crossbow"));
|
||||||
|
CuAssertIntEquals(tc, NOSKILL, findskill(""));
|
||||||
|
CuAssertIntEquals(tc, NOSKILL, findskill("potato"));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_get_skill_default(CuTest *tc) {
|
||||||
|
struct locale *lang;
|
||||||
|
test_cleanup();
|
||||||
|
lang = get_or_create_locale("en");
|
||||||
|
CuAssertIntEquals(tc, NOSKILL, get_skill("potato", lang));
|
||||||
|
CuAssertIntEquals(tc, SK_ALCHEMY, get_skill("alchemy", lang));
|
||||||
|
CuAssertIntEquals(tc, SK_CROSSBOW, get_skill("crossbow", lang));
|
||||||
|
}
|
||||||
|
|
||||||
|
#define SUITE_DISABLE_TEST(suite, test) (void)test
|
||||||
|
|
||||||
|
CuSuite *get_skill_suite(void)
|
||||||
|
{
|
||||||
|
CuSuite *suite = CuSuiteNew();
|
||||||
|
SUITE_ADD_TEST(suite, test_init_skill);
|
||||||
|
SUITE_ADD_TEST(suite, test_init_skills);
|
||||||
|
SUITE_ADD_TEST(suite, test_get_skill);
|
||||||
|
SUITE_DISABLE_TEST(suite, test_get_skill_default);
|
||||||
|
return suite;
|
||||||
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
||||||
/* util includes */
|
/* util includes */
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include <kernel/spell.h>
|
#include <kernel/spell.h>
|
||||||
#include <kernel/spellid.h>
|
#include <kernel/spellid.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
|
|
||||||
/* util includes */
|
/* util includes */
|
||||||
|
@ -596,7 +595,7 @@ int sp_mindblast(struct castorder * co)
|
||||||
if (!is_magic_resistant(mage, du, 0)) {
|
if (!is_magic_resistant(mage, du, 0)) {
|
||||||
skill_t sk = random_skill(du, false);
|
skill_t sk = random_skill(du, false);
|
||||||
if (sk != NOSKILL) {
|
if (sk != NOSKILL) {
|
||||||
skill *sv = get_skill(du, sk);
|
skill *sv = unit_skill(du, sk);
|
||||||
int n = 1 + rng_int() % 3;
|
int n = 1 + rng_int() % 3;
|
||||||
|
|
||||||
reduce_skill(du, sv, n);
|
reduce_skill(du, sv, n);
|
||||||
|
|
|
@ -46,7 +46,6 @@
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/save.h>
|
#include <kernel/save.h>
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/spell.h>
|
#include <kernel/spell.h>
|
||||||
#include <kernel/teleport.h>
|
#include <kernel/teleport.h>
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
|
@ -562,12 +561,12 @@ static int sp_summon_familiar(castorder * co)
|
||||||
dh = 0;
|
dh = 0;
|
||||||
dh1 = 0;
|
dh1 = 0;
|
||||||
for (sk = 0; sk < MAXSKILLS; ++sk) {
|
for (sk = 0; sk < MAXSKILLS; ++sk) {
|
||||||
if (skill_enabled[sk] && rc->bonus[sk] > -5)
|
if (skill_enabled(sk) && rc->bonus[sk] > -5)
|
||||||
dh++;
|
dh++;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (sk = 0; sk < MAXSKILLS; sk++) {
|
for (sk = 0; sk < MAXSKILLS; sk++) {
|
||||||
if (skill_enabled[sk] && rc->bonus[sk] > -5) {
|
if (skill_enabled(sk) && rc->bonus[sk] > -5) {
|
||||||
dh--;
|
dh--;
|
||||||
if (dh1 == 0) {
|
if (dh1 == 0) {
|
||||||
dh1 = 1;
|
dh1 = 1;
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
#include <kernel/curse.h>
|
#include <kernel/curse.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
#include <kernel/objtypes.h>
|
#include <kernel/objtypes.h>
|
||||||
|
|
|
@ -32,7 +32,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/pool.h>
|
#include <kernel/pool.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
||||||
|
@ -60,7 +59,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
static skill_t getskill(const struct locale *lang)
|
static skill_t getskill(const struct locale *lang)
|
||||||
{
|
{
|
||||||
return findskill(getstrtoken(), lang);
|
return get_skill(getstrtoken(), lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
magic_t getmagicskill(const struct locale * lang)
|
magic_t getmagicskill(const struct locale * lang)
|
||||||
|
@ -163,7 +162,7 @@ static int study_days(unit * student, skill_t sk)
|
||||||
if (u_race(student)->study_speed) {
|
if (u_race(student)->study_speed) {
|
||||||
speed += u_race(student)->study_speed[sk];
|
speed += u_race(student)->study_speed[sk];
|
||||||
if (speed < 30) {
|
if (speed < 30) {
|
||||||
skill *sv = get_skill(student, sk);
|
skill *sv = unit_skill(student, sk);
|
||||||
if (sv == 0) {
|
if (sv == 0) {
|
||||||
speed = 30;
|
speed = 30;
|
||||||
}
|
}
|
||||||
|
@ -566,7 +565,7 @@ int learn_cmd(unit * u, order * ord)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (learn_newskills == 0) {
|
if (learn_newskills == 0) {
|
||||||
skill *sv = get_skill(u, sk);
|
skill *sv = unit_skill(u, sk);
|
||||||
if (sv == NULL) {
|
if (sv == NULL) {
|
||||||
/* we can only learn skills we already have */
|
/* we can only learn skills we already have */
|
||||||
cmistake(u, ord, 771, MSG_EVENT);
|
cmistake(u, ord, 771, MSG_EVENT);
|
||||||
|
|
|
@ -19,6 +19,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#ifndef H_KRNL_STUDY
|
#ifndef H_KRNL_STUDY
|
||||||
#define H_KRNL_STUDY
|
#define H_KRNL_STUDY
|
||||||
|
|
||||||
|
#include "skill.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/reports.h>
|
#include <kernel/reports.h>
|
||||||
#include <kernel/save.h>
|
#include <kernel/save.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/terrainid.h>
|
#include <kernel/terrainid.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
|
@ -26,6 +26,7 @@ CuSuite *get_functions_suite(void);
|
||||||
CuSuite *get_umlaut_suite(void);
|
CuSuite *get_umlaut_suite(void);
|
||||||
CuSuite *get_ally_suite(void);
|
CuSuite *get_ally_suite(void);
|
||||||
CuSuite *get_direction_suite(void);
|
CuSuite *get_direction_suite(void);
|
||||||
|
CuSuite *get_skill_suite(void);
|
||||||
CuSuite *get_keyword_suite(void);
|
CuSuite *get_keyword_suite(void);
|
||||||
|
|
||||||
int RunAllTests(void)
|
int RunAllTests(void)
|
||||||
|
@ -41,6 +42,7 @@ int RunAllTests(void)
|
||||||
CuSuiteAddSuite(suite, get_json_suite());
|
CuSuiteAddSuite(suite, get_json_suite());
|
||||||
CuSuiteAddSuite(suite, get_jsonconf_suite());
|
CuSuiteAddSuite(suite, get_jsonconf_suite());
|
||||||
CuSuiteAddSuite(suite, get_direction_suite());
|
CuSuiteAddSuite(suite, get_direction_suite());
|
||||||
|
CuSuiteAddSuite(suite, get_skill_suite());
|
||||||
CuSuiteAddSuite(suite, get_keyword_suite());
|
CuSuiteAddSuite(suite, get_keyword_suite());
|
||||||
/* util */
|
/* util */
|
||||||
CuSuiteAddSuite(suite, get_base36_suite());
|
CuSuiteAddSuite(suite, get_base36_suite());
|
||||||
|
|
|
@ -25,7 +25,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
#include <kernel/magic.h>
|
#include <kernel/magic.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/skill.h>
|
|
||||||
#include <kernel/spell.h>
|
#include <kernel/spell.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue