forked from github/server
comparisons to boolean constants are dumb.
This commit is contained in:
parent
d4d39b43e9
commit
f2598e8bdc
60
src/main.c
60
src/main.c
|
@ -184,60 +184,6 @@ void init_crtdbg(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void dump_spells(void)
|
|
||||||
{
|
|
||||||
struct locale *loc = find_locale("de");
|
|
||||||
FILE *F = fopen("spells.csv", "w");
|
|
||||||
quicklist *ql;
|
|
||||||
int qi;
|
|
||||||
|
|
||||||
for (ql = spells, qi = 0; ql; ql_advance(&ql, &qi, 1)) {
|
|
||||||
spell *sp = (spell *) ql_get(ql, qi);
|
|
||||||
spell_component *spc = sp->components;
|
|
||||||
char components[128];
|
|
||||||
components[0] = 0;
|
|
||||||
for (; spc->type; ++spc) {
|
|
||||||
strcat(components, LOC(loc, spc->type->_name[0]));
|
|
||||||
strcat(components, ",");
|
|
||||||
}
|
|
||||||
fprintf(F, "%s;%d;%s;%s\n", LOC(loc, mkname("spell", sp->sname)), sp->level,
|
|
||||||
LOC(loc, mkname("school", magic_school[sp->magietyp])), components);
|
|
||||||
}
|
|
||||||
fclose(F);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dump_skills(void)
|
|
||||||
{
|
|
||||||
struct locale *loc = find_locale("de");
|
|
||||||
FILE *F = fopen("skills.csv", "w");
|
|
||||||
race *rc;
|
|
||||||
skill_t sk;
|
|
||||||
fputs("\"Rasse\",", F);
|
|
||||||
for (rc = races; rc; rc = rc->next) {
|
|
||||||
if (playerrace(rc)) {
|
|
||||||
fprintf(F, "\"%s\",", LOC(loc, mkname("race", rc->_name[0])));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fputc('\n', F);
|
|
||||||
|
|
||||||
for (sk = 0; sk != MAXSKILLS; ++sk) {
|
|
||||||
const char *str = skillname(sk, loc);
|
|
||||||
if (str) {
|
|
||||||
fprintf(F, "\"%s\",", str);
|
|
||||||
for (rc = races; rc; rc = rc->next) {
|
|
||||||
if (playerrace(rc)) {
|
|
||||||
if (rc->bonus[sk])
|
|
||||||
fprintf(F, "%d,", rc->bonus[sk]);
|
|
||||||
else
|
|
||||||
fputc(',', F);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fputc('\n', F);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fclose(F);
|
|
||||||
}
|
|
||||||
|
|
||||||
void locale_init(void)
|
void locale_init(void)
|
||||||
{
|
{
|
||||||
setlocale(LC_CTYPE, "");
|
setlocale(LC_CTYPE, "");
|
||||||
|
@ -252,7 +198,6 @@ extern void bind_eressea(struct lua_State *L);
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
static int write_csv = 0;
|
|
||||||
int err, result = 0;
|
int err, result = 0;
|
||||||
|
|
||||||
setup_signal_handler();
|
setup_signal_handler();
|
||||||
|
@ -281,11 +226,6 @@ int main(int argc, char **argv)
|
||||||
register_spells();
|
register_spells();
|
||||||
bind_eressea((struct lua_State *)global.vm_state);
|
bind_eressea((struct lua_State *)global.vm_state);
|
||||||
|
|
||||||
if (write_csv) {
|
|
||||||
dump_skills();
|
|
||||||
dump_spells();
|
|
||||||
}
|
|
||||||
|
|
||||||
err = eressea_run(luafile, entry_point);
|
err = eressea_run(luafile, entry_point);
|
||||||
if (err) {
|
if (err) {
|
||||||
log_error("server execution failed with code %d\n", err);
|
log_error("server execution failed with code %d\n", err);
|
||||||
|
|
|
@ -196,7 +196,7 @@ int sp_petrify(struct castorder * co)
|
||||||
while (force && stoned < enemies) {
|
while (force && stoned < enemies) {
|
||||||
troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
|
troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE);
|
||||||
unit *du = dt.fighter->unit;
|
unit *du = dt.fighter->unit;
|
||||||
if (is_magic_resistant(mage, du, 0) == false) {
|
if (!is_magic_resistant(mage, du, 0)) {
|
||||||
/* person ans ende hinter die lebenden schieben */
|
/* person ans ende hinter die lebenden schieben */
|
||||||
remove_troop(dt);
|
remove_troop(dt);
|
||||||
++stoned;
|
++stoned;
|
||||||
|
@ -253,7 +253,7 @@ int sp_stun(struct castorder * co)
|
||||||
unit *du = df->unit;
|
unit *du = df->unit;
|
||||||
|
|
||||||
--force;
|
--force;
|
||||||
if (is_magic_resistant(mage, du, 0) == false) {
|
if (!is_magic_resistant(mage, du, 0)) {
|
||||||
df->person[dt.index].flags |= FL_STUNNED;
|
df->person[dt.index].flags |= FL_STUNNED;
|
||||||
++stunned;
|
++stunned;
|
||||||
}
|
}
|
||||||
|
@ -1071,7 +1071,7 @@ int sp_flee(struct castorder * co)
|
||||||
++panik;
|
++panik;
|
||||||
} else if (!(df->person[n].flags & FL_COURAGE)
|
} else if (!(df->person[n].flags & FL_COURAGE)
|
||||||
|| !fval(df->unit->race, RCF_UNDEAD)) {
|
|| !fval(df->unit->race, RCF_UNDEAD)) {
|
||||||
if (is_magic_resistant(mage, df->unit, 0) == false) {
|
if (!is_magic_resistant(mage, df->unit, 0)) {
|
||||||
df->person[n].flags |= FL_PANICED;
|
df->person[n].flags |= FL_PANICED;
|
||||||
++panik;
|
++panik;
|
||||||
}
|
}
|
||||||
|
@ -1241,7 +1241,7 @@ int sp_frighten(struct castorder * co)
|
||||||
if (df->person[dt.index].flags & FL_COURAGE) {
|
if (df->person[dt.index].flags & FL_COURAGE) {
|
||||||
df->person[dt.index].flags &= ~(FL_COURAGE);
|
df->person[dt.index].flags &= ~(FL_COURAGE);
|
||||||
}
|
}
|
||||||
if (is_magic_resistant(mage, df->unit, 0) == false) {
|
if (!is_magic_resistant(mage, df->unit, 0)) {
|
||||||
df->person[dt.index].attack -= at_malus;
|
df->person[dt.index].attack -= at_malus;
|
||||||
df->person[dt.index].defence -= df_malus;
|
df->person[dt.index].defence -= df_malus;
|
||||||
targets++;
|
targets++;
|
||||||
|
@ -1287,7 +1287,7 @@ int sp_tiredsoldiers(struct castorder * co)
|
||||||
|
|
||||||
assert(!helping(fi->side, df->side));
|
assert(!helping(fi->side, df->side));
|
||||||
if (!(df->person[t.index].flags & FL_TIRED)) {
|
if (!(df->person[t.index].flags & FL_TIRED)) {
|
||||||
if (is_magic_resistant(mage, df->unit, 0) == false) {
|
if (!is_magic_resistant(mage, df->unit, 0)) {
|
||||||
df->person[t.index].flags = df->person[t.index].flags | FL_TIRED;
|
df->person[t.index].flags = df->person[t.index].flags | FL_TIRED;
|
||||||
df->person[t.index].defence -= 2;
|
df->person[t.index].defence -= 2;
|
||||||
++n;
|
++n;
|
||||||
|
|
|
@ -3135,7 +3135,7 @@ static int sp_magicboost(castorder * co)
|
||||||
assert(ct_magicboost != NULL);
|
assert(ct_magicboost != NULL);
|
||||||
}
|
}
|
||||||
/* fehler, wenn schon ein boost */
|
/* fehler, wenn schon ein boost */
|
||||||
if (is_cursed(mage->attribs, C_MBOOST, 0) == true) {
|
if (is_cursed(mage->attribs, C_MBOOST, 0)) {
|
||||||
report_failure(mage, co->order);
|
report_failure(mage, co->order);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -4047,13 +4047,13 @@ static int sp_pump(castorder * co)
|
||||||
see = true;
|
see = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (see == false) {
|
if (see) {
|
||||||
|
ADDMSG(&mage->faction->msgs, msg_message("pump_effect", "mage unit tregion",
|
||||||
|
mage, target, rt));
|
||||||
|
} else {
|
||||||
ADDMSG(&mage->faction->msgs, msg_feedback(mage, co->order, "spellfail_pump",
|
ADDMSG(&mage->faction->msgs, msg_feedback(mage, co->order, "spellfail_pump",
|
||||||
"target tregion", target, rt));
|
"target tregion", target, rt));
|
||||||
return cast_level / 2;
|
return cast_level / 2;
|
||||||
} else {
|
|
||||||
ADDMSG(&mage->faction->msgs, msg_message("pump_effect", "mage unit tregion",
|
|
||||||
mage, target, rt));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u =
|
u =
|
||||||
|
@ -6487,7 +6487,6 @@ static spelldata spell_functions[] = {
|
||||||
{ "treewalkexit", sp_treewalkexit, 0},
|
{ "treewalkexit", sp_treewalkexit, 0},
|
||||||
{ "holyground", sp_holyground, 0},
|
{ "holyground", sp_holyground, 0},
|
||||||
{ "summonent", sp_summonent, 0},
|
{ "summonent", sp_summonent, 0},
|
||||||
{ "gwyrrdfamiliar", sp_summon_familiar, 0},
|
|
||||||
{ "blessstonecircle", sp_blessstonecircle, 0},
|
{ "blessstonecircle", sp_blessstonecircle, 0},
|
||||||
{ "barkskin", sp_armorshield, 0},
|
{ "barkskin", sp_armorshield, 0},
|
||||||
{ "summonfireelemental", sp_drought, 0},
|
{ "summonfireelemental", sp_drought, 0},
|
||||||
|
@ -6516,7 +6515,6 @@ static spelldata spell_functions[] = {
|
||||||
{ "deathcloud", sp_deathcloud, patzer_peasantmob},
|
{ "deathcloud", sp_deathcloud, patzer_peasantmob},
|
||||||
{ "summondragon", sp_summondragon, patzer_peasantmob},
|
{ "summondragon", sp_summondragon, patzer_peasantmob},
|
||||||
{ "summonshadowlords", sp_summonshadowlords, patzer_peasantmob},
|
{ "summonshadowlords", sp_summonshadowlords, patzer_peasantmob},
|
||||||
{ "draigfamiliar", sp_summon_familiar, 0},
|
|
||||||
{ "chaossuction", sp_chaossuction, patzer_peasantmob},
|
{ "chaossuction", sp_chaossuction, patzer_peasantmob},
|
||||||
/* M_ILLAUN */
|
/* M_ILLAUN */
|
||||||
{ "sparkledream", sp_sparkle, 0},
|
{ "sparkledream", sp_sparkle, 0},
|
||||||
|
@ -6535,7 +6533,6 @@ static spelldata spell_functions[] = {
|
||||||
{ "wisps", 0, 0}, /* this spell is gone */
|
{ "wisps", 0, 0}, /* this spell is gone */
|
||||||
{ "gooddreams", sp_gooddreams, 0},
|
{ "gooddreams", sp_gooddreams, 0},
|
||||||
{ "illaundestroymagic", sp_destroy_magic, 0},
|
{ "illaundestroymagic", sp_destroy_magic, 0},
|
||||||
{ "illaunfamiliar", sp_summon_familiar, 0},
|
|
||||||
{ "clone", sp_clonecopy, 0},
|
{ "clone", sp_clonecopy, 0},
|
||||||
{ "bad_dreams", sp_baddreams, 0},
|
{ "bad_dreams", sp_baddreams, 0},
|
||||||
{ "mindblast", sp_mindblast_temp, 0},
|
{ "mindblast", sp_mindblast_temp, 0},
|
||||||
|
@ -6598,7 +6595,6 @@ static spelldata spell_functions[] = {
|
||||||
{ "view_reality", sp_viewreality, 0},
|
{ "view_reality", sp_viewreality, 0},
|
||||||
{ "double_time", sp_speed2, 0},
|
{ "double_time", sp_speed2, 0},
|
||||||
{ "armor_shield", sp_armorshield, 0},
|
{ "armor_shield", sp_armorshield, 0},
|
||||||
{ "summon_familiar", sp_summon_familiar, 0},
|
|
||||||
{ "living_rock", sp_movecastle, 0},
|
{ "living_rock", sp_movecastle, 0},
|
||||||
{ "astral_disruption", sp_disruptastral, 0},
|
{ "astral_disruption", sp_disruptastral, 0},
|
||||||
{ "sacrifice_strength", sp_permtransfer, 0},
|
{ "sacrifice_strength", sp_permtransfer, 0},
|
||||||
|
|
Loading…
Reference in New Issue