mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Merged New Inventory Project into main branch
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1871 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+26
-26
@@ -19,8 +19,8 @@
|
||||
LUALIB_API int (luaL_getn) (lua_State *L, int t);
|
||||
LUALIB_API void (luaL_setn) (lua_State *L, int t, int n);
|
||||
#else
|
||||
#define luaL_getn(L,i) ((int)lua_objlen(L, i))
|
||||
#define luaL_setn(L,i,j) ((void)0) /* no op! */
|
||||
#define luaL_getn(L,i) ((int)lua_objlen(L, i))
|
||||
#define luaL_setn(L,i,j) ((void)0) /* no op! */
|
||||
#endif
|
||||
|
||||
#if defined(LUA_COMPAT_OPENLIB)
|
||||
@@ -29,64 +29,64 @@ LUALIB_API void (luaL_setn) (lua_State *L, int t, int n);
|
||||
|
||||
|
||||
/* extra error code for `luaL_load' */
|
||||
#define LUA_ERRFILE (LUA_ERRERR+1)
|
||||
#define LUA_ERRFILE (LUA_ERRERR+1)
|
||||
|
||||
|
||||
typedef struct luaL_Reg {
|
||||
const char *name;
|
||||
lua_CFunction func;
|
||||
const char *name;
|
||||
lua_CFunction func;
|
||||
} luaL_Reg;
|
||||
|
||||
|
||||
|
||||
LUALIB_API void (luaI_openlib) (lua_State *L, const char *libname,
|
||||
const luaL_Reg *l, int nup);
|
||||
const luaL_Reg *l, int nup);
|
||||
LUALIB_API void (luaL_register) (lua_State *L, const char *libname,
|
||||
const luaL_Reg *l);
|
||||
const luaL_Reg *l);
|
||||
LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e);
|
||||
LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e);
|
||||
LUALIB_API int (luaL_typerror) (lua_State *L, int narg, const char *tname);
|
||||
LUALIB_API int (luaL_argerror) (lua_State *L, int numarg, const char *extramsg);
|
||||
LUALIB_API const char *(luaL_checklstring) (lua_State *L, int numArg,
|
||||
size_t *l);
|
||||
size_t *l);
|
||||
LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg,
|
||||
const char *def, size_t *l);
|
||||
const char *def, size_t *l);
|
||||
LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int numArg);
|
||||
LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int nArg, lua_Number def);
|
||||
|
||||
LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg);
|
||||
LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg,
|
||||
lua_Integer def);
|
||||
lua_Integer def);
|
||||
|
||||
LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);
|
||||
LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t);
|
||||
LUALIB_API void (luaL_checkany) (lua_State *L, int narg);
|
||||
|
||||
LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname);
|
||||
LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname);
|
||||
LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname);
|
||||
|
||||
LUALIB_API void (luaL_where) (lua_State *L, int lvl);
|
||||
LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);
|
||||
|
||||
LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,
|
||||
const char *const lst[]);
|
||||
const char *const lst[]);
|
||||
|
||||
LUALIB_API int (luaL_ref) (lua_State *L, int t);
|
||||
LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);
|
||||
|
||||
LUALIB_API int (luaL_loadfile) (lua_State *L, const char *filename);
|
||||
LUALIB_API int (luaL_loadbuffer) (lua_State *L, const char *buff, size_t sz,
|
||||
const char *name);
|
||||
const char *name);
|
||||
LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);
|
||||
|
||||
LUALIB_API lua_State *(luaL_newstate) (void);
|
||||
|
||||
|
||||
LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p,
|
||||
const char *r);
|
||||
const char *r);
|
||||
|
||||
LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx,
|
||||
const char *fname, int szhint);
|
||||
const char *fname, int szhint);
|
||||
|
||||
|
||||
|
||||
@@ -127,15 +127,15 @@ LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx,
|
||||
|
||||
|
||||
typedef struct luaL_Buffer {
|
||||
char *p; /* current position in buffer */
|
||||
int lvl; /* number of strings in the stack (level) */
|
||||
lua_State *L;
|
||||
char buffer[LUAL_BUFFERSIZE];
|
||||
char *p; /* current position in buffer */
|
||||
int lvl; /* number of strings in the stack (level) */
|
||||
lua_State *L;
|
||||
char buffer[LUAL_BUFFERSIZE];
|
||||
} luaL_Buffer;
|
||||
|
||||
#define luaL_addchar(B,c) \
|
||||
((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \
|
||||
(*(B)->p++ = (char)(c)))
|
||||
((void)((B)->p < ((B)->buffer+LUAL_BUFFERSIZE) || luaL_prepbuffer(B)), \
|
||||
(*(B)->p++ = (char)(c)))
|
||||
|
||||
/* compatibility only */
|
||||
#define luaL_putchar(B,c) luaL_addchar(B,c)
|
||||
@@ -156,15 +156,15 @@ LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);
|
||||
/* compatibility with ref system */
|
||||
|
||||
/* pre-defined references */
|
||||
#define LUA_NOREF (-2)
|
||||
#define LUA_REFNIL (-1)
|
||||
#define LUA_NOREF (-2)
|
||||
#define LUA_REFNIL (-1)
|
||||
|
||||
#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \
|
||||
(lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0))
|
||||
(lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0))
|
||||
|
||||
#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref))
|
||||
#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref))
|
||||
|
||||
#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref))
|
||||
#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref))
|
||||
|
||||
|
||||
#define luaL_reg luaL_Reg
|
||||
|
||||
+4
-6
@@ -2,13 +2,12 @@
|
||||
#include <string.h>
|
||||
#include <iostream>
|
||||
#include "Lua Interpreter.h"
|
||||
|
||||
#include <Windows.h>
|
||||
#include "MemMan.h"
|
||||
|
||||
lua_State *L;
|
||||
|
||||
#define ARRAY_INDEX " idx" // The space is intentional to make this an out-of-band field
|
||||
#define ARRAY_INDEX " idx" // The space is intentional to make this an out-of-band field
|
||||
|
||||
void CreateLuaType( lua_State *L, STR8 TypeName, luaL_Reg *LuaAccessors )
|
||||
{
|
||||
@@ -177,12 +176,11 @@ void NewLuaObject( lua_State *L, STR8 ClsName, void *Ptr )
|
||||
|
||||
|
||||
|
||||
|
||||
void InitializeLua( )
|
||||
{
|
||||
L = lua_open();
|
||||
luaL_openlibs(L);
|
||||
|
||||
|
||||
// Create the accessor metatable
|
||||
// CreateLuaType( L, ACCESSOR_TABLE, LuaAccessors);
|
||||
// lua_setglobal( L, ACCESSOR_TABLE); // We also want this class to be known to the script
|
||||
@@ -218,11 +216,11 @@ int EvalLua (const wchar_t* buff) {
|
||||
int len = strlen( error);
|
||||
if (len >= 7 && !strcmp( error + len - 7, "'<eof>'"))
|
||||
{
|
||||
lua_pop(L, 1); /* pop error message from the stack */
|
||||
lua_pop(L, 1); /* pop error message from the stack */
|
||||
return FALSE;
|
||||
}
|
||||
printf( "%s\n", lua_tostring(L, -1));
|
||||
lua_pop(L, 1); /* pop error message from the stack */
|
||||
lua_pop(L, 1); /* pop error message from the stack */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ typedef LUA_INTEGER lua_Integer;
|
||||
** state manipulation
|
||||
*/
|
||||
LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);
|
||||
LUA_API void (lua_close) (lua_State *L);
|
||||
LUA_API void (lua_close) (lua_State *L);
|
||||
LUA_API lua_State *(lua_newthread) (lua_State *L);
|
||||
|
||||
LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf);
|
||||
@@ -117,92 +117,92 @@ LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf);
|
||||
/*
|
||||
** basic stack manipulation
|
||||
*/
|
||||
LUA_API int (lua_gettop) (lua_State *L);
|
||||
LUA_API void (lua_settop) (lua_State *L, int idx);
|
||||
LUA_API void (lua_pushvalue) (lua_State *L, int idx);
|
||||
LUA_API void (lua_remove) (lua_State *L, int idx);
|
||||
LUA_API void (lua_insert) (lua_State *L, int idx);
|
||||
LUA_API void (lua_replace) (lua_State *L, int idx);
|
||||
LUA_API int (lua_checkstack) (lua_State *L, int sz);
|
||||
LUA_API int (lua_gettop) (lua_State *L);
|
||||
LUA_API void (lua_settop) (lua_State *L, int idx);
|
||||
LUA_API void (lua_pushvalue) (lua_State *L, int idx);
|
||||
LUA_API void (lua_remove) (lua_State *L, int idx);
|
||||
LUA_API void (lua_insert) (lua_State *L, int idx);
|
||||
LUA_API void (lua_replace) (lua_State *L, int idx);
|
||||
LUA_API int (lua_checkstack) (lua_State *L, int sz);
|
||||
|
||||
LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n);
|
||||
LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n);
|
||||
|
||||
|
||||
/*
|
||||
** access functions (stack -> C)
|
||||
** access functions (stack->C)
|
||||
*/
|
||||
|
||||
LUA_API int (lua_isnumber) (lua_State *L, int idx);
|
||||
LUA_API int (lua_isstring) (lua_State *L, int idx);
|
||||
LUA_API int (lua_iscfunction) (lua_State *L, int idx);
|
||||
LUA_API int (lua_isuserdata) (lua_State *L, int idx);
|
||||
LUA_API int (lua_type) (lua_State *L, int idx);
|
||||
LUA_API const char *(lua_typename) (lua_State *L, int tp);
|
||||
LUA_API int (lua_isnumber) (lua_State *L, int idx);
|
||||
LUA_API int (lua_isstring) (lua_State *L, int idx);
|
||||
LUA_API int (lua_iscfunction) (lua_State *L, int idx);
|
||||
LUA_API int (lua_isuserdata) (lua_State *L, int idx);
|
||||
LUA_API int (lua_type) (lua_State *L, int idx);
|
||||
LUA_API const char *(lua_typename) (lua_State *L, int tp);
|
||||
|
||||
LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2);
|
||||
LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2);
|
||||
LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2);
|
||||
LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2);
|
||||
LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2);
|
||||
LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2);
|
||||
|
||||
LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx);
|
||||
LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx);
|
||||
LUA_API int (lua_toboolean) (lua_State *L, int idx);
|
||||
LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len);
|
||||
LUA_API size_t (lua_objlen) (lua_State *L, int idx);
|
||||
LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx);
|
||||
LUA_API void *(lua_touserdata) (lua_State *L, int idx);
|
||||
LUA_API lua_State *(lua_tothread) (lua_State *L, int idx);
|
||||
LUA_API const void *(lua_topointer) (lua_State *L, int idx);
|
||||
LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx);
|
||||
LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx);
|
||||
LUA_API int (lua_toboolean) (lua_State *L, int idx);
|
||||
LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len);
|
||||
LUA_API size_t (lua_objlen) (lua_State *L, int idx);
|
||||
LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx);
|
||||
LUA_API void *(lua_touserdata) (lua_State *L, int idx);
|
||||
LUA_API lua_State *(lua_tothread) (lua_State *L, int idx);
|
||||
LUA_API const void *(lua_topointer) (lua_State *L, int idx);
|
||||
|
||||
|
||||
/*
|
||||
** push functions (C -> stack)
|
||||
** push functions (C->stack)
|
||||
*/
|
||||
LUA_API void (lua_pushnil) (lua_State *L);
|
||||
LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n);
|
||||
LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n);
|
||||
LUA_API void (lua_pushlstring) (lua_State *L, const char *s, size_t l);
|
||||
LUA_API void (lua_pushstring) (lua_State *L, const char *s);
|
||||
LUA_API void (lua_pushnil) (lua_State *L);
|
||||
LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n);
|
||||
LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n);
|
||||
LUA_API void (lua_pushlstring) (lua_State *L, const char *s, size_t l);
|
||||
LUA_API void (lua_pushstring) (lua_State *L, const char *s);
|
||||
LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt,
|
||||
va_list argp);
|
||||
va_list argp);
|
||||
LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...);
|
||||
LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
|
||||
LUA_API void (lua_pushboolean) (lua_State *L, int b);
|
||||
LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p);
|
||||
LUA_API int (lua_pushthread) (lua_State *L);
|
||||
LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
|
||||
LUA_API void (lua_pushboolean) (lua_State *L, int b);
|
||||
LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p);
|
||||
LUA_API int (lua_pushthread) (lua_State *L);
|
||||
|
||||
|
||||
/*
|
||||
** get functions (Lua -> stack)
|
||||
** get functions (Lua->stack)
|
||||
*/
|
||||
LUA_API void (lua_gettable) (lua_State *L, int idx);
|
||||
LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k);
|
||||
LUA_API void (lua_rawget) (lua_State *L, int idx);
|
||||
LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n);
|
||||
LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec);
|
||||
LUA_API void (lua_gettable) (lua_State *L, int idx);
|
||||
LUA_API void (lua_getfield) (lua_State *L, int idx, const char *k);
|
||||
LUA_API void (lua_rawget) (lua_State *L, int idx);
|
||||
LUA_API void (lua_rawgeti) (lua_State *L, int idx, int n);
|
||||
LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec);
|
||||
LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);
|
||||
LUA_API int (lua_getmetatable) (lua_State *L, int objindex);
|
||||
LUA_API void (lua_getfenv) (lua_State *L, int idx);
|
||||
LUA_API int (lua_getmetatable) (lua_State *L, int objindex);
|
||||
LUA_API void (lua_getfenv) (lua_State *L, int idx);
|
||||
|
||||
|
||||
/*
|
||||
** set functions (stack -> Lua)
|
||||
** set functions (stack->Lua)
|
||||
*/
|
||||
LUA_API void (lua_settable) (lua_State *L, int idx);
|
||||
LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k);
|
||||
LUA_API void (lua_rawset) (lua_State *L, int idx);
|
||||
LUA_API void (lua_rawseti) (lua_State *L, int idx, int n);
|
||||
LUA_API int (lua_setmetatable) (lua_State *L, int objindex);
|
||||
LUA_API int (lua_setfenv) (lua_State *L, int idx);
|
||||
LUA_API void (lua_settable) (lua_State *L, int idx);
|
||||
LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k);
|
||||
LUA_API void (lua_rawset) (lua_State *L, int idx);
|
||||
LUA_API void (lua_rawseti) (lua_State *L, int idx, int n);
|
||||
LUA_API int (lua_setmetatable) (lua_State *L, int objindex);
|
||||
LUA_API int (lua_setfenv) (lua_State *L, int idx);
|
||||
|
||||
|
||||
/*
|
||||
** `load' and `call' functions (load and run Lua code)
|
||||
*/
|
||||
LUA_API void (lua_call) (lua_State *L, int nargs, int nresults);
|
||||
LUA_API int (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc);
|
||||
LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud);
|
||||
LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt,
|
||||
const char *chunkname);
|
||||
LUA_API void (lua_call) (lua_State *L, int nargs, int nresults);
|
||||
LUA_API int (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc);
|
||||
LUA_API int (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud);
|
||||
LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt,
|
||||
const char *chunkname);
|
||||
|
||||
LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data);
|
||||
|
||||
@@ -210,9 +210,9 @@ LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data);
|
||||
/*
|
||||
** coroutine functions
|
||||
*/
|
||||
LUA_API int (lua_yield) (lua_State *L, int nresults);
|
||||
LUA_API int (lua_resume) (lua_State *L, int narg);
|
||||
LUA_API int (lua_status) (lua_State *L);
|
||||
LUA_API int (lua_yield) (lua_State *L, int nresults);
|
||||
LUA_API int (lua_resume) (lua_State *L, int narg);
|
||||
LUA_API int (lua_status) (lua_State *L);
|
||||
|
||||
/*
|
||||
** garbage-collection function and options
|
||||
@@ -234,11 +234,11 @@ LUA_API int (lua_gc) (lua_State *L, int what, int data);
|
||||
** miscellaneous functions
|
||||
*/
|
||||
|
||||
LUA_API int (lua_error) (lua_State *L);
|
||||
LUA_API int (lua_error) (lua_State *L);
|
||||
|
||||
LUA_API int (lua_next) (lua_State *L, int idx);
|
||||
LUA_API int (lua_next) (lua_State *L, int idx);
|
||||
|
||||
LUA_API void (lua_concat) (lua_State *L, int n);
|
||||
LUA_API void (lua_concat) (lua_State *L, int n);
|
||||
|
||||
LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);
|
||||
LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);
|
||||
@@ -320,7 +320,7 @@ LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);
|
||||
#define LUA_MASKLINE (1 << LUA_HOOKLINE)
|
||||
#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT)
|
||||
|
||||
typedef struct lua_Debug lua_Debug; /* activation record */
|
||||
typedef struct lua_Debug lua_Debug; /* activation record */
|
||||
|
||||
|
||||
/* Functions to be called by the debuger in specific events */
|
||||
@@ -341,25 +341,25 @@ LUA_API int lua_gethookcount (lua_State *L);
|
||||
|
||||
|
||||
struct lua_Debug {
|
||||
int event;
|
||||
const char *name; /* (n) */
|
||||
const char *namewhat; /* (n) `global', `local', `field', `method' */
|
||||
const char *what; /* (S) `Lua', `C', `main', `tail' */
|
||||
const char *source; /* (S) */
|
||||
int currentline; /* (l) */
|
||||
int nups; /* (u) number of upvalues */
|
||||
int linedefined; /* (S) */
|
||||
int lastlinedefined; /* (S) */
|
||||
char short_src[LUA_IDSIZE]; /* (S) */
|
||||
/* private part */
|
||||
int i_ci; /* active function */
|
||||
int event;
|
||||
const char *name; /* (n) */
|
||||
const char *namewhat; /* (n) `global', `local', `field', `method' */
|
||||
const char *what; /* (S) `Lua', `C', `main', `tail' */
|
||||
const char *source; /* (S) */
|
||||
int currentline; /* (l) */
|
||||
int nups; /* (u) number of upvalues */
|
||||
int linedefined; /* (S) */
|
||||
int lastlinedefined; /* (S) */
|
||||
char short_src[LUA_IDSIZE]; /* (S) */
|
||||
/* private part */
|
||||
int i_ci; /* active function */
|
||||
};
|
||||
|
||||
/* }====================================================================== */
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Copyright (C) 1994-2007 Lua.org, PUC-Rio. All rights reserved.
|
||||
* Copyright (C) 1994-2007 Lua.org, PUC-Rio. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
|
||||
@@ -117,15 +117,6 @@
|
||||
<File
|
||||
RelativePath=".\lua.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\lua_env.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\lua_strategic.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\lua_tactical.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\lwstring.cpp">
|
||||
</File>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Version="8.00"
|
||||
Name="lua_2005Express"
|
||||
ProjectGUID="{A83DA7DA-2C31-45D8-9A69-B4993A885E76}"
|
||||
RootNamespace="lua_2005Express"
|
||||
@@ -39,7 +39,7 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D "_CRT_SECURE_NO_DEPRECATE"
"
|
||||
AdditionalOptions="/D "_CRT_SECURE_NO_DEPRECATE""
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
|
||||
MinimalRebuild="true"
|
||||
@@ -103,7 +103,6 @@
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalOptions="/D "_CRT_SECURE_NO_DEPRECATE""
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;"
|
||||
RuntimeLibrary="0"
|
||||
RuntimeTypeInfo="false"
|
||||
@@ -139,6 +138,69 @@
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="MapEditor|Win32"
|
||||
OutputDirectory="MapEditor"
|
||||
IntermediateDirectory="MapEditor"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\ja2_2005Express.vsprops;..\ja2_2005ExpressEditor.vsprops"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
RuntimeTypeInfo="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4100"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
|
||||
+11
-11
@@ -82,7 +82,7 @@ static int LuaGetSoldierLevel( lua_State *L )
|
||||
}
|
||||
else
|
||||
{
|
||||
lua_pushinteger( L, pSoldier->bLevel);
|
||||
lua_pushinteger( L, pSoldier->pathing.bLevel);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -94,7 +94,7 @@ static int LuaSetSoldierLevel( lua_State *L )
|
||||
int newlevel = luaL_checkinteger( L, 3);
|
||||
luaL_argcheck( L, newlevel >= 0 && newlevel <= 1, 2, "The level must be 1 or 0" );
|
||||
HandlePlacingRoofMarker( pSoldier, pSoldier->sGridNo, (BOOLEAN) newlevel, TRUE );
|
||||
SetSoldierHeight( pSoldier, (FLOAT)50*newlevel );
|
||||
pSoldier->SetSoldierHeight((FLOAT)50*newlevel );
|
||||
HandlePlacingRoofMarker( pSoldier, pSoldier->sGridNo, (BOOLEAN) newlevel, TRUE );
|
||||
return 0;
|
||||
}
|
||||
@@ -130,10 +130,10 @@ static int LuaSoldierWalkTo( lua_State *L )
|
||||
SOLDIERTYPE *pSoldier = *ppSoldier;
|
||||
int newgrid = luaL_checkinteger( L, 2);
|
||||
luaL_argcheck( L, newgrid > 0 && newgrid <= NOWHERE, 2, "The grid number must be on screen!" );
|
||||
pSoldier->bAction = AI_ACTION_WALK;
|
||||
pSoldier->usActionData = (INT16) newgrid;
|
||||
pSoldier->bPathStored = FALSE;
|
||||
pSoldier->bActionInProgress = ExecuteAction( pSoldier);
|
||||
pSoldier->aiData.bAction = AI_ACTION_WALK;
|
||||
pSoldier->aiData.usActionData = (INT16) newgrid;
|
||||
pSoldier->pathing.bPathStored = FALSE;
|
||||
pSoldier->aiData.bActionInProgress = ExecuteAction( pSoldier);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -143,10 +143,10 @@ static int LuaSoldierRunTo( lua_State *L )
|
||||
SOLDIERTYPE *pSoldier = *ppSoldier;
|
||||
int newgrid = luaL_checkinteger( L, 2);
|
||||
luaL_argcheck( L, newgrid > 0 && newgrid <= NOWHERE, 2, "The grid number must be on screen!" );
|
||||
pSoldier->bAction = AI_ACTION_RUN;
|
||||
pSoldier->usActionData = (INT16) newgrid;
|
||||
pSoldier->bPathStored = FALSE;
|
||||
pSoldier->bActionInProgress = ExecuteAction( pSoldier);
|
||||
pSoldier->aiData.bAction = AI_ACTION_RUN;
|
||||
pSoldier->aiData.usActionData = (INT16) newgrid;
|
||||
pSoldier->pathing.bPathStored = FALSE;
|
||||
pSoldier->aiData.bActionInProgress = ExecuteAction( pSoldier);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ static int LuaSoldierChangeStance( lua_State *L )
|
||||
SOLDIERTYPE **ppSoldier = (SOLDIERTYPE**) luaL_checkudata( L, 1, SOLDIER_CLASS );
|
||||
SOLDIERTYPE *pSoldier = *ppSoldier;
|
||||
int newstance = luaL_checkinteger( L, 2);
|
||||
ChangeSoldierStance( pSoldier, (UINT8) newstance);
|
||||
pSoldier->ChangeSoldierStance( (UINT8) newstance);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+28
-28
@@ -66,8 +66,8 @@
|
||||
@* checks for initialization code.
|
||||
** CHANGE them if you want different names.
|
||||
*/
|
||||
#define LUA_PATH "LUA_PATH"
|
||||
#define LUA_CPATH "LUA_CPATH"
|
||||
#define LUA_PATH "LUA_PATH"
|
||||
#define LUA_CPATH "LUA_CPATH"
|
||||
#define LUA_INIT "LUA_INIT"
|
||||
|
||||
|
||||
@@ -87,21 +87,21 @@
|
||||
*/
|
||||
#define LUA_LDIR "!\\lua\\"
|
||||
#define LUA_CDIR "!\\"
|
||||
#define LUA_PATH_DEFAULT \
|
||||
".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \
|
||||
LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua"
|
||||
#define LUA_PATH_DEFAULT \
|
||||
".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \
|
||||
LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua"
|
||||
#define LUA_CPATH_DEFAULT \
|
||||
".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
|
||||
".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
|
||||
|
||||
#else
|
||||
#define LUA_ROOT "/usr/local/"
|
||||
#define LUA_LDIR LUA_ROOT "share/lua/5.1/"
|
||||
#define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
|
||||
#define LUA_PATH_DEFAULT \
|
||||
"./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
|
||||
LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua"
|
||||
#define LUA_PATH_DEFAULT \
|
||||
"./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
|
||||
LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua"
|
||||
#define LUA_CPATH_DEFAULT \
|
||||
"./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so"
|
||||
"./?.so;" LUA_CDIR"?.so;" LUA_CDIR"loadall.so"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@
|
||||
#define LUAI_DATA /* empty */
|
||||
|
||||
#elif defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \
|
||||
defined(__ELF__)
|
||||
defined(__ELF__)
|
||||
#define LUAI_FUNC __attribute__((visibility("hidden"))) extern
|
||||
#define LUAI_DATA LUAI_FUNC
|
||||
|
||||
@@ -232,7 +232,7 @@
|
||||
#include <stdio.h>
|
||||
#define lua_stdin_is_tty() _isatty(_fileno(stdin))
|
||||
#else
|
||||
#define lua_stdin_is_tty() 1 /* assume stdin is a tty */
|
||||
#define lua_stdin_is_tty() 1 /* assume stdin is a tty */
|
||||
#endif
|
||||
|
||||
|
||||
@@ -276,13 +276,13 @@
|
||||
#include <readline/history.h>
|
||||
#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL)
|
||||
#define lua_saveline(L,idx) \
|
||||
if (lua_strlen(L,idx) > 0) /* non-empty line? */ \
|
||||
add_history(lua_tostring(L, idx)); /* add it to history */
|
||||
if (lua_strlen(L,idx) > 0) /* non-empty line? */ \
|
||||
add_history(lua_tostring(L, idx)); /* add it to history */
|
||||
#define lua_freeline(L,b) ((void)L, free(b))
|
||||
#else
|
||||
#define lua_readline(L,b,p) \
|
||||
((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \
|
||||
fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */
|
||||
((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \
|
||||
fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */
|
||||
#define lua_saveline(L,idx) { (void)L; (void)idx; }
|
||||
#define lua_freeline(L,b) { (void)L; (void)b; }
|
||||
#endif
|
||||
@@ -299,7 +299,7 @@
|
||||
** mean larger pauses which mean slower collection.) You can also change
|
||||
** this value dynamically.
|
||||
*/
|
||||
#define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */
|
||||
#define LUAI_GCPAUSE 200 /* 200% (wait memory to double before next GC) */
|
||||
|
||||
|
||||
/*
|
||||
@@ -376,9 +376,9 @@
|
||||
*/
|
||||
#if defined(LUA_USE_APICHECK)
|
||||
#include <assert.h>
|
||||
#define luai_apicheck(L,o) { (void)L; assert(o); }
|
||||
#define luai_apicheck(L,object) { (void)L; assert(object); }
|
||||
#else
|
||||
#define luai_apicheck(L,o) { (void)L; }
|
||||
#define luai_apicheck(L,object) { (void)L; }
|
||||
#endif
|
||||
|
||||
|
||||
@@ -554,21 +554,21 @@
|
||||
|
||||
/* On a Pentium, resort to a trick */
|
||||
#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \
|
||||
(defined(__i386) || defined (_M_IX86) || defined(__i386__))
|
||||
(defined(__i386) || defined (_M_IX86) || defined(__i386__))
|
||||
|
||||
/* On a Microsoft compiler, use assembler */
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
#define lua_number2int(i,d) __asm fld d __asm fistp i
|
||||
#define lua_number2int(i,d) __asm fld d __asm fistp i
|
||||
#define lua_number2integer(i,n) lua_number2int(i, n)
|
||||
|
||||
/* the next trick should work on any Pentium, but sometimes clashes
|
||||
with a DirectX idiosyncrasy */
|
||||
with a DirectX idiosyncrasy */
|
||||
#else
|
||||
|
||||
union luai_Cast { double l_d; long l_l; };
|
||||
#define lua_number2int(i,d) \
|
||||
{ volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; }
|
||||
{ volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; }
|
||||
#define lua_number2integer(i,n) lua_number2int(i, n)
|
||||
|
||||
#endif
|
||||
@@ -607,7 +607,7 @@ union luai_Cast { double l_d; long l_l; };
|
||||
#define LUAI_THROW(L,c) throw(c)
|
||||
#define LUAI_TRY(L,c,a) try { a } catch(...) \
|
||||
{ if ((c)->status == 0) (c)->status = -1; }
|
||||
#define luai_jmpbuf int /* dummy variable */
|
||||
#define luai_jmpbuf int /* dummy variable */
|
||||
|
||||
#elif defined(LUA_USE_ULONGJMP)
|
||||
/* in Unix, try _longjmp/_setjmp (more efficient) */
|
||||
@@ -637,7 +637,7 @@ union luai_Cast { double l_d; long l_l; };
|
||||
@* temporary name.
|
||||
@@ LUA_TMPNAMBUFSIZE is the maximum size of a name created by lua_tmpnam.
|
||||
** CHANGE them if you have an alternative to tmpnam (which is considered
|
||||
** insecure) or if you want the original tmpnam anyway. By default, Lua
|
||||
** insecure) or if you want the original tmpnam anyway. By default, Lua
|
||||
** uses tmpnam except when POSIX is available, where it uses mkstemp.
|
||||
*/
|
||||
#if defined(loslib_c) || defined(luaall_c)
|
||||
@@ -676,7 +676,7 @@ union luai_Cast { double l_d; long l_l; };
|
||||
|
||||
#else
|
||||
|
||||
#define lua_popen(L,c,m) ((void)((void)c, m), \
|
||||
#define lua_popen(L,c,m) ((void)((void)c, m), \
|
||||
luaL_error(L, LUA_QL("popen") " not supported"), (FILE*)0)
|
||||
#define lua_pclose(L,file) ((void)((void)L, file), 0)
|
||||
|
||||
@@ -688,9 +688,9 @@ union luai_Cast { double l_d; long l_l; };
|
||||
** dynamic-library system for your platform (either Windows' DLL, Mac's
|
||||
** dyld, or Unix's dlopen). If your system is some kind of Unix, there
|
||||
** is a good chance that it has dlopen, so LUA_DL_DLOPEN will work for
|
||||
** it. To use dlopen you also need to adapt the src/Makefile (probably
|
||||
** it. To use dlopen you also need to adapt the src/Makefile (probably
|
||||
** adding -ldl to the linker options), so Lua does not select it
|
||||
** automatically. (When you change the makefile to add -ldl, you must
|
||||
** automatically. (When you change the makefile to add -ldl, you must
|
||||
** also add -DLUA_USE_DLOPEN.)
|
||||
** If you do not want any kind of dynamic library, undefine all these
|
||||
** options.
|
||||
|
||||
+11
-11
@@ -7,7 +7,7 @@
|
||||
|
||||
void luaWS_newlstr (lua_State *L, const CHAR16 *str, size_t l)
|
||||
{
|
||||
TWString *ts;
|
||||
TWString *ts;
|
||||
|
||||
// Create and initialize this data
|
||||
int size = sizewstring( l);
|
||||
@@ -15,9 +15,9 @@ void luaWS_newlstr (lua_State *L, const CHAR16 *str, size_t l)
|
||||
ts->len = l;
|
||||
memcpy( ts->data, str, l*sizeof(CHAR16)+sizeof(CHAR16));
|
||||
|
||||
// Make this data a wstring
|
||||
luaL_getmetatable(L, "wstring");
|
||||
lua_setmetatable(L, -2);
|
||||
// Make this data a wstring
|
||||
luaL_getmetatable(L, "wstring");
|
||||
lua_setmetatable(L, -2);
|
||||
}
|
||||
|
||||
// Create a string from a UTF-8 representation
|
||||
@@ -51,7 +51,7 @@ int LuaWStringByte( lua_State* L )
|
||||
tw = (TWString*) luaL_checkudata( L, 1, "wstring" );
|
||||
start = luaL_optint( L, 2, 1 );
|
||||
stop = luaL_optint( L, 3, 1 );
|
||||
|
||||
|
||||
// This function in the char strings will return nothing if the params are out of bounds.
|
||||
if (start < 1 || start >= tw->len ||
|
||||
stop < start)
|
||||
@@ -79,7 +79,7 @@ static int LuaWStringChar( lua_State *L )
|
||||
int len = lua_gettop( L) + 1;
|
||||
STR16 str = (STR16) MemAlloc( len * sizeof( CHAR16) );
|
||||
int idx;
|
||||
|
||||
|
||||
len--;
|
||||
for( idx=0; idx<len; idx++)
|
||||
{
|
||||
@@ -126,7 +126,7 @@ static int LuaWStringLower( lua_State *L )
|
||||
int len = tw->len + 1;
|
||||
STR16 str = (STR16) MemAlloc( len * sizeof( CHAR16) );
|
||||
int idx;
|
||||
|
||||
|
||||
for( idx=0; idx<len-1; idx++)
|
||||
{
|
||||
str[ idx ] = (CHAR16) towlower( tw->data[ idx ] );
|
||||
@@ -173,7 +173,7 @@ static int LuaWStringReverse( lua_State *L )
|
||||
int len = tw->len + 1;
|
||||
STR16 str = (STR16) MemAlloc( len * sizeof( CHAR16) );
|
||||
int idx;
|
||||
|
||||
|
||||
for( idx=0; idx<len-1; idx++)
|
||||
{
|
||||
str[ idx ] = tw->data[ tw->len - idx - 1 ];
|
||||
@@ -197,7 +197,7 @@ static int LuaWStringUpper( lua_State *L )
|
||||
int len = tw->len + 1;
|
||||
STR16 str = (STR16) MemAlloc( len * sizeof( CHAR16) );
|
||||
int idx;
|
||||
|
||||
|
||||
for( idx=0; idx<len-1; idx++)
|
||||
{
|
||||
str[ idx ] = (CHAR16) towupper( tw->data[ idx ] );
|
||||
@@ -228,7 +228,7 @@ static int LuaWStringIndex( lua_State *L )
|
||||
{
|
||||
luaL_checkudata( L, 1, "wstring" );
|
||||
const CHAR8 *idx = luaL_checkstring( L, 2 );
|
||||
|
||||
|
||||
// Disqualify metafunctions
|
||||
if ( idx[0] == '_' && idx[1] == '_' )
|
||||
{
|
||||
@@ -243,7 +243,7 @@ static int LuaWStringIndex( lua_State *L )
|
||||
}
|
||||
|
||||
luaL_Reg WStringMethods[] = {
|
||||
// Constructors
|
||||
// Constructors
|
||||
{ "fromUTF8", LuaWStringFromUTF8, },
|
||||
|
||||
// String-specific
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ typedef struct {
|
||||
CHAR16 data[1];
|
||||
} TWString;
|
||||
|
||||
#define sizewstring(s) (sizeof(int) + (s) * sizeof(CHAR16) + sizeof(CHAR16))
|
||||
#define sizewstring(s) (sizeof(int) + (s) * sizeof(CHAR16) + sizeof(CHAR16))
|
||||
|
||||
#define luaWS_newstr(L, s) (luaWS_newlstr(L, s, wcslen(s)))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user