@@ -2965,6 +2965,12 @@ int Net_GetLatency(int *ld, int *ad)
2965
2965
return severity;
2966
2966
}
2967
2967
2968
+ // ==========================================================================
2969
+ //
2970
+ //
2971
+ //
2972
+ // ==========================================================================
2973
+
2968
2974
void NetworkEntityManager::InitializeNetworkEntities ()
2969
2975
{
2970
2976
if (!s_netEntities.Size ())
@@ -3048,6 +3054,85 @@ DObject* NetworkEntityManager::GetNetworkEntity(const uint32_t id)
3048
3054
return s_netEntities[id];
3049
3055
}
3050
3056
3057
+ // ==========================================================================
3058
+ //
3059
+ //
3060
+ //
3061
+ // ==========================================================================
3062
+
3063
+ void DObject::SetNetworkID (const uint32_t id)
3064
+ {
3065
+ if (!IsNetworked ())
3066
+ {
3067
+ ObjectFlags |= OF_Networked;
3068
+ _networkID = id;
3069
+ }
3070
+ }
3071
+
3072
+ void DObject::ClearNetworkID ()
3073
+ {
3074
+ ObjectFlags &= ~OF_Networked;
3075
+ _networkID = NetworkEntityManager::WorldNetID;
3076
+ }
3077
+
3078
+ void DObject::EnableNetworking (const bool enable)
3079
+ {
3080
+ if (enable)
3081
+ NetworkEntityManager::AddNetworkEntity (this );
3082
+ else
3083
+ NetworkEntityManager::RemoveNetworkEntity (this );
3084
+ }
3085
+
3086
+ void DObject::RemoveFromNetwork ()
3087
+ {
3088
+ NetworkEntityManager::RemoveNetworkEntity (this );
3089
+ }
3090
+
3091
+ static unsigned int GetNetworkID (DObject* const self)
3092
+ {
3093
+ return self->GetNetworkID ();
3094
+ }
3095
+
3096
+ DEFINE_ACTION_FUNCTION_NATIVE (DObject, GetNetworkID, GetNetworkID)
3097
+ {
3098
+ PARAM_SELF_PROLOGUE (DObject);
3099
+
3100
+ ACTION_RETURN_INT (self->GetNetworkID ());
3101
+ }
3102
+
3103
+ static void EnableNetworking (DObject* const self, const bool enable)
3104
+ {
3105
+ self->EnableNetworking (enable);
3106
+ }
3107
+
3108
+ DEFINE_ACTION_FUNCTION_NATIVE (DObject, EnableNetworking, EnableNetworking)
3109
+ {
3110
+ PARAM_SELF_PROLOGUE (DObject);
3111
+ PARAM_BOOL (enable);
3112
+
3113
+ self->EnableNetworking (enable);
3114
+ return 0 ;
3115
+ }
3116
+
3117
+ static DObject* GetNetworkEntity (const unsigned int id)
3118
+ {
3119
+ return NetworkEntityManager::GetNetworkEntity (id);
3120
+ }
3121
+
3122
+ DEFINE_ACTION_FUNCTION_NATIVE (DObject, GetNetworkEntity, GetNetworkEntity)
3123
+ {
3124
+ PARAM_PROLOGUE;
3125
+ PARAM_UINT (id);
3126
+
3127
+ ACTION_RETURN_OBJECT (NetworkEntityManager::GetNetworkEntity (id));
3128
+ }
3129
+
3130
+ // ==========================================================================
3131
+ //
3132
+ //
3133
+ //
3134
+ // ==========================================================================
3135
+
3051
3136
// [RH] List "ping" times
3052
3137
CCMD (pings)
3053
3138
{
0 commit comments