forked from github/server
Merge pull request #638 from ennorehling/develop
disable config.lua auto-laod
This commit is contained in:
commit
9cea70afe8
|
@ -95,6 +95,7 @@ function test_force_leave_postcombat()
|
||||||
u1.building = b1
|
u1.building = b1
|
||||||
u2.building = b1
|
u2.building = b1
|
||||||
eressea.settings.set("rules.owners.force_leave", "1")
|
eressea.settings.set("rules.owners.force_leave", "1")
|
||||||
|
eressea.settings.set("NewbieImmunity", "0")
|
||||||
u1:clear_orders()
|
u1:clear_orders()
|
||||||
u1:add_order("ATTACKIERE " .. itoa36(u2.id))
|
u1:add_order("ATTACKIERE " .. itoa36(u2.id))
|
||||||
u2:clear_orders()
|
u2:clear_orders()
|
||||||
|
@ -109,6 +110,7 @@ function test_force_leave_postcombat()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
assert_not_equal(nil, u3)
|
assert_not_equal(nil, u3)
|
||||||
|
assert_equal(nil, u2.building)
|
||||||
assert_equal(nil, u3.building)
|
assert_equal(nil, u3.building)
|
||||||
assert_equal(1, u3.number)
|
assert_equal(1, u3.number)
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,6 +8,8 @@ function setup()
|
||||||
eressea.settings.set("rules.grow.formula", "0")
|
eressea.settings.set("rules.grow.formula", "0")
|
||||||
eressea.settings.set("rules.peasants.growth.factor", "0")
|
eressea.settings.set("rules.peasants.growth.factor", "0")
|
||||||
eressea.settings.set("volcano.active.percent", "0")
|
eressea.settings.set("volcano.active.percent", "0")
|
||||||
|
eressea.settings.set("volcano.outbreak.percent", "0")
|
||||||
|
eressea.settings.set("volcano.stop.percent", "0")
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_snowglobe_fail()
|
function test_snowglobe_fail()
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
#include <kernel/jsonconf.h>
|
#include <kernel/jsonconf.h>
|
||||||
#include <util/bsdstring.h>
|
#include <util/bsdstring.h>
|
||||||
|
#include <util/nrmessage.h>
|
||||||
#include <util/log.h>
|
#include <util/log.h>
|
||||||
#include <util/language.h>
|
#include <util/language.h>
|
||||||
#include <cJSON.h>
|
#include <cJSON.h>
|
||||||
|
@ -20,7 +21,9 @@
|
||||||
|
|
||||||
void config_reset(void) {
|
void config_reset(void) {
|
||||||
default_locale = 0;
|
default_locale = 0;
|
||||||
|
free_config();
|
||||||
free_locales();
|
free_locales();
|
||||||
|
free_nrmesssages();
|
||||||
free_spells();
|
free_spells();
|
||||||
free_buildingtypes();
|
free_buildingtypes();
|
||||||
free_shiptypes();
|
free_shiptypes();
|
||||||
|
|
|
@ -1190,7 +1190,7 @@ int eressea_run(lua_State *L, const char *luafile)
|
||||||
lua_remove(L, -2);
|
lua_remove(L, -2);
|
||||||
|
|
||||||
/* try to run configuration scripts: */
|
/* try to run configuration scripts: */
|
||||||
err = run_script(L, "config.lua");
|
// err = run_script(L, "config.lua");
|
||||||
err = run_script(L, "custom.lua");
|
err = run_script(L, "custom.lua");
|
||||||
|
|
||||||
/* run the main script */
|
/* run the main script */
|
||||||
|
|
|
@ -119,7 +119,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
int NewbieImmunity(void)
|
int NewbieImmunity(void)
|
||||||
{
|
{
|
||||||
return config_get_int("NewbieImmunity", 0);
|
int result = config_get_int("NewbieImmunity", 0);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsImmune(const faction * f)
|
bool IsImmune(const faction * f)
|
||||||
|
|
|
@ -178,3 +178,16 @@ const char *nrt_section(const nrmessage_type * nrt)
|
||||||
{
|
{
|
||||||
return nrt ? nrt->section : NULL;
|
return nrt ? nrt->section : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void free_nrmesssages(void) {
|
||||||
|
int i;
|
||||||
|
for (i = 0; i != NRT_MAXHASH; ++i) {
|
||||||
|
while (nrtypes[i]) {
|
||||||
|
nrmessage_type *nr = nrtypes[i];
|
||||||
|
nrtypes[i] = nr->next;
|
||||||
|
free(nr->string);
|
||||||
|
free(nr->vars);
|
||||||
|
free(nr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -31,18 +31,20 @@ extern "C" {
|
||||||
|
|
||||||
extern nrsection *sections;
|
extern nrsection *sections;
|
||||||
|
|
||||||
extern void nrt_register(const struct message_type *mtype,
|
void free_nrmesssages(void);
|
||||||
|
|
||||||
|
void nrt_register(const struct message_type *mtype,
|
||||||
const struct locale *lang, const char *script,
|
const struct locale *lang, const char *script,
|
||||||
int level, const char *section);
|
int level, const char *section);
|
||||||
extern struct nrmessage_type *nrt_find(const struct locale *,
|
struct nrmessage_type *nrt_find(const struct locale *,
|
||||||
const struct message_type *);
|
const struct message_type *);
|
||||||
extern const char *nrt_string(const struct nrmessage_type *type);
|
const char *nrt_string(const struct nrmessage_type *type);
|
||||||
extern const char *nrt_section(const struct nrmessage_type *mt);
|
const char *nrt_section(const struct nrmessage_type *mt);
|
||||||
|
|
||||||
extern size_t nr_render(const struct message *msg, const struct locale *lang,
|
size_t nr_render(const struct message *msg, const struct locale *lang,
|
||||||
char *buffer, size_t size, const void *userdata);
|
char *buffer, size_t size, const void *userdata);
|
||||||
extern int nr_level(const struct message *msg);
|
int nr_level(const struct message *msg);
|
||||||
extern const char *nr_section(const struct message *msg);
|
const char *nr_section(const struct message *msg);
|
||||||
|
|
||||||
/* before:
|
/* before:
|
||||||
* fogblock;movement:0;de;{unit} konnte von {region} nicht nach {$dir direction} ausreisen, der Nebel war zu dicht.
|
* fogblock;movement:0;de;{unit} konnte von {region} nicht nach {$dir direction} ausreisen, der Nebel war zu dicht.
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
typedef struct nrmessage_type {
|
typedef struct nrmessage_type {
|
||||||
const struct message_type *mtype;
|
const struct message_type *mtype;
|
||||||
const struct locale *lang;
|
const struct locale *lang;
|
||||||
const char *string;
|
char *string;
|
||||||
const char *vars;
|
char *vars;
|
||||||
struct nrmessage_type *next;
|
struct nrmessage_type *next;
|
||||||
int level;
|
int level;
|
||||||
const char *section;
|
const char *section;
|
||||||
|
|
|
@ -256,11 +256,19 @@ void volcano_outbreak(region * r, region *rn)
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool stop_smoke_chance(void) {
|
static bool stop_smoke_chance(void) {
|
||||||
return rng_int() % 100 < 12;
|
static int cache, percent = 0;
|
||||||
|
if (config_changed(&cache)) {
|
||||||
|
percent = config_get_int("volcano.stop.percent", 12);
|
||||||
|
}
|
||||||
|
return percent!=0 && (rng_int() % 100) < percent;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool outbreak_chance(void) {
|
static bool outbreak_chance(void) {
|
||||||
return rng_int() % 100 < 8;
|
static int cache, percent = 0;
|
||||||
|
if (config_changed(&cache)) {
|
||||||
|
percent = config_get_int("volcano.outbreak.percent", 8);
|
||||||
|
}
|
||||||
|
return percent!=0 && (rng_int() % 100) < percent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void volcano_update(void)
|
void volcano_update(void)
|
||||||
|
|
Loading…
Reference in New Issue