forked from github/server
death to static caches!
This commit is contained in:
parent
257d5c18bb
commit
2d1a13a811
|
@ -862,11 +862,9 @@ struct order *ord)
|
|||
else {
|
||||
const race *irace = u_irace(u);
|
||||
if (irace == u_race(u)) {
|
||||
static const race *rcfailure;
|
||||
const race *rcfailure = rc_find("smurf");
|
||||
if (!rcfailure) {
|
||||
rcfailure = rc_find("smurf");
|
||||
if (!rcfailure)
|
||||
rcfailure = rc_find("toad");
|
||||
rcfailure = rc_find("toad");
|
||||
}
|
||||
if (rcfailure) {
|
||||
trigger *trestore = trigger_changerace(u, u_race(u), irace);
|
||||
|
|
|
@ -1389,15 +1389,12 @@ void default_name(const unit *u, char name[], int len) {
|
|||
const char * result;
|
||||
const struct locale * lang = u->faction ? u->faction->locale : default_locale;
|
||||
if (lang) {
|
||||
static const char * prefix[MAXLOCALES];
|
||||
int i = locale_index(lang);
|
||||
/*if (!prefix[i]) {*/
|
||||
prefix[i] = LOC(lang, "unitdefault");
|
||||
if (!prefix[i]) {
|
||||
prefix[i] = parameters[P_UNIT];
|
||||
const char * prefix;
|
||||
prefix = LOC(lang, "unitdefault");
|
||||
if (!prefix) {
|
||||
prefix= parameters[P_UNIT];
|
||||
}
|
||||
/*}*/
|
||||
result = prefix[i];
|
||||
result = prefix;
|
||||
}
|
||||
else {
|
||||
result = parameters[P_UNIT];
|
||||
|
|
27
src/upkeep.c
27
src/upkeep.c
|
@ -58,27 +58,28 @@ static void help_feed(unit * donor, unit * u, int *need_p)
|
|||
*need_p = need;
|
||||
}
|
||||
|
||||
static const char *hunger_damage(const race *rc) {
|
||||
const char * damage = get_param(rc->parameters, "hunger.damage");
|
||||
if (!damage) {
|
||||
damage = config_get("hunger.damage");
|
||||
}
|
||||
if (!damage) {
|
||||
damage = "1d12+12";
|
||||
}
|
||||
return damage;
|
||||
}
|
||||
|
||||
static bool hunger(int number, unit * u)
|
||||
{
|
||||
region *r = u->region;
|
||||
int dead = 0, hpsub = 0;
|
||||
int hp = u->hp / u->number;
|
||||
static const char *damage = 0;
|
||||
static const char *rcdamage = 0;
|
||||
static const race *rc = 0;
|
||||
const char *damage = 0;
|
||||
|
||||
if (!damage) {
|
||||
damage = config_get("hunger.damage");
|
||||
if (damage == NULL)
|
||||
damage = "1d12+12";
|
||||
}
|
||||
if (rc != u_race(u)) {
|
||||
rcdamage = get_param(u_race(u)->parameters, "hunger.damage");
|
||||
rc = u_race(u);
|
||||
}
|
||||
damage = hunger_damage(u_race(u));
|
||||
|
||||
while (number--) {
|
||||
int dam = dice_rand(rcdamage ? rcdamage : damage);
|
||||
int dam = dice_rand(damage);
|
||||
if (dam >= hp) {
|
||||
++dead;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
*/
|
||||
double normalvariate(double mu, double sigma)
|
||||
{
|
||||
static const double NV_MAGICCONST = 1.7155277699214135; /* STATIC_CONST: a constant */
|
||||
static const double NV_MAGICCONST = 1.7155277699214135;
|
||||
double z;
|
||||
for (;;) {
|
||||
double u1 = rng_double();
|
||||
|
|
|
@ -117,7 +117,7 @@ char * transliterate(char * out, size_t size, const char * in)
|
|||
void addtoken(void ** root, const char *str, variant id)
|
||||
{
|
||||
tnode * tk;
|
||||
static const struct replace { /* STATIC_CONST: constant value */
|
||||
static const struct replace {
|
||||
ucs4_t ucs;
|
||||
const char str[3];
|
||||
} replace[] = {
|
||||
|
|
Loading…
Reference in New Issue