Merge remote-tracking branch 'jamesu/console_stack_fix2' into development

Conflicts:
	Engine/source/console/console.cpp
This commit is contained in:
Daniel Buckmaster 2015-03-01 20:33:29 +11:00
commit 6c92ab065e
48 changed files with 2979 additions and 449 deletions

View file

@ -459,6 +459,14 @@ bool GameConnection::readConnectRequest(BitStream *stream, const char **errorStr
return false;
}
ConsoleValueRef connectArgv[MaxConnectArgs + 3];
ConsoleValue connectArgvValue[MaxConnectArgs + 3];
for(U32 i = 0; i < mConnectArgc+3; i++)
{
connectArgv[i].value = &connectArgvValue[i];
connectArgvValue[i].init();
}
for(U32 i = 0; i < mConnectArgc; i++)
{
char argString[256];
@ -466,11 +474,11 @@ bool GameConnection::readConnectRequest(BitStream *stream, const char **errorStr
mConnectArgv[i] = dStrdup(argString);
connectArgv[i + 3] = mConnectArgv[i];
}
connectArgv[0] = "onConnectRequest";
connectArgv[1] = 0;
connectArgvValue[0].setStackStringValue("onConnectRequest");
connectArgvValue[1].setIntValue(0);
char buffer[256];
Net::addressToString(getNetAddress(), buffer);
connectArgv[2] = buffer;
connectArgvValue[2].setStackStringValue(buffer);
// NOTE: Cannot convert over to IMPLEMENT_CALLBACK as it has variable args.
const char *ret = Con::execute(this, mConnectArgc + 3, connectArgv);

View file

@ -32,6 +32,7 @@
#include "app/game.h"
#include "T3D/gameBase/gameConnection.h"
#include "T3D/gameBase/gameConnectionEvents.h"
#include "console/engineAPI.h"
#define DebugChecksum 0xF00DBAAD
@ -234,7 +235,7 @@ void SimDataBlockEvent::process(NetConnection *cptr)
if(mProcess)
{
//call the console function to set the number of blocks to be sent
Con::executef("onDataBlockObjectReceived", Con::getIntArg(mIndex), Con::getIntArg(mTotal));
Con::executef("onDataBlockObjectReceived", mIndex, mTotal);
String &errorBuffer = NetConnection::getErrorBuffer();

View file

@ -292,7 +292,7 @@ IMPLEMENT_CALLBACK( Item, onStickyCollision, void, ( const char* objID ),( objID
"@see Item, ItemData\n"
);
IMPLEMENT_CALLBACK( Item, onEnterLiquid, void, ( const char* objID, const char* waterCoverage, const char* liquidType ),( objID, waterCoverage, liquidType ),
IMPLEMENT_CALLBACK( Item, onEnterLiquid, void, ( const char* objID, F32 waterCoverage, const char* liquidType ),( objID, waterCoverage, liquidType ),
"Informs an Item object that it has entered liquid, along with information about the liquid type.\n"
"@param objID Object ID for this Item object.\n"
"@param waterCoverage How much coverage of water this Item object has.\n"
@ -1005,7 +1005,7 @@ void Item::updatePos(const U32 /*mask*/, const F32 dt)
{
if(!mInLiquid && mWaterCoverage != 0.0f)
{
onEnterLiquid_callback( getIdString(), Con::getFloatArg(mWaterCoverage), mLiquidType.c_str() );
onEnterLiquid_callback( getIdString(), mWaterCoverage, mLiquidType.c_str() );
mInLiquid = true;
}
else if(mInLiquid && mWaterCoverage == 0.0f)

View file

@ -114,7 +114,7 @@ class Item: public ShapeBase
protected:
DECLARE_CALLBACK( void, onStickyCollision, ( const char* objID ));
DECLARE_CALLBACK( void, onEnterLiquid, ( const char* objID, const char* waterCoverage, const char* liquidType ));
DECLARE_CALLBACK( void, onEnterLiquid, ( const char* objID, F32 waterCoverage, const char* liquidType ));
DECLARE_CALLBACK( void, onLeaveLiquid, ( const char* objID, const char* liquidType ));
public:

View file

@ -104,7 +104,7 @@ ConsoleDocClass( PathCamera,
"@ingroup PathCameras\n"
);
IMPLEMENT_CALLBACK( PathCamera, onNode, void, (const char* node), (node),
IMPLEMENT_CALLBACK( PathCamera, onNode, void, (S32 node), (node),
"A script callback that indicates the path camera has arrived at a specific node in its path. Server side only.\n"
"@param Node Unique ID assigned to this node.\n");
@ -408,7 +408,7 @@ void PathCamera::popFront()
void PathCamera::onNode(S32 node)
{
if (!isGhost())
onNode_callback(Con::getIntArg(node));
onNode_callback(node);
}

View file

@ -93,7 +93,7 @@ private:
public:
DECLARE_CONOBJECT(PathCamera);
DECLARE_CALLBACK( void, onNode, (const char* node));
DECLARE_CALLBACK( void, onNode, (S32 node));
PathCamera();
~PathCamera();

View file

@ -153,7 +153,7 @@ ConsoleDocClass( RigidShape,
);
IMPLEMENT_CALLBACK( RigidShape, onEnterLiquid, void, ( const char* objId, const char* waterCoverage, const char* liquidType ),
IMPLEMENT_CALLBACK( RigidShape, onEnterLiquid, void, ( const char* objId, F32 waterCoverage, const char* liquidType ),
( objId, waterCoverage, liquidType ),
"@brief Called whenever this RigidShape object enters liquid.\n\n"
"@param objId The ID of the rigidShape object.\n"
@ -1088,7 +1088,7 @@ void RigidShape::updatePos(F32 dt)
// Water script callbacks
if (!inLiquid && mWaterCoverage != 0.0f)
{
onEnterLiquid_callback(getIdString(), Con::getFloatArg(mWaterCoverage), mLiquidType.c_str() );
onEnterLiquid_callback(getIdString(), mWaterCoverage, mLiquidType.c_str() );
inLiquid = true;
}
else if (inLiquid && mWaterCoverage == 0.0f)

View file

@ -296,7 +296,7 @@ public:
void unpackUpdate(NetConnection *conn, BitStream *stream);
DECLARE_CONOBJECT(RigidShape);
DECLARE_CALLBACK( void, onEnterLiquid, ( const char* objId, const char* waterCoverage, const char* liquidType ));
DECLARE_CALLBACK( void, onEnterLiquid, ( const char* objId, F32 waterCoverage, const char* liquidType ));
DECLARE_CALLBACK( void, onLeaveLiquid, ( const char* objId, const char* liquidType ));
};