The vendored ocgcore from the Unity repo (Tools/YGOLegacy/ocgcore at dev HEAD). Upstream is nanahira/ygopro-core at 973672dc9ce7cb49f47173277ab1ad0e318b7593; the seven files that differ from it carry the fork's core patches, already applied: 0001 face-down Token setcode, 0004 effect damage step outside a chain, 0008 Sandbox god mode, 0015 tag first seat holds the hand, 0022 attack preview, 0024 attack preview legality. Generated build/ output is left out. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
45 lines
1017 B
C++
45 lines
1017 B
C++
#ifndef METADATA_H_
|
|
#define METADATA_H_
|
|
|
|
#include "common.h"
|
|
#include <unordered_map>
|
|
#include <string>
|
|
#include <lua.h>
|
|
|
|
class metadata_entry {
|
|
public:
|
|
metadata_entry();
|
|
~metadata_entry();
|
|
|
|
metadata_entry(const metadata_entry& other);
|
|
metadata_entry& operator=(const metadata_entry& other);
|
|
|
|
metadata_entry(metadata_entry&& other) noexcept;
|
|
metadata_entry& operator=(metadata_entry&& other) noexcept;
|
|
|
|
int32_t luaop_get(lua_State *L);
|
|
int32_t luaop_set(lua_State *L, int32_t index);
|
|
|
|
private:
|
|
void reset();
|
|
void copy_from(const metadata_entry& other);
|
|
LuaParamType type;
|
|
intptr_t value;
|
|
};
|
|
|
|
using metadata_entry_map = std::unordered_map<std::string, metadata_entry>;
|
|
|
|
class metadata {
|
|
public:
|
|
int32_t luaop_clear();
|
|
int32_t luaop_get(lua_State *L, int32_t offset = 0);
|
|
int32_t luaop_set(lua_State *L, int32_t offset = 0);
|
|
int32_t luaop_has(lua_State *L, int32_t offset = 0);
|
|
int32_t luaop_keys(lua_State *L);
|
|
|
|
private:
|
|
metadata_entry_map entries;
|
|
};
|
|
|
|
#endif /* METADATA_H_ */
|