forked from github/server
commit
fb39835cf0
|
@ -1,4 +1,6 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
ROOT=$(pwd)
|
||||
while [ ! -d $ROOT/.git ]; do
|
||||
ROOT=$(dirname $ROOT)
|
||||
|
|
|
@ -61,6 +61,7 @@ end
|
|||
|
||||
function test_give_divisor()
|
||||
eressea.settings.set("rules.items.give_divisor", 2)
|
||||
eressea.settings.set("GiveRestriction", 0)
|
||||
local r = region.create(1, 1, "plain")
|
||||
local f1 = faction.create("test@example.com", "human", "de")
|
||||
local f2 = faction.create("test@example.com", "human", "de")
|
||||
|
|
|
@ -57,12 +57,7 @@ static int max_transfers(void) {
|
|||
|
||||
static int GiveRestriction(void)
|
||||
{
|
||||
static int value = -1;
|
||||
if (value < 0) {
|
||||
const char *str = get_param(global.parameters, "GiveRestriction");
|
||||
value = str ? atoi(str) : 0;
|
||||
}
|
||||
return value;
|
||||
return get_param_int(global.parameters, "GiveRestriction", 0);
|
||||
}
|
||||
|
||||
static void feedback_give_not_allowed(unit * u, order * ord)
|
||||
|
|
10
src/laws.c
10
src/laws.c
|
@ -3501,8 +3501,7 @@ void update_long_order(unit * u)
|
|||
}
|
||||
}
|
||||
|
||||
static int
|
||||
use_item(unit * u, const item_type * itype, int amount, struct order *ord)
|
||||
static int use_item(unit * u, const item_type * itype, int amount, struct order *ord)
|
||||
{
|
||||
int i;
|
||||
int target = read_unitid(u->faction, u->region);
|
||||
|
@ -3795,10 +3794,6 @@ int use_cmd(unit * u, struct order *ord)
|
|||
|
||||
if (itype != NULL) {
|
||||
err = use_item(u, itype, n, ord);
|
||||
assert(err <= 0 || !"use_item should not return positive values.");
|
||||
if (err > 0) {
|
||||
log_error("use_item returned a value>0 for %s\n", resourcename(itype->rtype, 0));
|
||||
}
|
||||
}
|
||||
switch (err) {
|
||||
case ENOITEM:
|
||||
|
@ -3810,6 +3805,9 @@ int use_cmd(unit * u, struct order *ord)
|
|||
case ENOSKILL:
|
||||
cmistake(u, ord, 50, MSG_PRODUCE);
|
||||
break;
|
||||
default:
|
||||
// no error
|
||||
break;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue