* lua 5.0 hasn't lua_objlen - use 5.1 instead
This commit is contained in:
parent
d4b69a87f7
commit
6754198248
3 changed files with 26 additions and 32 deletions
12
configure.in
12
configure.in
|
@ -52,12 +52,6 @@ if test "$ARCH" = "macosx" ; then
|
|||
fi
|
||||
fi
|
||||
|
||||
if test -d /usr/include/lua50; then
|
||||
CPPFLAGS="$CPPFLAGS -I/usr/include/lua50"
|
||||
fi
|
||||
if test -d /usr/include/lua5.0; then
|
||||
CPPFLAGS="$CPPFLAGS -I/usr/include/lua5.0"
|
||||
fi
|
||||
if test -d /usr/include/lua51; then
|
||||
CPPFLAGS="$CPPFLAGS -I/usr/include/lua51"
|
||||
fi
|
||||
|
@ -126,7 +120,7 @@ if test "$ARCH" = "win32"; then
|
|||
else
|
||||
AC_SEARCH_LIBS(glViewport, GL opengl32 sdl, LDFLAGS="$LDFLAGS $LIBS", AC_MSG_ERROR(opengl libraries cannot be not found))
|
||||
fi
|
||||
|
||||
|
||||
dnl --- BZIP2 ------------------
|
||||
AC_ARG_WITH(bzip2,
|
||||
[ --with-bzip2 [Use bzip2 (default: yes)]])
|
||||
|
@ -191,8 +185,8 @@ if test "$ARCH" = "linux"; then
|
|||
LDFLAGS="$LDFLAGS -ldl"
|
||||
fi
|
||||
AC_CHECK_HEADER(lua.h,, AC_MSG_ERROR(could not find lua.h))
|
||||
AC_SEARCH_LIBS(lua_getfenv, lua lua50 lua5.0 lua51 lua5.1, LDFLAGS="$LDFLAGS $LIBS", AC_MSG_ERROR(Lua5 is required))
|
||||
AC_SEARCH_LIBS(luaopen_base, lualib lualib50 lualib5.0 lualib51 lualib5.1, LDFLAGS="$LDFLAGS $LIBS", AC_MSG_ERROR(Lualib5 is required))
|
||||
AC_SEARCH_LIBS(lua_getfenv, lua lua51 lua5.1, LDFLAGS="$LDFLAGS $LIBS", AC_MSG_ERROR(Lua5.1 is required))
|
||||
AC_SEARCH_LIBS(luaopen_base, lualib lualib51 lualib5.1, LDFLAGS="$LDFLAGS $LIBS", AC_MSG_ERROR(Lualib5.1 is required))
|
||||
|
||||
dnl --- SDL --------------------
|
||||
AC_CHECK_PROGS(SDLCONFIG, sdl-config)
|
||||
|
|
|
@ -218,7 +218,7 @@ static std::vector<CUnitType *> getRefineryUnits()
|
|||
#else
|
||||
return res;
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -237,7 +237,7 @@ static void InitAiHelper(AiHelper &aiHelper)
|
|||
std::vector<CUnitType *> reparableUnits = getReparableUnits();
|
||||
std::vector<CUnitType *> supplyUnits = getSupplyUnits();
|
||||
std::vector<CUnitType *> mineUnits = getRefineryUnits();
|
||||
|
||||
|
||||
for (std::vector<CUnitType *>::const_iterator i = supplyUnits.begin(); i != supplyUnits.end(); ++i) {
|
||||
AiHelperInsert(aiHelper.UnitLimit, 0, *i);
|
||||
}
|
||||
|
@ -249,8 +249,8 @@ static void InitAiHelper(AiHelper &aiHelper)
|
|||
AiHelperInsert(aiHelper.Refinery, i - 1, *j);
|
||||
}
|
||||
}
|
||||
|
||||
for (std::vector<CUnitType *>::const_iterator d = UnitTypes.begin();
|
||||
|
||||
for (std::vector<CUnitType *>::const_iterator d = UnitTypes.begin();
|
||||
d != UnitTypes.end(); ++d) {
|
||||
CUnitType *type = *d;
|
||||
|
||||
|
@ -259,7 +259,7 @@ static void InitAiHelper(AiHelper &aiHelper)
|
|||
AiHelperInsert(aiHelper.Depots, i - 1, *d);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < (int)UnitButtonTable.size(); ++i) {
|
||||
|
@ -852,7 +852,7 @@ static int CclAiForceRole(lua_State *l)
|
|||
}
|
||||
|
||||
AiForce &aiforce = AiPlayer->Force[AiPlayer->Force.getScriptForce(force)];
|
||||
|
||||
|
||||
const char *flag = LuaToString(l, 2);
|
||||
if (!strcmp(flag, "attack")) {
|
||||
aiforce.Role = AiForceRoleAttack;
|
||||
|
@ -947,19 +947,19 @@ static int CclAiWaitForces(lua_State *l)
|
|||
if (!lua_istable(l, 1)) {
|
||||
LuaError(l, "incorrect argument");
|
||||
}
|
||||
int force, args = lua_objlen(l, 1);
|
||||
int force, args = lua_objlen(l, 1);
|
||||
for (int i = 0; i < args; ++i) {
|
||||
lua_rawgeti(l, 1, i + 1);
|
||||
force = LuaToNumber(l, -1);
|
||||
lua_pop(l, 1);
|
||||
if (force < 0 || force >= AI_MAX_FORCES) {
|
||||
lua_pushfstring(l, "Force out of range: %d", force);
|
||||
}
|
||||
}
|
||||
if (!AiPlayer->Force[AiPlayer->Force.getScriptForce(force)].Completed) {
|
||||
lua_pushboolean(l, 1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
lua_pushboolean(l, 0);
|
||||
return 1;
|
||||
}
|
||||
|
@ -972,12 +972,12 @@ static int CclAiWaitForces(lua_State *l)
|
|||
static int CclAiAttackWithForces(lua_State *l)
|
||||
{
|
||||
int Forces[AI_MAX_FORCES + 1];
|
||||
|
||||
|
||||
LuaCheckArgs(l, 1);
|
||||
if (!lua_istable(l, 1)) {
|
||||
LuaError(l, "incorrect argument");
|
||||
}
|
||||
int force, args = lua_objlen(l, 1);
|
||||
int force, args = lua_objlen(l, 1);
|
||||
for (int i = 0; i < args; ++i) {
|
||||
lua_rawgeti(l, 1, i + 1);
|
||||
force = LuaToNumber(l, -1);
|
||||
|
@ -1225,19 +1225,19 @@ static void CclParseBuildQueue(lua_State *l, PlayerAi *ai, int offset)
|
|||
if (!lua_istable(l, offset)) {
|
||||
LuaError(l, "incorrect argument");
|
||||
}
|
||||
|
||||
|
||||
const char *value;
|
||||
int made;
|
||||
int want;
|
||||
int x = -1,y = -1;
|
||||
|
||||
|
||||
const int args = lua_objlen(l, offset);
|
||||
for (int k = 0; k < args; ++k) {
|
||||
lua_rawgeti(l, offset, k + 1);
|
||||
value = LuaToString(l, -1);
|
||||
lua_pop(l, 1);
|
||||
++k;
|
||||
|
||||
|
||||
if (!strcmp(value, "onpos")) {
|
||||
lua_rawgeti(l, offset, k + 1);
|
||||
x = LuaToNumber(l, -1);
|
||||
|
@ -1247,7 +1247,7 @@ static void CclParseBuildQueue(lua_State *l, PlayerAi *ai, int offset)
|
|||
y = LuaToNumber(l, -1);
|
||||
lua_pop(l, 1);
|
||||
} else {
|
||||
|
||||
|
||||
//lua_rawgeti(l, j + 1, k + 1);
|
||||
//ident = LuaToString(l, -1);
|
||||
//lua_pop(l, 1);
|
||||
|
@ -1259,14 +1259,14 @@ static void CclParseBuildQueue(lua_State *l, PlayerAi *ai, int offset)
|
|||
lua_rawgeti(l, offset, k + 1);
|
||||
want = LuaToNumber(l, -1);
|
||||
lua_pop(l, 1);
|
||||
|
||||
|
||||
AiBuildQueue queue;
|
||||
queue.Type = UnitTypeByIdent(value);
|
||||
queue.Want = want;
|
||||
queue.Made = made;
|
||||
queue.X = x;
|
||||
queue.Y = y;
|
||||
|
||||
|
||||
ai->UnitTypeBuilt.push_back(queue);
|
||||
x = -1;
|
||||
y = -1;
|
||||
|
@ -1635,7 +1635,7 @@ static int CclDefineAiPlayer(lua_State *l)
|
|||
ai->ResearchRequests.push_back(CUpgrade::Get(ident));
|
||||
}
|
||||
} else if (!strcmp(value, "building")) {
|
||||
CclParseBuildQueue(l, ai, j+1);
|
||||
CclParseBuildQueue(l, ai, j+1);
|
||||
} else if (!strcmp(value, "repair-building")) {
|
||||
ai->LastRepairBuilding = LuaToNumber(l, j + 1);
|
||||
} else if (!strcmp(value, "repair-workers")) {
|
||||
|
|
|
@ -40,9 +40,9 @@
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
#include "lualib.h"
|
||||
#include <lua.h>
|
||||
#include <lauxlib.h>
|
||||
#include <lualib.h>
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -278,7 +278,7 @@ extern void InitCcl(void); /// Initialise ccl
|
|||
extern void LoadCcl(void); /// Load ccl config file
|
||||
extern void SaveCcl(CFile *file); /// Save CCL module
|
||||
extern void SavePreferences(void); /// Save user preferences
|
||||
extern int CclCommand(const std::string &command, bool exitOnError = true);
|
||||
extern int CclCommand(const std::string &command, bool exitOnError = true);
|
||||
|
||||
/// transform string in corresponding index.
|
||||
extern EnumVariable Str2EnumVariable(lua_State *l, const char *s);
|
||||
|
|
Loading…
Add table
Reference in a new issue