Merge branch 'CTD1-Bug-1803'

This commit is contained in:
Enno Rehling 2014-08-08 00:25:33 +02:00
commit e6a162ebca
2 changed files with 54 additions and 49 deletions

View File

@ -4128,7 +4128,7 @@ int pay_cmd(unit * u, struct order *ord)
static int reserve_i(unit * u, struct order *ord, int flags)
{
if (u->number > 0 && (urace(u)->ec_flags & GETITEM)) {
int use, count;
int use, count, para;
const resource_type *rtype;
const char *s;
@ -4136,16 +4136,20 @@ static int reserve_i(unit * u, struct order *ord, int flags)
skip_token();
s = getstrtoken();
count = atoip((const char *)s);
para = findparam(s, u->faction->locale);
if (count == 0 && findparam(s, u->faction->locale) == P_EACH) {
if (count == 0 && para == P_EACH) {
count = getint() * u->number;
}
rtype = findresourcetype(getstrtoken(), u->faction->locale);
if (rtype == NULL)
return 0;
set_resvalue(u, rtype, 0); /* make sure the pool is empty */
if (count == 0 && para == P_ANY) {
count = get_resource(u, rtype);
}
use = use_pooled(u, rtype, flags, count);
if (use) {
set_resvalue(u, rtype, use);
@ -4622,6 +4626,7 @@ void init_processor(void)
add_proc_region(p, &enter_1, "Betreten (2. Versuch)");
if (get_param_int(global.parameters, "rules.reserve.twophase", 0)) {
add_proc_order(p, K_RESERVE, &reserve_self, 0, "RESERVE (self)");
p += 10;
}
add_proc_order(p, K_RESERVE, &reserve_cmd, 0, "RESERVE (all)");
add_proc_order(p, K_CLAIM, &claim_cmd, 0, NULL);

View File

@ -25,7 +25,7 @@ static void tolua_reg_types (lua_State* tolua_S)
{
}
/* function: log_error */
/* function: log_error_n */
static int tolua_log_eressea_log_error00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
@ -51,32 +51,6 @@ static int tolua_log_eressea_log_error00(lua_State* tolua_S)
#endif
}
/* function: log_warning */
static int tolua_log_eressea_log_warning00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isstring(tolua_S,1,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
const char* message = ((const char*) tolua_tostring(tolua_S,1,0));
{
log_warning(message);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'warning'.",&tolua_err);
return 0;
#endif
}
/* function: log_debug */
static int tolua_log_eressea_log_debug00(lua_State* tolua_S)
{
@ -103,29 +77,55 @@ static int tolua_log_eressea_log_debug00(lua_State* tolua_S)
#endif
}
/* function: log_warning */
static int tolua_log_eressea_log_warning00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isstring(tolua_S,1,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
const char* message = ((const char*) tolua_tostring(tolua_S,1,0));
{
log_warning(message);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'warning'.",&tolua_err);
return 0;
#endif
}
/* function: log_info */
static int tolua_log_eressea_log_info00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isstring(tolua_S, 1, 0, &tolua_err) ||
!tolua_isnoobj(tolua_S, 2, &tolua_err)
)
goto tolua_lerror;
else
tolua_Error tolua_err;
if (
!tolua_isstring(tolua_S,1,0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
const char* message = ((const char*)tolua_tostring(tolua_S, 1, 0));
{
log_info(message);
}
}
return 0;
{
const char* message = ((const char*) tolua_tostring(tolua_S,1,0));
{
log_info(message);
}
}
return 0;
#ifndef TOLUA_RELEASE
tolua_lerror :
tolua_error(tolua_S, "#ferror in function 'info'.", &tolua_err);
return 0;
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'info'.",&tolua_err);
return 0;
#endif
}
@ -141,9 +141,9 @@ LUALIB_API int luaopen_log (lua_State* tolua_S)
tolua_module(tolua_S,"log",0);
tolua_beginmodule(tolua_S,"log");
tolua_function(tolua_S,"error",tolua_log_eressea_log_error00);
tolua_function(tolua_S,"debug",tolua_log_eressea_log_debug00);
tolua_function(tolua_S,"warning",tolua_log_eressea_log_warning00);
tolua_function(tolua_S, "debug",tolua_log_eressea_log_debug00);
tolua_function(tolua_S, "info",tolua_log_eressea_log_info00);
tolua_function(tolua_S,"info",tolua_log_eressea_log_info00);
tolua_endmodule(tolua_S);
tolua_endmodule(tolua_S);
tolua_endmodule(tolua_S);