forked from github/server
available help statuses can be masked by XML settings
This commit is contained in:
parent
43bf73a01b
commit
418f611dcb
5 changed files with 27 additions and 7 deletions
|
@ -1242,6 +1242,8 @@ ally_cmd(unit * u, struct order * ord)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sf->status &= HelpMask();
|
||||||
|
|
||||||
if (sf->status == 0) { /* Alle HELPs geloescht */
|
if (sf->status == 0) { /* Alle HELPs geloescht */
|
||||||
removelist(sfp, sf);
|
removelist(sfp, sf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
* prior permission by the authors of Eressea.
|
* prior permission by the authors of Eressea.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#pragma region includes
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <kernel/eressea.h>
|
#include <kernel/eressea.h>
|
||||||
#include "battle.h"
|
#include "battle.h"
|
||||||
|
@ -67,6 +69,8 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#pragma endregion
|
||||||
|
|
||||||
static FILE *bdebug;
|
static FILE *bdebug;
|
||||||
|
|
||||||
#define TACTICS_BONUS 1 /* when undefined, we have a tactics round. else this is the bonus tactics give */
|
#define TACTICS_BONUS 1 /* when undefined, we have a tactics round. else this is the bonus tactics give */
|
||||||
|
|
|
@ -132,16 +132,16 @@ MaxAge(void) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ally_flag(const char * s)
|
ally_flag(const char * s)
|
||||||
{
|
{
|
||||||
if (strcmp(s, "money")==0) return HELP_MONEY;
|
int help_mask = HelpMask();
|
||||||
if (strcmp(s, "fight")==0) return HELP_FIGHT;
|
if ((help_mask&HELP_MONEY) && strcmp(s, "money")==0) return HELP_MONEY;
|
||||||
if (strcmp(s, "give")==0) return HELP_GIVE;
|
if ((help_mask&HELP_FIGHT) && strcmp(s, "fight")==0) return HELP_FIGHT;
|
||||||
if (strcmp(s, "guard")==0) return HELP_GUARD;
|
if ((help_mask&HELP_GIVE) && strcmp(s, "give")==0) return HELP_GIVE;
|
||||||
if (strcmp(s, "stealth")==0) return HELP_FSTEALTH;
|
if ((help_mask&HELP_GUARD) && strcmp(s, "guard")==0) return HELP_GUARD;
|
||||||
if (strcmp(s, "travel")==0) return HELP_TRAVEL;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,6 +175,17 @@ AllianceAuto(void)
|
||||||
return value;
|
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
|
int
|
||||||
AllianceRestricted(void)
|
AllianceRestricted(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -400,6 +400,8 @@ extern int SkillCap(skill_t sk);
|
||||||
extern int NewbieImmunity(void);
|
extern int NewbieImmunity(void);
|
||||||
extern int AllianceAuto(void); /* flags that allied factions get automatically */
|
extern int AllianceAuto(void); /* flags that allied factions get automatically */
|
||||||
extern int AllianceRestricted(void); /* flags restricted to allied factions */
|
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 struct order * default_order(const struct locale * lang);
|
||||||
extern int entertainmoney(const struct region * r);
|
extern int entertainmoney(const struct region * r);
|
||||||
|
|
||||||
|
|
|
@ -1096,6 +1096,7 @@ addally(const faction * f, ally ** sfp, int aid, int state)
|
||||||
#ifndef REGIONOWNERS
|
#ifndef REGIONOWNERS
|
||||||
state &= ~HELP_TRAVEL;
|
state &= ~HELP_TRAVEL;
|
||||||
#endif
|
#endif
|
||||||
|
state &= HelpMask();
|
||||||
|
|
||||||
if (state==0) return sfp;
|
if (state==0) return sfp;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue