Refactor RPCMode enum and checks
This commit is contained in:
@@ -1220,7 +1220,7 @@ ScriptLanguage *GDScriptInstance::get_language() {
|
||||
return GDScriptLanguage::get_singleton();
|
||||
}
|
||||
|
||||
GDScriptInstance::RPCMode GDScriptInstance::get_rpc_mode(const StringName &p_method) const {
|
||||
MultiplayerAPI::RPCMode GDScriptInstance::get_rpc_mode(const StringName &p_method) const {
|
||||
|
||||
const GDScript *cscript = script.ptr();
|
||||
|
||||
@@ -1228,17 +1228,17 @@ GDScriptInstance::RPCMode GDScriptInstance::get_rpc_mode(const StringName &p_met
|
||||
const Map<StringName, GDScriptFunction *>::Element *E = cscript->member_functions.find(p_method);
|
||||
if (E) {
|
||||
|
||||
if (E->get()->get_rpc_mode() != RPC_MODE_DISABLED) {
|
||||
if (E->get()->get_rpc_mode() != MultiplayerAPI::RPC_MODE_DISABLED) {
|
||||
return E->get()->get_rpc_mode();
|
||||
}
|
||||
}
|
||||
cscript = cscript->_base;
|
||||
}
|
||||
|
||||
return RPC_MODE_DISABLED;
|
||||
return MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
}
|
||||
|
||||
GDScriptInstance::RPCMode GDScriptInstance::get_rset_mode(const StringName &p_variable) const {
|
||||
MultiplayerAPI::RPCMode GDScriptInstance::get_rset_mode(const StringName &p_variable) const {
|
||||
|
||||
const GDScript *cscript = script.ptr();
|
||||
|
||||
@@ -1253,7 +1253,7 @@ GDScriptInstance::RPCMode GDScriptInstance::get_rset_mode(const StringName &p_va
|
||||
cscript = cscript->_base;
|
||||
}
|
||||
|
||||
return RPC_MODE_DISABLED;
|
||||
return MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
}
|
||||
|
||||
void GDScriptInstance::reload_members() {
|
||||
|
||||
@@ -63,7 +63,7 @@ class GDScript : public Script {
|
||||
int index;
|
||||
StringName setter;
|
||||
StringName getter;
|
||||
ScriptInstance::RPCMode rpc_mode;
|
||||
MultiplayerAPI::RPCMode rpc_mode;
|
||||
};
|
||||
|
||||
friend class GDScriptInstance;
|
||||
@@ -248,8 +248,8 @@ public:
|
||||
|
||||
void reload_members();
|
||||
|
||||
virtual RPCMode get_rpc_mode(const StringName &p_method) const;
|
||||
virtual RPCMode get_rset_mode(const StringName &p_variable) const;
|
||||
virtual MultiplayerAPI::RPCMode get_rpc_mode(const StringName &p_method) const;
|
||||
virtual MultiplayerAPI::RPCMode get_rset_mode(const StringName &p_variable) const;
|
||||
|
||||
GDScriptInstance();
|
||||
~GDScriptInstance();
|
||||
|
||||
@@ -1455,7 +1455,7 @@ GDScriptFunction::GDScriptFunction() :
|
||||
|
||||
_stack_size = 0;
|
||||
_call_size = 0;
|
||||
rpc_mode = ScriptInstance::RPC_MODE_DISABLED;
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
name = "<anonymous>";
|
||||
#ifdef DEBUG_ENABLED
|
||||
_func_cname = NULL;
|
||||
|
||||
@@ -96,14 +96,6 @@ public:
|
||||
ADDR_TYPE_NIL = 9
|
||||
};
|
||||
|
||||
enum RPCMode {
|
||||
RPC_DISABLED,
|
||||
RPC_ENABLED,
|
||||
RPC_SYNC,
|
||||
RPC_SYNC_MASTER,
|
||||
RPC_SYNC_SLAVE
|
||||
};
|
||||
|
||||
struct StackDebug {
|
||||
|
||||
int line;
|
||||
@@ -135,7 +127,7 @@ private:
|
||||
int _call_size;
|
||||
int _initial_line;
|
||||
bool _static;
|
||||
ScriptInstance::RPCMode rpc_mode;
|
||||
MultiplayerAPI::RPCMode rpc_mode;
|
||||
|
||||
GDScript *_script;
|
||||
|
||||
@@ -230,7 +222,7 @@ public:
|
||||
|
||||
Variant call(GDScriptInstance *p_instance, const Variant **p_args, int p_argcount, Variant::CallError &r_err, CallState *p_state = NULL);
|
||||
|
||||
_FORCE_INLINE_ ScriptInstance::RPCMode get_rpc_mode() const { return rpc_mode; }
|
||||
_FORCE_INLINE_ MultiplayerAPI::RPCMode get_rpc_mode() const { return rpc_mode; }
|
||||
GDScriptFunction();
|
||||
~GDScriptFunction();
|
||||
};
|
||||
|
||||
@@ -3373,7 +3373,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
|
||||
function->line = fnline;
|
||||
|
||||
function->rpc_mode = rpc_mode;
|
||||
rpc_mode = ScriptInstance::RPC_MODE_DISABLED;
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
|
||||
if (_static)
|
||||
p_class->static_functions.push_back(function);
|
||||
@@ -3967,7 +3967,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
rpc_mode = ScriptInstance::RPC_MODE_REMOTE;
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_REMOTE;
|
||||
|
||||
continue;
|
||||
} break;
|
||||
@@ -3988,7 +3988,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
|
||||
}
|
||||
}
|
||||
|
||||
rpc_mode = ScriptInstance::RPC_MODE_MASTER;
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_MASTER;
|
||||
continue;
|
||||
} break;
|
||||
case GDScriptTokenizer::TK_PR_SLAVE: {
|
||||
@@ -4008,7 +4008,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
|
||||
}
|
||||
}
|
||||
|
||||
rpc_mode = ScriptInstance::RPC_MODE_SLAVE;
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_SLAVE;
|
||||
continue;
|
||||
} break;
|
||||
case GDScriptTokenizer::TK_PR_SYNC: {
|
||||
@@ -4023,7 +4023,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
|
||||
return;
|
||||
}
|
||||
|
||||
rpc_mode = ScriptInstance::RPC_MODE_SYNC;
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_SYNC;
|
||||
continue;
|
||||
} break;
|
||||
case GDScriptTokenizer::TK_PR_VAR: {
|
||||
@@ -4053,7 +4053,7 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
|
||||
|
||||
tokenizer->advance();
|
||||
|
||||
rpc_mode = ScriptInstance::RPC_MODE_DISABLED;
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
|
||||
if (tokenizer->get_token() == GDScriptTokenizer::TK_OP_ASSIGN) {
|
||||
|
||||
@@ -4478,7 +4478,7 @@ void GDScriptParser::clear() {
|
||||
current_class = NULL;
|
||||
|
||||
completion_found = false;
|
||||
rpc_mode = ScriptInstance::RPC_MODE_DISABLED;
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
|
||||
current_function = NULL;
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
StringName getter;
|
||||
int line;
|
||||
Node *expression;
|
||||
ScriptInstance::RPCMode rpc_mode;
|
||||
MultiplayerAPI::RPCMode rpc_mode;
|
||||
};
|
||||
struct Constant {
|
||||
StringName identifier;
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
struct FunctionNode : public Node {
|
||||
|
||||
bool _static;
|
||||
ScriptInstance::RPCMode rpc_mode;
|
||||
MultiplayerAPI::RPCMode rpc_mode;
|
||||
StringName name;
|
||||
Vector<StringName> arguments;
|
||||
Vector<Node *> default_values;
|
||||
@@ -134,7 +134,7 @@ public:
|
||||
FunctionNode() {
|
||||
type = TYPE_FUNCTION;
|
||||
_static = false;
|
||||
rpc_mode = ScriptInstance::RPC_MODE_DISABLED;
|
||||
rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -493,7 +493,7 @@ private:
|
||||
|
||||
PropertyInfo current_export;
|
||||
|
||||
ScriptInstance::RPCMode rpc_mode;
|
||||
MultiplayerAPI::RPCMode rpc_mode;
|
||||
|
||||
void _set_error(const String &p_error, int p_line = -1, int p_column = -1);
|
||||
bool _recover_from_completion();
|
||||
|
||||
Reference in New Issue
Block a user