mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-19 19:35:26 +00:00
Use fixed buffer size var when allocating return buffer from console.
Conflicts: Engine/source/T3D/missionArea.cpp Engine/source/gui/editor/guiDebugger.cpp
This commit is contained in:
parent
d0a64026b0
commit
f3fc84738b
42 changed files with 300 additions and 204 deletions
|
|
@ -457,8 +457,9 @@ ConsoleMethod( AIClient, getAimLocation, const char *, 2, 2, "ai.getAimLocation(
|
|||
AIClient *ai = static_cast<AIClient *>( object );
|
||||
Point3F aimPoint = ai->getAimLocation();
|
||||
|
||||
char *returnBuffer = Con::getReturnBuffer( 256 );
|
||||
dSprintf( returnBuffer, 256, "%f %f %f", aimPoint.x, aimPoint.y, aimPoint.z );
|
||||
static const U32 bufSize = 256;
|
||||
char *returnBuffer = Con::getReturnBuffer( bufSize );
|
||||
dSprintf( returnBuffer, bufSize, "%f %f %f", aimPoint.x, aimPoint.y, aimPoint.z );
|
||||
|
||||
return returnBuffer;
|
||||
}
|
||||
|
|
@ -470,8 +471,9 @@ ConsoleMethod( AIClient, getMoveDestination, const char *, 2, 2, "ai.getMoveDest
|
|||
AIClient *ai = static_cast<AIClient *>( object );
|
||||
Point3F movePoint = ai->getMoveDestination();
|
||||
|
||||
char *returnBuffer = Con::getReturnBuffer( 256 );
|
||||
dSprintf( returnBuffer, 256, "%f %f %f", movePoint.x, movePoint.y, movePoint.z );
|
||||
static const U32 bufSize = 256;
|
||||
char *returnBuffer = Con::getReturnBuffer( bufSize );
|
||||
dSprintf( returnBuffer, bufSize, "%f %f %f", movePoint.x, movePoint.y, movePoint.z );
|
||||
|
||||
return returnBuffer;
|
||||
}
|
||||
|
|
@ -522,8 +524,9 @@ ConsoleMethod( AIClient, getLocation, const char *, 2, 2, "ai.getLocation();" )
|
|||
AIClient *ai = static_cast<AIClient *>( object );
|
||||
Point3F locPoint = ai->getLocation();
|
||||
|
||||
char *returnBuffer = Con::getReturnBuffer( 256 );
|
||||
dSprintf( returnBuffer, 256, "%f %f %f", locPoint.x, locPoint.y, locPoint.z );
|
||||
static const U32 bufSize = 256;
|
||||
char *returnBuffer = Con::getReturnBuffer( bufSize );
|
||||
dSprintf( returnBuffer, bufSize, "%f %f %f", locPoint.x, locPoint.y, locPoint.z );
|
||||
|
||||
return returnBuffer;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,9 +145,10 @@ ConsoleFunction(containerFindFirst, const char*, 6, 6, "(int mask, Point3F point
|
|||
|
||||
//return the first element
|
||||
sgServerQueryIndex = 0;
|
||||
char *buff = Con::getReturnBuffer(100);
|
||||
static const U32 bufSize = 100;
|
||||
char *buff = Con::getReturnBuffer(bufSize);
|
||||
if (sgServerQueryList.mList.size())
|
||||
dSprintf(buff, 100, "%d", sgServerQueryList.mList[sgServerQueryIndex++]->getId());
|
||||
dSprintf(buff, bufSize, "%d", sgServerQueryList.mList[sgServerQueryIndex++]->getId());
|
||||
else
|
||||
buff[0] = '\0';
|
||||
|
||||
|
|
@ -162,9 +163,10 @@ ConsoleFunction( containerFindNext, const char*, 1, 1, "()"
|
|||
"@ingroup Game")
|
||||
{
|
||||
//return the next element
|
||||
char *buff = Con::getReturnBuffer(100);
|
||||
static const U32 bufSize = 100;
|
||||
char *buff = Con::getReturnBuffer(bufSize);
|
||||
if (sgServerQueryIndex < sgServerQueryList.mList.size())
|
||||
dSprintf(buff, 100, "%d", sgServerQueryList.mList[sgServerQueryIndex++]->getId());
|
||||
dSprintf(buff, bufSize, "%d", sgServerQueryList.mList[sgServerQueryIndex++]->getId());
|
||||
else
|
||||
buff[0] = '\0';
|
||||
|
||||
|
|
|
|||
|
|
@ -1241,9 +1241,10 @@ DefineEngineMethod( Item, getLastStickyPos, const char*, (),,
|
|||
"@note Server side only.\n"
|
||||
)
|
||||
{
|
||||
char* ret = Con::getReturnBuffer(256);
|
||||
static const U32 bufSize = 256;
|
||||
char* ret = Con::getReturnBuffer(bufSize);
|
||||
if (object->isServerObject())
|
||||
dSprintf(ret, 255, "%g %g %g",
|
||||
dSprintf(ret, bufSize, "%g %g %g",
|
||||
object->mStickyCollisionPos.x,
|
||||
object->mStickyCollisionPos.y,
|
||||
object->mStickyCollisionPos.z);
|
||||
|
|
@ -1263,9 +1264,10 @@ DefineEngineMethod( Item, getLastStickyNormal, const char *, (),,
|
|||
"@note Server side only.\n"
|
||||
)
|
||||
{
|
||||
char* ret = Con::getReturnBuffer(256);
|
||||
static const U32 bufSize = 256;
|
||||
char* ret = Con::getReturnBuffer(bufSize);
|
||||
if (object->isServerObject())
|
||||
dSprintf(ret, 255, "%g %g %g",
|
||||
dSprintf(ret, bufSize, "%g %g %g",
|
||||
object->mStickyCollisionNormal.x,
|
||||
object->mStickyCollisionNormal.y,
|
||||
object->mStickyCollisionNormal.z);
|
||||
|
|
|
|||
|
|
@ -176,10 +176,11 @@ DefineEngineFunction(getMissionAreaServerObject, MissionArea*, (),,
|
|||
DefineEngineMethod( MissionArea, getArea, const char *, (),,
|
||||
"Returns 4 fields: starting x, starting y, extents x, extents y.\n")
|
||||
{
|
||||
char* returnBuffer = Con::getReturnBuffer(48);
|
||||
static const U32 bufSize = 48;
|
||||
char* returnBuffer = Con::getReturnBuffer(bufSize);
|
||||
|
||||
RectI area = object->getArea();
|
||||
dSprintf(returnBuffer, 48, "%d %d %d %d", area.point.x, area.point.y, area.extent.x, area.extent.y);
|
||||
dSprintf(returnBuffer, bufSize, "%d %d %d %d", area.point.x, area.point.y, area.extent.x, area.extent.y);
|
||||
return(returnBuffer);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -304,8 +304,9 @@ ConsoleType( WayPointTeam, TypeWayPointTeam, WayPointTeam )
|
|||
|
||||
ConsoleGetType( TypeWayPointTeam )
|
||||
{
|
||||
char * buf = Con::getReturnBuffer(32);
|
||||
dSprintf(buf, 32, "%d", ((WayPointTeam*)dptr)->mTeamId);
|
||||
static const U32 bufSize = 32;
|
||||
char * buf = Con::getReturnBuffer(bufSize);
|
||||
dSprintf(buf, bufSize, "%d", ((WayPointTeam*)dptr)->mTeamId);
|
||||
return(buf);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6510,8 +6510,9 @@ DefineEngineMethod( Player, getDamageLocation, const char*, ( Point3F pos ),,
|
|||
|
||||
object->getDamageLocation(pos, buffer1, buffer2);
|
||||
|
||||
char *buff = Con::getReturnBuffer(128);
|
||||
dSprintf(buff, 128, "%s %s", buffer1, buffer2);
|
||||
static const U32 bufSize = 128;
|
||||
char *buff = Con::getReturnBuffer(bufSize);
|
||||
dSprintf(buff, bufSize, "%s %s", buffer1, buffer2);
|
||||
return buff;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -259,8 +259,9 @@ ConsoleGetType( TypeTriggerPolyhedron )
|
|||
AssertFatal(currVec == 3, "Internal error: Bad trigger polyhedron");
|
||||
|
||||
// Build output string.
|
||||
char* retBuf = Con::getReturnBuffer(1024);
|
||||
dSprintf(retBuf, 1023, "%7.7f %7.7f %7.7f %7.7f %7.7f %7.7f %7.7f %7.7f %7.7f %7.7f %7.7f %7.7f",
|
||||
static const U32 bufSize = 1024;
|
||||
char* retBuf = Con::getReturnBuffer(bufSize);
|
||||
dSprintf(retBuf, bufSize, "%7.7f %7.7f %7.7f %7.7f %7.7f %7.7f %7.7f %7.7f %7.7f %7.7f %7.7f %7.7f",
|
||||
origin.x, origin.y, origin.z,
|
||||
vecs[0].x, vecs[0].y, vecs[0].z,
|
||||
vecs[2].x, vecs[2].y, vecs[2].z,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue