Better fix for the previos compile error.

This commit is contained in:
Relintai 2019-10-29 00:33:30 +01:00
parent 2a753972f5
commit c02fd1e9f3
2 changed files with 11 additions and 43 deletions

View File

@ -1007,7 +1007,7 @@ void Entity::sdie() {
son_death();
//send an event to client
VRPCN(cdie);
VRPC(cdie);
//signal
emit_signal("sdied", this);
@ -2842,13 +2842,13 @@ void Entity::sfail_cast() {
_s_spell_cast_info.unref();
VRPCN(cfail_cast);
VRPC(cfail_cast);
}
void Entity::sdelay_cast() {
emit_signal("scast_delayed", _s_spell_cast_info);
VRPCN(cdelay_cast);
VRPC(cdelay_cast);
}
void Entity::sfinish_cast() {
@ -2860,7 +2860,7 @@ void Entity::sfinish_cast() {
_s_spell_cast_info.unref();
VRPCN(cfinish_cast);
VRPC(cfinish_cast);
}
void Entity::sinterrupt_cast() {
@ -2874,7 +2874,7 @@ void Entity::sinterrupt_cast() {
_s_spell_cast_info.unref();
VRPCN(cinterrupt_cast);
VRPC(cinterrupt_cast);
}
void Entity::cstart_casting_rpc(String data) {
@ -3762,7 +3762,7 @@ void Entity::sreset_talents() {
emit_signal("stalent_reset", this);
ORPCN(creset_talents);
ORPC(creset_talents);
}
void Entity::creset_talents() {
_c_talents.clear();
@ -3827,7 +3827,7 @@ int Entity::gets_talent_count() {
void Entity::sclear_talents() {
_s_talents.clear();
ORPCN(cclear_talents);
ORPC(cclear_talents);
}
void Entity::addc_talent(int talent) {

View File

@ -80,55 +80,23 @@ enum PlayerSendFlags {
#define SET_RPC_MASTERSYNC(p_method_name) rpc_config(p_method_name, MultiplayerAPI::RPC_MODE_MASTERSYNC);
#define SET_RPC_PUPPETSYNC(p_method_name) rpc_config(p_method_name, MultiplayerAPI::RPC_MODE_PUPPETSYNC);
//Normal
#define RPCN(func) \
if (is_inside_tree() && get_tree()->has_network_peer()) { \
rpc(#func); \
} \
func();
#define VRPCN(func) \
if (is_inside_tree() && get_tree()->has_network_peer()) { \
vrpc(#func); \
} \
func();
#define ORPCN(func) \
if (is_inside_tree() && get_tree()->has_network_peer()) { \
if (get_tree()->is_network_server() && get_network_master() != 1) \
rpc_id(get_network_master(), #func); \
} \
func();
#define RPCSN(func) \
if (is_inside_tree() && get_tree()->has_network_peer()) { \
if (get_tree()->is_network_server()) { \
func(); \
} else { \
rpc_id(1, #func); \
} \
} else { \
func(); \
}
//Variadic
// f.e. RPC(method, arg0, arg1, etc)
#define RPC(func, ...) \
if (is_inside_tree() && get_tree()->has_network_peer()) { \
rpc(#func, __VA_ARGS__); \
rpc(#func, ##__VA_ARGS__); \
} \
func(__VA_ARGS__);
#define VRPC(func, ...) \
if (is_inside_tree() && get_tree()->has_network_peer()) { \
vrpc(#func, __VA_ARGS__); \
vrpc(#func, ##__VA_ARGS__); \
} \
func(__VA_ARGS__);
#define ORPC(func, ...) \
if (is_inside_tree() && get_tree()->has_network_peer()) { \
if (get_tree()->is_network_server() && get_network_master() != 1) \
rpc_id(get_network_master(), #func, __VA_ARGS__); \
rpc_id(get_network_master(), #func, ##__VA_ARGS__); \
} \
func(__VA_ARGS__);
@ -137,7 +105,7 @@ enum PlayerSendFlags {
if (get_tree()->is_network_server()) { \
func(__VA_ARGS__); \
} else { \
rpc_id(1, #func, __VA_ARGS__); \
rpc_id(1, #func, ##__VA_ARGS__); \
} \
} else { \
func(__VA_ARGS__); \