available help statuses can be masked by XML settings

This commit is contained in:
Enno Rehling 2009-05-16 13:43:42 +00:00
parent 43bf73a01b
commit 418f611dcb
5 changed files with 27 additions and 7 deletions

View File

@ -1242,6 +1242,8 @@ ally_cmd(unit * u, struct order * ord)
break;
}
sf->status &= HelpMask();
if (sf->status == 0) { /* Alle HELPs geloescht */
removelist(sfp, sf);
}

View File

@ -12,6 +12,8 @@
* prior permission by the authors of Eressea.
*/
#pragma region includes
#include <config.h>
#include <kernel/eressea.h>
#include "battle.h"
@ -67,6 +69,8 @@
#include <string.h>
#include <sys/stat.h>
#pragma endregion
static FILE *bdebug;
#define TACTICS_BONUS 1 /* when undefined, we have a tactics round. else this is the bonus tactics give */

View File

@ -132,16 +132,16 @@ MaxAge(void) {
return value;
}
static int
ally_flag(const char * s)
{
if (strcmp(s, "money")==0) return HELP_MONEY;
if (strcmp(s, "fight")==0) return HELP_FIGHT;
if (strcmp(s, "give")==0) return HELP_GIVE;
if (strcmp(s, "guard")==0) return HELP_GUARD;
if (strcmp(s, "stealth")==0) return HELP_FSTEALTH;
if (strcmp(s, "travel")==0) return HELP_TRAVEL;
int help_mask = HelpMask();
if ((help_mask&HELP_MONEY) && strcmp(s, "money")==0) return HELP_MONEY;
if ((help_mask&HELP_FIGHT) && strcmp(s, "fight")==0) return HELP_FIGHT;
if ((help_mask&HELP_GIVE) && strcmp(s, "give")==0) return HELP_GIVE;
if ((help_mask&HELP_GUARD) && strcmp(s, "guard")==0) return HELP_GUARD;
if ((help_mask&HELP_FSTEALTH) && strcmp(s, "stealth")==0) return HELP_FSTEALTH;
if ((help_mask&HELP_TRAVEL) && strcmp(s, "travel")==0) return HELP_TRAVEL;
return 0;
}
@ -175,6 +175,17 @@ AllianceAuto(void)
return value;
}
int
HelpMask(void)
{
static int help_mask = 0;
if (help_mask==0) {
help_mask = get_param_int(global.parameters, "rules.help.mask", HELP_ALL);
}
return help_mask;
}
int
AllianceRestricted(void)
{

View File

@ -400,6 +400,8 @@ extern int SkillCap(skill_t sk);
extern int NewbieImmunity(void);
extern int AllianceAuto(void); /* flags that allied factions get automatically */
extern int AllianceRestricted(void); /* flags restricted to allied factions */
extern int HelpMask(void); /* flags restricted to allied factions */
extern int HelpMask(void); /* flags restricted to allied factions */
extern struct order * default_order(const struct locale * lang);
extern int entertainmoney(const struct region * r);

View File

@ -1096,6 +1096,7 @@ addally(const faction * f, ally ** sfp, int aid, int state)
#ifndef REGIONOWNERS
state &= ~HELP_TRAVEL;
#endif
state &= HelpMask();
if (state==0) return sfp;