Commit 270ec28b authored by lllyasviel's avatar lllyasviel

5 bugs fixed. core updated. AI open scourced.

parent a770eb41
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Precy")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Precy")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//将 ComVisible 设置为 false 将使此程序集中的类型
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("5448596e-a4d2-4011-b8c1-5228260040d1")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
This diff is collapsed.
The MIT License (MIT)
Copyright (c) 2015 Fluorohydride
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
This diff is collapsed.
This diff is collapsed.
/*
* common.h
*
* Created on: 2009-1-7
* Author: Argon.Sun
*/
#ifndef COMMON_H_
#define COMMON_H_
#ifdef _MSC_VER
#pragma warning(disable: 4244)
#endif
typedef unsigned long uptr;
typedef unsigned long long uint64;
typedef unsigned int uint32;
typedef unsigned short uint16;
typedef unsigned char uint8;
typedef unsigned char byte;
typedef long ptr;
typedef long long int64;
typedef int int32;
typedef short int16;
typedef char int8;
typedef int BOOL;
#define MATCH_ALL(x,y) (((x)&(y))==(y))
#define MATCH_ANY(x,y) ((x)&(y))
#define ADD_BIT(x,y) ((x)|=(y))
#define REMOVE_BIT(x,y) ((x)&=~(y))
#define OPERATION_SUCCESS 1
#define OPERATION_FAIL 0
#define OPERATION_CANCELED -1
#define TRUE 1
#define FALSE 0
#ifndef NULL
#define NULL 0
#endif
struct card_sort {
bool operator()(void* const & c1, void* const & c2) const;
};
#endif /* COMMON_H_ */
/*
* duel.cpp
*
* Created on: 2010-5-2
* Author: Argon
*/
#include "duel.h"
#include "interpreter.h"
#include "field.h"
#include "card.h"
#include "effect.h"
#include "group.h"
#include "ocgapi.h"
#include <memory.h>
duel::duel() {
lua = new interpreter(this);
game_field = new field(this);
game_field->temp_card = new_card(0);
clear_buffer();
}
duel::~duel() {
for(auto cit = cards.begin(); cit != cards.end(); ++cit)
delete *cit;
for(auto git = groups.begin(); git != groups.end(); ++git)
delete *git;
for(auto eit = effects.begin(); eit != effects.end(); ++eit)
delete *eit;
delete lua;
delete game_field;
}
void duel::clear() {
for(auto cit = cards.begin(); cit != cards.end(); ++cit)
delete *cit;
for(auto git = groups.begin(); git != groups.end(); ++git)
delete *git;
for(auto eit = effects.begin(); eit != effects.end(); ++eit)
delete *eit;
delete game_field;
cards.clear();
groups.clear();
effects.clear();
game_field = new field(this);
game_field->temp_card = new_card(0);
}
card* duel::new_card(uint32 code) {
card* pcard = new card(this);
cards.insert(pcard);
if(code)
::read_card(code, &(pcard->data));
pcard->data.code = code;
lua->register_card(pcard);
return pcard;
}
group* duel::register_group(group* pgroup) {
groups.insert(pgroup);
if(lua->call_depth)
sgroups.insert(pgroup);
lua->register_group(pgroup);
return pgroup;
}
group* duel::new_group() {
group* pgroup = new group(this);
return register_group(pgroup);
}
group* duel::new_group(card* pcard) {
group* pgroup = new group(this, pcard);
return register_group(pgroup);
}
group* duel::new_group(const card_set& cset) {
group* pgroup = new group(this, cset);
return register_group(pgroup);
}
effect* duel::new_effect() {
effect* peffect = new effect(this);
effects.insert(peffect);
lua->register_effect(peffect);
return peffect;
}
void duel::delete_card(card* pcard) {
cards.erase(pcard);
delete pcard;
}
void duel::delete_group(group* pgroup) {
lua->unregister_group(pgroup);
groups.erase(pgroup);
sgroups.erase(pgroup);
delete pgroup;
}
void duel::delete_effect(effect* peffect) {
lua->unregister_effect(peffect);
effects.erase(peffect);
delete peffect;
}
int32 duel::read_buffer(byte* buf) {
memcpy(buf, buffer, bufferlen);
return bufferlen;
}
void duel::release_script_group() {
for(auto sit = sgroups.begin(); sit != sgroups.end(); ++sit) {
group* pgroup = *sit;
if(pgroup->is_readonly == 0) {
lua->unregister_group(pgroup);
groups.erase(pgroup);
delete pgroup;
}
}
sgroups.clear();
}
void duel::restore_assumes() {
for(auto sit = assumes.begin(); sit != assumes.end(); ++sit)
(*sit)->assume_type = 0;
assumes.clear();
}
void duel::write_buffer32(uint32 value) {
*((uint32*)bufferp) = value;
bufferp += 4;
bufferlen += 4;
}
void duel::write_buffer16(uint16 value) {
*((uint16*)bufferp) = value;
bufferp += 2;
bufferlen += 2;
}
void duel::write_buffer8(uint8 value) {
*((uint8*)bufferp) = value;
bufferp += 1;
bufferlen += 1;
}
void duel::clear_buffer() {
bufferlen = 0;
bufferp = buffer;
}
void duel::set_responsei(uint32 resp) {
game_field->returns.ivalue[0] = resp;
}
void duel::set_responseb(byte* resp) {
memcpy(game_field->returns.bvalue, resp, 64);
}
int32 duel::get_next_integer(int32 l, int32 h) {
return (int32) (random.real() * (h - l + 1)) + l;
}
/*
* duel.h
*
* Created on: 2010-4-8
* Author: Argon
*/
#ifndef DUEL_H_
#define DUEL_H_
#include "common.h"
#include "mtrandom.h"
#include <set>
#include <unordered_set>
class card;
class group;
class effect;
class field;
class interpreter;
class duel {
public:
typedef std::set<card*, card_sort> card_set;
char strbuffer[256];
byte buffer[0x1000];
uint32 bufferlen;
byte* bufferp;
interpreter* lua;
field* game_field;
mtrandom random;
std::unordered_set<card*> cards;
std::unordered_set<card*> assumes;
std::unordered_set<group*> groups;
std::unordered_set<group*> sgroups;
std::unordered_set<effect*> effects;
std::unordered_set<effect*> uncopy;
duel();
~duel();
void clear();
card* new_card(uint32 code);
group* new_group();
group* new_group(card* pcard);
group* new_group(const card_set& cset);
effect* new_effect();
void delete_card(card* pcard);
void delete_group(group* pgroup);
void delete_effect(effect* peffect);
void release_script_group();
void restore_assumes();
int32 read_buffer(byte* buf);
void write_buffer32(uint32 value);
void write_buffer16(uint16 value);
void write_buffer8(uint8 value);
void clear_buffer();
void set_responsei(uint32 resp);
void set_responseb(byte* resp);
int32 get_next_integer(int32 l, int32 h);
private:
group* register_group(group* pgroup);
};
//Player
#define PLAYER_NONE 2 //
#define PLAYER_ALL 3 //
//Phase
#define PHASE_DRAW 0x01
#define PHASE_STANDBY 0x02
#define PHASE_MAIN1 0x04
#define PHASE_BATTLE_START 0x08
#define PHASE_BATTLE_STEP 0x10
#define PHASE_DAMAGE 0x20
#define PHASE_DAMAGE_CAL 0x40
#define PHASE_BATTLE 0x80
#define PHASE_MAIN2 0x100
#define PHASE_END 0x200
//Options
#define DUEL_TEST_MODE 0x01
#define DUEL_ATTACK_FIRST_TURN 0x02
//#define DUEL_NO_CHAIN_HINT 0x04
#define DUEL_OBSOLETE_RULING 0x08
#define DUEL_PSEUDO_SHUFFLE 0x10
#define DUEL_TAG_MODE 0x20
#define DUEL_SIMPLE_AI 0x40
#define DUEL_SIMPLE_AI_MODE 0x80
#endif /* DUEL_H_ */
This diff is collapsed.
This diff is collapsed.
/*
* effectset.h
*
* Created on: 2011-10-8
* Author: Argon
*/
#ifndef EFFECTSET_H_
#define EFFECTSET_H_
#include <stdlib.h>
#include <array>
#include <vector>
#include <algorithm>
class effect;
bool effect_sort_id(const effect* e1, const effect* e2);
struct effect_set {
effect_set(): count(0) {}
void add_item(effect* peffect) {
if(count >= 64) return;
container[count++] = peffect;
}
void remove_item(int index) {
if(index >= count)
return;
if(index == count - 1) {
count--;
return;
}
for(int i = index; i < count - 1; ++i)
container[i] = container[i + 1];
count--;
}
void clear() {
count = 0;
}
int size() const {
return count;
}
void sort() {
if(count < 2)
return;
std::sort(container.begin(), container.begin() + count, effect_sort_id);
}
effect* const& get_last() const {
return container[count - 1];
}
effect*& get_last() {
return container[count - 1];
}
effect* const& operator[] (int index) const {
return container[index];
}
effect*& operator[] (int index) {
return container[index];
}
effect* const& at(int index) const {
return container[index];
}
effect*& at(int index) {
return container[index];
}
private:
std::array<effect*, 64> container;
int count;
};
struct effect_set_v {
effect_set_v(): count(0) {}
void add_item(effect* peffect) {
container.push_back(peffect);
count++;
}
void remove_item(int index) {
if(index >= count)
return;
container.erase(container.begin() + index);
count--;
}
void clear() {
container.clear();
count = 0;
}
int size() const {
return count;
}
void sort() {
if(count < 2)
return;
std::sort(container.begin(), container.begin() + count, effect_sort_id);
}
effect*& get_last() {
return container[count - 1];
}
effect*& operator[] (int index) {
return container[index];
}
effect*& at(int index) {
return container[index];
}
std::vector<effect*> container;
int count;
};
#endif //EFFECTSET_H_
This diff is collapsed.
This diff is collapsed.
/*
* group.cpp
*
* Created on: 2010-8-3
* Author: Argon
*/
#include "group.h"
#include "card.h"
#include "duel.h"
group::group(duel* pd) {
scrtype = 2;
ref_handle = 0;
pduel = pd;
is_readonly = FALSE;
}
group::group(duel* pd, card* pcard) {
container.insert(pcard);
scrtype = 2;
ref_handle = 0;
pduel = pd;
is_readonly = FALSE;
}
group::group(duel* pd, const card_set& cset): container(cset) {
scrtype = 2;
ref_handle = 0;
pduel = pd;
is_readonly = FALSE;
}
group::~group() {
}
/*
* group.h
*
* Created on: 2010-5-6
* Author: Argon
*/
#ifndef GROUP_H_
#define GROUP_H_
#include "common.h"
#include <set>
#include <list>
class card;
class duel;
class group {
public:
typedef std::set<card*, card_sort> card_set;
int32 scrtype;
int32 ref_handle;
duel* pduel;
card_set container;
card_set::iterator it;
uint32 is_readonly;
inline bool has_card(card* c) {
return container.find(c) != container.end();
}
explicit group(duel* pd);
group(duel* pd, card* pcard);
group(duel* pd, const card_set& cset);
~group();
};
#endif /* GROUP_H_ */
This diff is collapsed.
/*
* interpreter.h
*
* Created on: 2010-4-28
* Author: Argon
*/
#ifndef INTERPRETER_H_
#define INTERPRETER_H_
extern "C"
{
#include "lua.h"
#include "lauxlib.h"
#include"lualib.h"
}
#include "common.h"
#include <unordered_map>
#include <list>
#include <vector>
#include <cstring>
class card;
class effect;
class group;
class duel;
class interpreter {
public:
typedef std::unordered_map<int32, lua_State*> coroutine_map;
typedef std::list<std::pair<void*, uint32> > param_list;
duel* pduel;
char msgbuf[64];
lua_State* lua_state;
lua_State* current_state;
param_list params;
param_list resumes;
coroutine_map coroutines;
int32 no_action;
int32 call_depth;
explicit interpreter(duel* pd);
~interpreter();
int32 register_card(card *pcard);
void register_effect(effect* peffect);
void unregister_effect(effect* peffect);
void register_group(group* pgroup);
void unregister_group(group* pgroup);
int32 load_script(char* buffer);
int32 load_card_script(uint32 code);
void add_param(void* param, int32 type, bool front = false);
void add_param(ptr param, int32 type, bool front = false);
void push_param(lua_State* L, bool is_coroutine = false);
int32 call_function(int32 f, uint32 param_count, int32 ret_count);
int32 call_card_function(card *pcard, char *f, uint32 param_count, int32 ret_count);
int32 call_code_function(uint32 code, char *f, uint32 param_count, int32 ret_count);
int32 check_condition(int32 f, uint32 param_count);
int32 check_matching(card* pcard, int32 findex, int32 extraargs);
int32 get_operation_value(card* pcard, int32 findex, int32 extraargs);
int32 get_function_value(int32 f, uint32 param_count);
int32 get_function_value(int32 f, uint32 param_count, std::vector<int32>* result);
int32 call_coroutine(int32 f, uint32 param_count, uint32* yield_value, uint16 step);
static void card2value(lua_State* L, card* pcard);
static void group2value(lua_State* L, group* pgroup);
static void effect2value(lua_State* L, effect* peffect);
static void function2value(lua_State* L, int32 pointer);
static int32 get_function_handle(lua_State* L, int32 index);
static void set_duel_info(lua_State* L, duel* pduel);
static duel* get_duel_info(lua_State* L);
//ai related
static int get_counter(lua_State *L);
static int is_affected_by(lua_State *L);
static int is_affectable_by_chain(lua_State *L);
static int can_be_targeted_by_chain(lua_State *L);
static int get_equipped_cards(lua_State *L);
static int get_equip_target(lua_State *L);
static int is_public_card(lua_State *L);
template <size_t N>
static char* strcpy(char (&dst)[N], const char* src) {
return std::strncpy(reinterpret_cast<char*>(&dst), src, N);
}
};
#define PARAM_TYPE_INT 0x01
#define PARAM_TYPE_STRING 0x02
#define PARAM_TYPE_CARD 0x04
#define PARAM_TYPE_GROUP 0x08
#define PARAM_TYPE_EFFECT 0x10
#define PARAM_TYPE_FUNCTION 0x20
#define PARAM_TYPE_BOOLEAN 0x40
#define PARAM_TYPE_INDEX 0x80
#define COROUTINE_FINISH 1
#define COROUTINE_YIELD 2
#define COROUTINE_ERROR 3
#endif /* INTERPRETER_H_ */
This diff is collapsed.
/*
** $Id: lapi.h,v 2.7 2009/11/27 15:37:59 roberto Exp $
** Auxiliary functions from Lua API
** See Copyright Notice in lua.h
*/
#ifndef lapi_h
#define lapi_h
#include "llimits.h"
#include "lstate.h"
#define api_incr_top(L) {L->top++; api_check(L, L->top <= L->ci->top, \
"stack overflow");}
#define adjustresults(L,nres) \
{ if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; }
#define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \
"not enough elements in the stack")
#endif
This diff is collapsed.
/*
** $Id: lauxlib.h,v 1.120 2011/11/29 15:55:08 roberto Exp $
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
#ifndef lauxlib_h
#define lauxlib_h
#include <stddef.h>
#include <stdio.h>
#include "lua.h"
/* extra error code for `luaL_load' */
#define LUA_ERRFILE (LUA_ERRERR+1)
typedef struct luaL_Reg {
const char *name;
lua_CFunction func;
} luaL_Reg;
LUALIB_API void (luaL_checkversion_) (lua_State *L, lua_Number ver);
#define luaL_checkversion(L) luaL_checkversion_(L, LUA_VERSION_NUM)
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 const char *(luaL_tolstring) (lua_State *L, int idx, size_t *len);
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);
LUALIB_API const char *(luaL_optlstring) (lua_State *L, int numArg,
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);
LUALIB_API lua_Unsigned (luaL_checkunsigned) (lua_State *L, int numArg);
LUALIB_API lua_Unsigned (luaL_optunsigned) (lua_State *L, int numArg,
lua_Unsigned 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 void (luaL_setmetatable) (lua_State *L, const char *tname);
LUALIB_API void *(luaL_testudata) (lua_State *L, int ud, 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[]);
LUALIB_API int (luaL_fileresult) (lua_State *L, int stat, const char *fname);
LUALIB_API int (luaL_execresult) (lua_State *L, int stat);
/* pre-defined references */
#define LUA_NOREF (-2)
#define LUA_REFNIL (-1)
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_loadfilex) (lua_State *L, const char *filename,
const char *mode);
#define luaL_loadfile(L,f) luaL_loadfilex(L,f,NULL)
LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz,
const char *name, const char *mode);
LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s);
LUALIB_API lua_State *(luaL_newstate) (void);
LUALIB_API int (luaL_len) (lua_State *L, int idx);
LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p,
const char *r);
LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup);
LUALIB_API int (luaL_getsubtable) (lua_State *L, int idx, const char *fname);
LUALIB_API void (luaL_traceback) (lua_State *L, lua_State *L1,
const char *msg, int level);
LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname,
lua_CFunction openf, int glb);
/*
** ===============================================================
** some useful macros
** ===============================================================
*/
#define luaL_newlibtable(L,l) \
lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1)
#define luaL_newlib(L,l) (luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))
#define luaL_argcheck(L, cond,numarg,extramsg) \
((void)((cond) || luaL_argerror(L, (numarg), (extramsg))))
#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL))
#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL))
#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n)))
#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d)))
#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n)))
#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d)))
#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i)))
#define luaL_dofile(L, fn) \
(luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
#define luaL_dostring(L, s) \
(luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n)))
#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
#define luaL_loadbuffer(L,s,sz,n) luaL_loadbufferx(L,s,sz,n,NULL)
/*
** {======================================================
** Generic Buffer manipulation
** =======================================================
*/
typedef struct luaL_Buffer {
char *b; /* buffer address */
size_t size; /* buffer size */
size_t n; /* number of characters in buffer */
lua_State *L;
char initb[LUAL_BUFFERSIZE]; /* initial buffer */
} luaL_Buffer;
#define luaL_addchar(B,c) \
((void)((B)->n < (B)->size || luaL_prepbuffsize((B), 1)), \
((B)->b[(B)->n++] = (c)))
#define luaL_addsize(B,s) ((B)->n += (s))
LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B);
LUALIB_API char *(luaL_prepbuffsize) (luaL_Buffer *B, size_t sz);
LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l);
LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s);
LUALIB_API void (luaL_addvalue) (luaL_Buffer *B);
LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);
LUALIB_API void (luaL_pushresultsize) (luaL_Buffer *B, size_t sz);
LUALIB_API char *(luaL_buffinitsize) (lua_State *L, luaL_Buffer *B, size_t sz);
#define luaL_prepbuffer(B) luaL_prepbuffsize(B, LUAL_BUFFERSIZE)
/* }====================================================== */
/*
** {======================================================
** File handles for IO library
** =======================================================
*/
/*
** A file handle is a userdata with metatable 'LUA_FILEHANDLE' and
** initial structure 'luaL_Stream' (it may contain other fields
** after that initial structure).
*/
#define LUA_FILEHANDLE "FILE*"
typedef struct luaL_Stream {
FILE *f; /* stream (NULL for incompletely created streams) */
lua_CFunction closef; /* to close stream (NULL for closed streams) */
} luaL_Stream;
/* }====================================================== */
/* compatibility with old module system */
#if defined(LUA_COMPAT_MODULE)
LUALIB_API void (luaL_pushmodule) (lua_State *L, const char *modname,
int sizehint);
LUALIB_API void (luaL_openlib) (lua_State *L, const char *libname,
const luaL_Reg *l, int nup);
#define luaL_register(L,n,l) (luaL_openlib(L,(n),(l),0))
#endif
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
** $Id: ldebug.h,v 2.7 2011/10/07 20:45:19 roberto Exp $
** Auxiliary functions from Debug Interface module
** See Copyright Notice in lua.h
*/
#ifndef ldebug_h
#define ldebug_h
#include "lstate.h"
#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1)
#define getfuncline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : 0)
#define resethookcount(L) (L->hookcount = L->basehookcount)
/* Active Lua function (given call info) */
#define ci_func(ci) (clLvalue((ci)->func))
LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o,
const char *opname);
LUAI_FUNC l_noret luaG_concaterror (lua_State *L, StkId p1, StkId p2);
LUAI_FUNC l_noret luaG_aritherror (lua_State *L, const TValue *p1,
const TValue *p2);
LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1,
const TValue *p2);
LUAI_FUNC l_noret luaG_runerror (lua_State *L, const char *fmt, ...);
LUAI_FUNC l_noret luaG_errormsg (lua_State *L);
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -357,7 +357,7 @@ public class Room : WindowServantSP
lflist = r.ReadUInt32();
rule = r.ReadByte();
mode = r.ReadByte();
Program.I().ocgcore.MasterRule = r.ReadChar()>=3?4:3;
Program.I().ocgcore.MasterRule = r.ReadChar();
no_check_deck = r.ReadBoolean();
no_shuffle_deck = r.ReadBoolean();
r.ReadByte();
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment