Updated rcheevos to 7.0.2

This commit is contained in:
Andre Leiradella 2018-09-29 16:04:49 +01:00
parent 48e9dd6baf
commit 60010b4545
3 changed files with 27 additions and 17 deletions

View File

@ -1,3 +1,13 @@
# v7.0.2
* Make sure the code is C89-compliant
* Use 32-bit types in Lua
* Only evaluate Lua operands when the Lua state is not `NULL`
# v7.0.1
* Fix the alignment of memory allocations
# v7.0.0
* Removed **rjson**

View File

@ -319,27 +319,27 @@ unsigned rc_evaluate_operand(rc_operand_t* self, rc_peek_t peek, void* ud, lua_S
return 0;
case RC_OPERAND_LUA:
lua_rawgeti(L, LUA_REGISTRYINDEX, self->function_ref);
lua_pushcfunction(L, rc_luapeek);
if (L != 0) {
lua_rawgeti(L, LUA_REGISTRYINDEX, self->function_ref);
lua_pushcfunction(L, rc_luapeek);
luapeek.peek = peek;
luapeek.ud = ud;
luapeek.peek = peek;
luapeek.ud = ud;
lua_pushlightuserdata(L, &luapeek);
if (lua_pcall(L, 2, 1, 0) == LUA_OK) {
if (lua_isboolean(L, -1)) {
value = lua_toboolean(L, -1);
lua_pushlightuserdata(L, &luapeek);
if (lua_pcall(L, 2, 1, 0) == LUA_OK) {
if (lua_isboolean(L, -1)) {
value = lua_toboolean(L, -1);
}
else {
value = (unsigned)lua_tonumber(L, -1);
}
}
else {
value = (unsigned)lua_tonumber(L, -1);
}
}
else {
value = 0;
lua_pop(L, 1);
}
lua_pop(L, 1);
break;
case RC_OPERAND_ADDRESS:

View File

@ -19,7 +19,7 @@ OBJ=$(RC_SRC)/trigger.o $(RC_SRC)/condset.o $(RC_SRC)/condition.o $(RC_SRC)/oper
all: test
%.o: %.c
gcc -Wall -O0 -g -I../include -I$(RC_SRC) -I$(LUA_SRC) -c $< -o $@
gcc -Wall -O0 -g -std=c89 -ansi -Wno-long-long -DLUA_32BITS -I../include -I$(RC_SRC) -I$(LUA_SRC) -c $< -o $@
test: $(OBJ)
gcc -o $@ $+ -lm