Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3,810 changes: 1,909 additions & 1,901 deletions Client/App/App.vcproj

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion Client/App/include/reflection/property.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ namespace RBX
public:
bool isPublic() const;
virtual bool isReadOnly() const = 0;
bool canStreamWrite() const;
bool canStreamWrite() const
{
return bCanStreamWrite;
}
bool operator==(const PropertyDescriptor& other) const
{
return this == &other;
Expand Down
8 changes: 7 additions & 1 deletion Client/App/include/util/Events.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace RBX
protected:
virtual void onEvent(const Class*, Event) = 0;
Listener& operator=(const Listener&);

virtual ~Listener()
{
}
Expand All @@ -38,13 +39,18 @@ namespace RBX

protected:
Notifier(const Notifier&);

Notifier()
: listeners(),
raiseRange(NULL)
{
}

Notifier& operator=(const Notifier&);
virtual ~Notifier();

virtual ~Notifier()
{
}

public:
void addListener(Listener<Class, Event>*) const;
Expand Down
7 changes: 1 addition & 6 deletions Client/App/include/util/HitTestFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ namespace RBX
};

public:
virtual Result filterResult(const Primitive*) const = 0;
public:
//HitTestFilter(const HitTestFilter&);
HitTestFilter();
public:
//HitTestFilter& operator=(const HitTestFilter&);
virtual Result filterResult(const Primitive* testMe) const = 0;
};
}
12 changes: 12 additions & 0 deletions Client/App/include/util/Object.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ namespace RBX
return r ? boost::shared_static_cast<Class>(r->shared_from_this()) : boost::shared_ptr<Class>();
}

template<typename To, typename From>
boost::shared_ptr<To> shared_from_dynamic_cast(boost::enable_shared_from_this<From>* r)
{
return r ? boost::shared_dynamic_cast<To, From>(r->shared_from_this()) : boost::shared_ptr<To>();
}

template<typename To, typename From>
boost::shared_ptr<To> shared_from_polymorphic_downcast(boost::enable_shared_from_this<From>* r)
{
return r ? boost::shared_polymorphic_downcast<To, From>(r->shared_from_this()) : boost::shared_ptr<To>();
}

class Object
{
public:
Expand Down
2 changes: 1 addition & 1 deletion Client/App/include/util/Profiling.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace RBX
//ThreadProfiler(const ThreadProfiler&);
ThreadProfiler(const char* name);
public:
void sample(void* thread);
void sample(HANDLE thread);
public:
~ThreadProfiler() {}
public:
Expand Down
37 changes: 37 additions & 0 deletions Client/App/include/v8datamodel/Filters.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#pragma once
#include "util/HitTestFilter.h"
#include "v8datamodel/ModelInstance.h"
#include "v8datamodel/PartInstance.h"
#include <boost/shared_ptr.hpp>

namespace RBX
{
class Unlocked : public HitTestFilter
{
public:
virtual HitTestFilter::Result filterResult(const Primitive* testMe) const
{
return unlocked(testMe) ? HitTestFilter::INCLUDE_PRIM : HitTestFilter::STOP_TEST;
}

static bool unlocked(const Primitive* testMe);
};

class PartByLocalCharacter : public HitTestFilter
{
protected:
boost::shared_ptr<ModelInstance> character;
boost::shared_ptr<PartInstance> head;

public:
PartByLocalCharacter(Instance* root);
virtual HitTestFilter::Result filterResult(const Primitive* testMe) const;
};

class UnlockedPartByLocalCharacter : public PartByLocalCharacter
{
public:
UnlockedPartByLocalCharacter(Instance*);
virtual HitTestFilter::Result filterResult(const Primitive* testMe) const;
};
}
3 changes: 3 additions & 0 deletions Client/App/include/v8datamodel/Stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ namespace RBX

template<typename T>
Item* createChildItem(const char* name, boost::function0<T> func);

template<typename T>
void formatValue(const T& value);
};

template<typename T>
Expand Down
31 changes: 26 additions & 5 deletions Client/App/include/v8world/Mechanism.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,22 @@ namespace RBX
std::vector<MechanismTracker*> trackers;
public:
std::list<Mechanism*>::iterator myIt;
Mechanism::~Mechanism() { RBXASSERT(this->trackers.size() == 0); }
const std::set<Assembly*>& getAssemblies() const {return assemblies;}
std::set<Assembly*>& getAssemblies() {return assemblies;}

Mechanism::~Mechanism()
{
RBXASSERT(this->trackers.size() == 0);
}

const std::set<Assembly*>& getAssemblies() const
{
return assemblies;
}

std::set<Assembly*>& getAssemblies()
{
return assemblies;
}

void notifyMovingPrimitives();
void insertAssembly(Assembly* a);
void removeAssembly(Assembly* a);
Expand All @@ -38,8 +51,16 @@ namespace RBX
bool containedBy(Mechanism*);
void stopTracking();
public:
//MechanismTracker();
~MechanismTracker() {this->stopTracking();}
MechanismTracker()
: mechanism(NULL)
{
}

~MechanismTracker()
{
this->stopTracking();
}

bool tracking();
void setMechanism(Mechanism*);
Mechanism* getMechanism();
Expand Down
5 changes: 3 additions & 2 deletions Client/App/include/v8world/SimJobStage.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ namespace RBX
public:
Mechanism* nextMechanism(std::list<Mechanism*>& list, const Mechanism* current);
public:
//SimJobStage(const SimJobStage&);
SimJobStage(IStage* upstream, World* world);
virtual ~SimJobStage();
public:
Expand All @@ -36,6 +35,8 @@ namespace RBX
void onAssemblyAdded(Assembly* a);
void onAssemblyRemoving(Assembly* a);
void notifyMovingPrimitives();
//SimJobStage& operator=(const SimJobStage&);

template<typename Class>
void reportMechanisms(Class& callback, MechanismTracker& tracker, const Mechanism* ignore);
};
}
2 changes: 1 addition & 1 deletion Client/App/util/Profiling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace RBX
{
}

void ThreadProfiler::sample(void* thread)
void ThreadProfiler::sample(HANDLE thread)
{
double time = G3D::System::getTick();
if (bucketTimeSpan + lastSampleTime <= time)
Expand Down
32 changes: 32 additions & 0 deletions Client/App/v8datamodel/Filters.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include "v8datamodel/Filters.h"
#include "humanoid/Humanoid.h"
#include "Network/Players.h"

namespace RBX
{
bool Unlocked::unlocked(const Primitive* testMe)
{
return !PartInstance::fromPrimitiveConst(testMe)->getPartLocked();
}

PartByLocalCharacter::PartByLocalCharacter(Instance* root)
{
character = shared_from(Network::Players::findLocalCharacter(root));
head = shared_from(Humanoid::getHeadFromCharacter(character.get()));
}

HitTestFilter::Result PartByLocalCharacter::filterResult(const Primitive* testMe) const
{
if (character && head)
{
const PartInstance* p = PartInstance::fromPrimitiveConst(testMe);

if (p->isDescendentOf(character.get()))
{
return head->getIsTransparent() ? HitTestFilter::IGNORE_PRIM : HitTestFilter::STOP_TEST;
}
}

return HitTestFilter::INCLUDE_PRIM;
}
}
19 changes: 19 additions & 0 deletions Client/Network/API.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
#include "API.h"
#include "Client.h"
#include "Server.h"
#include "IdManager.h"
#include "NetworkSettings.h"
#include "Network/Players.h"

namespace RBX
{
namespace Network
{
void API::init(const char* version)
{
API::version = version;

Client::classDescriptor();
Server::classDescriptor();
Player::classDescriptor();
Players::classDescriptor();
IdManager::classDescriptor();
GlobalSettings::classDescriptor();
NetworkSettings::classDescriptor();

NetworkSettings::singleton();
}
}
}
54 changes: 54 additions & 0 deletions Client/Network/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ namespace RBX
{
namespace Network
{
Client::Client()
{
setName("NetworkClient");
updateLogger();
}

Client::~Client()
{
rakPeer->CloseConnection(serverId, true, 0);
}

void Client::disconnect(int blockDuration)
{
removeAllChildren();
Expand All @@ -39,5 +50,48 @@ namespace RBX

updateNetworkSimulator();
}

void Client::onServiceProvider(const ServiceProvider* oldProvider, const ServiceProvider* newProvider)
{
Listener<ServiceProvider, Closing>* oldListener = this;

if (oldProvider)
{
oldProvider->Notifier<ServiceProvider, Closing>::removeListener(oldListener);
}

if (oldProvider)
{
RunService* runService = oldProvider->find<RunService>();

if (runService)
runService->runDisabled = false;

disconnect(3000);

Players* p = oldProvider->find<Players>();
p->setConnection(NULL);
}

Instance::onServiceProvider(oldProvider, newProvider);

if (newProvider)
{
Players* p = newProvider->create<Players>();
p->setConnection(rakPeer.get());

RunService* runService = newProvider->find<RunService>();

if (runService)
runService->runDisabled = true;
}

Listener<ServiceProvider, Closing>* newListener = this;

if (newProvider)
{
newProvider->Notifier<ServiceProvider, Closing>::addListener(newListener);
}
}
}
}
4 changes: 1 addition & 3 deletions Client/Network/Client.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ namespace RBX
static Reflection::SignalDesc<Client, void(std::string)> event_ConnectionRejected;

public:
//Client(const Client&);
Client();
virtual ~Client();
void connect(std::string, int, int, int);
Expand All @@ -44,9 +43,8 @@ namespace RBX
protected:
virtual void onServiceProvider(const ServiceProvider* oldProvider, const ServiceProvider* newProvider);
virtual void onEvent(const ServiceProvider* source, Closing event);
public:
//Client& operator=(const Client&);

public:
static bool clientIsPresent(const Instance* context, bool testInDatamodel);
};
}
Expand Down
7 changes: 0 additions & 7 deletions Client/Network/IdManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@

namespace RBX
{
void IdManager::addInstance(Instance* instance, Guid::Data explicitId)
{
RBXASSERT(getInstance(explicitId) == NULL);

instance->assignGuid(explicitId);
addInstance(instance);
}

void IdManager::addInstance(Instance* instance)
{
Expand Down
Loading