Fixed bad string compares and simdictionary

This commit is contained in:
Vincent Gee 2014-11-04 19:51:13 -05:00
parent acb192e2a5
commit 9907c4592e
30 changed files with 169 additions and 202 deletions

View file

@ -456,29 +456,19 @@ DefineConsoleMethod( AIClient, setMoveDestination, void, (Point3F v), , "ai.setM
/**
* Returns the point the AI is aiming at
*/
DefineConsoleMethod( AIClient, getAimLocation, const char *, (),, "ai.getAimLocation();" )
DefineConsoleMethod( AIClient, getAimLocation, Point3F, (),, "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 );
return returnBuffer;
return ai->getAimLocation();
}
/**
* Returns the point the AI is set to move to
*/
DefineConsoleMethod( AIClient, getMoveDestination, const char *, (),, "ai.getMoveDestination();" )
DefineConsoleMethod( AIClient, getMoveDestination, Point3F, (),, "ai.getMoveDestination();" )
{
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 );
return returnBuffer;
return ai->getMoveDestination();
}
/**
@ -527,15 +517,10 @@ DefineConsoleMethod( AIClient, move, void, (),, "ai.move();" )
/**
* Gets the AI's location in the world
*/
DefineConsoleMethod( AIClient, getLocation, const char *, (),, "ai.getLocation();" )
DefineConsoleMethod( AIClient, getLocation, Point3F, (),, "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 );
return returnBuffer;
return ai->getLocation();
}
/**

View file

@ -34,7 +34,7 @@ ClientProcessList* ClientProcessList::smClientProcessList = NULL;
ServerProcessList* ServerProcessList::smServerProcessList = NULL;
static U32 gNetOrderNextId = 0;
DefineConsoleFunction( dumpProcessList, void, ( bool allow ), ,
DefineConsoleFunction( dumpProcessList, void, ( ), ,
"Dumps all ProcessObjects in ServerProcessList and ClientProcessList to the console." )
{
Con::printf( "client process list:" );

View file

@ -431,7 +431,7 @@ DefineConsoleMethod( LightBase, playAnimation, void, (const char * anim), (""),
"existing one is played."
"@hide")
{
if ( anim == "" )
if ( dStrcmp(anim,"" )==0)
{
object->playAnimation();
return;

View file

@ -223,6 +223,12 @@ ConsoleDocClass( WayPoint,
"@ingroup enviroMisc\n"
);
WayPointTeam::WayPointTeam()
{
mTeamId = 0;
mWayPoint = 0;
}
WayPoint::WayPoint()
{
mName = StringTable->insert("");
@ -246,6 +252,7 @@ bool WayPoint::onAdd()
Sim::getWayPointSet()->addObject(this);
else
{
mTeam.mWayPoint = this;
setMaskBits(UpdateNameMask|UpdateTeamMask);
}
@ -265,6 +272,8 @@ U32 WayPoint::packUpdate(NetConnection * con, U32 mask, BitStream * stream)
U32 retMask = Parent::packUpdate(con, mask, stream);
if(stream->writeFlag(mask & UpdateNameMask))
stream->writeString(mName);
if(stream->writeFlag(mask & UpdateTeamMask))
stream->write(mTeam.mTeamId);
if(stream->writeFlag(mask & UpdateHiddenMask))
stream->writeFlag(isHidden());
return(retMask);
@ -275,17 +284,51 @@ void WayPoint::unpackUpdate(NetConnection * con, BitStream * stream)
Parent::unpackUpdate(con, stream);
if(stream->readFlag())
mName = stream->readSTString(true);
if(stream->readFlag())
stream->read(&mTeam.mTeamId);
if(stream->readFlag())
setHidden(stream->readFlag());
}
//-----------------------------------------------------------------------------
// TypeWayPointTeam
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// TypeWayPointTeam
//-----------------------------------------------------------------------------
IMPLEMENT_STRUCT( WayPointTeam, WayPointTeam,, "" )
END_IMPLEMENT_STRUCT;
//FIXME: this should work but does not; need to check the stripping down to base types within TYPE
//ConsoleType( WayPointTeam, TypeWayPointTeam, WayPointTeam* )
ConsoleType( WayPointTeam, TypeWayPointTeam, WayPointTeam )
ConsoleGetType( TypeWayPointTeam )
{
static const U32 bufSize = 32;
char * buf = Con::getReturnBuffer(bufSize);
dSprintf(buf, bufSize, "%d", ((WayPointTeam*)dptr)->mTeamId);
return(buf);
}
ConsoleSetType( TypeWayPointTeam )
{
WayPointTeam * pTeam = (WayPointTeam*)dptr;
pTeam->mTeamId = dAtoi(argv[0]);
if(pTeam->mWayPoint && pTeam->mWayPoint->isServerObject())
pTeam->mWayPoint->setMaskBits(WayPoint::UpdateTeamMask);
}
void WayPoint::initPersistFields()
{
addGroup("Misc");
addField("markerName", TypeCaseString, Offset(mName, WayPoint), "Unique name representing this waypoint");
addField("team", TypeWayPointTeam, Offset(mTeam, WayPoint), "Unique numerical ID assigned to this waypoint, or set of waypoints");
endGroup("Misc");
Parent::initPersistFields();
}

View file

@ -92,6 +92,17 @@ class MissionMarker : public ShapeBase
// Class: WayPoint
//------------------------------------------------------------------------------
class WayPoint;
class WayPointTeam
{
public:
WayPointTeam();
S32 mTeamId;
WayPoint * mWayPoint;
};
DECLARE_STRUCT( WayPointTeam );
DefineConsoleType( TypeWayPointTeam, WayPointTeam * );
class WayPoint : public MissionMarker
{
@ -121,6 +132,7 @@ class WayPoint : public MissionMarker
// field data
StringTableEntry mName;
WayPointTeam mTeam;
static void initPersistFields();

View file

@ -5053,11 +5053,13 @@ DefineConsoleMethod(GuiTreeViewCtrl, getSelectedObject, S32, ( S32 index ), (0),
const char* GuiTreeViewCtrl::getSelectedObjectList()
{
char* buff = Con::getReturnBuffer(1024);
dSprintf(buff,1024,"");
static const U32 bufSize = 1024;
char* buff = Con::getReturnBuffer(bufSize);
dSprintf(buff,bufSize,"");
const Vector< GuiTreeViewCtrl::Item* > selectedItems = this->getSelectedItems();
for(int i = 0; i < selectedItems.size(); i++)
for(S32 i = 0; i < selectedItems.size(); i++)
{
GuiTreeViewCtrl::Item *item = selectedItems[i];
@ -5069,7 +5071,7 @@ const char* GuiTreeViewCtrl::getSelectedObjectList()
//the start of the buffer where we want to write
char* buffPart = buff+len;
//the size of the remaining buffer (-1 cause dStrlen doesn't count the \0)
S32 size = 1024-len-1;
S32 size = bufSize-len-1;
//write it:
if(size < 1)
{
@ -5085,37 +5087,9 @@ const char* GuiTreeViewCtrl::getSelectedObjectList()
}
DefineConsoleMethod(GuiTreeViewCtrl, getSelectedObjectList, const char*, (), ,
"Returns a space sperated list of all selected object ids.")
"Returns a space seperated list of all selected object ids.")
{
char* buff = Con::getReturnBuffer(1024);
dSprintf(buff,1024,"");
const Vector< GuiTreeViewCtrl::Item* > selectedItems = object->getSelectedItems();
for(int i = 0; i < selectedItems.size(); i++)
{
GuiTreeViewCtrl::Item *item = selectedItems[i];
if ( item->isInspectorData() && item->getObject() )
{
S32 id = item->getObject()->getId();
//get the current length of the buffer
U32 len = dStrlen(buff);
//the start of the buffer where we want to write
char* buffPart = buff+len;
//the size of the remaining buffer (-1 cause dStrlen doesn't count the \0)
S32 size = 1024-len-1;
//write it:
if(size < 1)
{
Con::errorf("GuiTreeViewCtrl::getSelectedItemList - Not enough room to return our object list");
return buff;
}
dSprintf(buffPart,size,"%d ", id);
}
}
return buff;
return object->getSelectedObjectList();
}
DefineConsoleMethod(GuiTreeViewCtrl, moveItemUp, void, (S32 index), , "(TreeItemId item)")

View file

@ -2810,28 +2810,11 @@ static ConsoleDocFragment _sGuiControlSetExtent2(
"void setExtent( Point2I p );" ); // The definition string.
//ConsoleMethod( GuiControl, setExtent, void, 3, 4,
DefineConsoleMethod( GuiControl, setExtent, void, ( Point2F ext ), ,
DefineConsoleMethod( GuiControl, setExtent, void, ( Point2I ext ), ,
" Set the width and height of the control.\n\n"
"@hide" )
{
//if ( argc == 3 )
//if ( pOrX != "" && y == "" )
//{
// // We scan for floats because its possible that math
// // done on the extent can result in fractional values.
// Point2F ext;
// //if ( dSscanf( argv[2], "%g %g", &ext.x, &ext.y ) == 2 )
// if ( dSscanf( pOrX, "%g %g", &ext.x, &ext.y ) == 2 )
object->setExtent( (S32)ext.x, (S32)ext.y );
// else
// Con::errorf( "GuiControl::setExtent, not enough parameters!" );
//}
////else if ( argc == 4 )
//else if ( pOrX != "" && y != "" )
//{
// //object->setExtent( dAtoi(argv[2]), dAtoi(argv[3]) );
// object->setExtent( dAtoi(pOrX), dAtoi(y) );
//}
}
//-----------------------------------------------------------------------------

View file

@ -1052,25 +1052,17 @@ DefineConsoleMethod(GuiParticleGraphCtrl, clearAllGraphs, void, (), , "()"
object->clearAllGraphs();
}
DefineConsoleMethod(GuiParticleGraphCtrl, addPlotPoint, const char*, (S32 plotID, F32 x, F32 y, bool setAdded), (true), "(int plotID, float x, float y, bool setAdded = true;)"
DefineConsoleMethod(GuiParticleGraphCtrl, addPlotPoint, S32, (S32 plotID, F32 x, F32 y, bool setAdded), (true), "(int plotID, float x, float y, bool setAdded = true;)"
"Add a data point to the given plot."
"@return")
{
S32 pointAdded = 0;
char *retBuffer = Con::getReturnBuffer(32);
if(plotID > object->MaxPlots)
{
Con::errorf("Invalid plotID.");
dSprintf(retBuffer, 32, "%d", -2);
return retBuffer;
return -2;
}
pointAdded = object->addPlotPoint( plotID, Point2F(x, y), setAdded);
dSprintf(retBuffer, 32, "%d", pointAdded);
return retBuffer;
return object->addPlotPoint( plotID, Point2F(x, y), setAdded);
}
DefineConsoleMethod(GuiParticleGraphCtrl, insertPlotPoint, void, (S32 plotID, S32 i, F32 x, F32 y), , "(int plotID, int i, float x, float y)\n"
@ -1088,7 +1080,7 @@ DefineConsoleMethod(GuiParticleGraphCtrl, insertPlotPoint, void, (S32 plotID, S3
object->insertPlotPoint( plotID, i, Point2F(x, y));
}
DefineConsoleMethod(GuiParticleGraphCtrl, changePlotPoint, const char*, (S32 plotID, S32 i, F32 x, F32 y), , "(int plotID, int i, float x, float y)"
DefineConsoleMethod(GuiParticleGraphCtrl, changePlotPoint, S32, (S32 plotID, S32 i, F32 x, F32 y), , "(int plotID, int i, float x, float y)"
"Change a data point to the given plot and plot position.\n"
"@param plotID The plot you want to access\n"
"@param i The data point.\n"
@ -1098,40 +1090,26 @@ DefineConsoleMethod(GuiParticleGraphCtrl, changePlotPoint, const char*, (S32 plo
if(plotID > object->MaxPlots)
{
Con::errorf("Invalid plotID.");
char *retBuffer = Con::getReturnBuffer(64);
const S32 index = -1;
dSprintf(retBuffer, 64, "%d", index);
return retBuffer;
return -1;
}
char *retBuffer = Con::getReturnBuffer(64);
const S32 index = object->changePlotPoint( plotID, i, Point2F(x, y));
dSprintf(retBuffer, 64, "%d", index);
return retBuffer;
return object->changePlotPoint( plotID, i, Point2F(x, y));
}
DefineConsoleMethod(GuiParticleGraphCtrl, getSelectedPlot, const char*, (), , "() "
DefineConsoleMethod(GuiParticleGraphCtrl, getSelectedPlot, S32, (), , "() "
"Gets the selected Plot (a.k.a. graph).\n"
"@return The plot's ID.")
{
char *retBuffer = Con::getReturnBuffer(32);
const S32 plot = object->getSelectedPlot();
dSprintf(retBuffer, 32, "%d", plot);
return retBuffer;
return object->getSelectedPlot();
}
DefineConsoleMethod(GuiParticleGraphCtrl, getSelectedPoint, const char*, (), , "()"
DefineConsoleMethod(GuiParticleGraphCtrl, getSelectedPoint, S32, (), , "()"
"Gets the selected Point on the Plot (a.k.a. graph)."
"@return The last selected point ID")
{
char *retBuffer = Con::getReturnBuffer(32);
const S32 point = object->getSelectedPoint();
dSprintf(retBuffer, 32, "%d", point);
return retBuffer;
return object->getSelectedPoint();
}
DefineConsoleMethod(GuiParticleGraphCtrl, isExistingPoint, const char*, (S32 plotID, S32 samples), , "(int plotID, int samples)"
DefineConsoleMethod(GuiParticleGraphCtrl, isExistingPoint, bool, (S32 plotID, S32 samples), , "(int plotID, int samples)"
"@return Returns true or false whether or not the point in the plot passed is an existing point.")
{
@ -1143,14 +1121,10 @@ DefineConsoleMethod(GuiParticleGraphCtrl, isExistingPoint, const char*, (S32 plo
{
Con::errorf("Invalid sample.");
}
char *retBuffer = Con::getReturnBuffer(32);
const bool isPoint = object->isExistingPoint(plotID, samples);
dSprintf(retBuffer, 32, "%d", isPoint);
return retBuffer;
return object->isExistingPoint(plotID, samples);
}
DefineConsoleMethod(GuiParticleGraphCtrl, getPlotPoint, const char*, (S32 plotID, S32 samples), , "(int plotID, int samples)"
DefineConsoleMethod(GuiParticleGraphCtrl, getPlotPoint, Point2F, (S32 plotID, S32 samples), , "(int plotID, int samples)"
"Get a data point from the plot specified, samples from the start of the graph."
"@return The data point ID")
{
@ -1164,13 +1138,11 @@ DefineConsoleMethod(GuiParticleGraphCtrl, getPlotPoint, const char*, (S32 plotID
Con::errorf("Invalid sample.");
}
char *retBuffer = Con::getReturnBuffer(64);
const Point2F &pos = object->getPlotPoint(plotID, samples);
dSprintf(retBuffer, 64, "%f %f", pos.x, pos.y);
return retBuffer;
return object->getPlotPoint(plotID, samples);
}
DefineConsoleMethod(GuiParticleGraphCtrl, getPlotIndex, const char*, (S32 plotID, F32 x, F32 y), , "(int plotID, float x, float y)\n"
DefineConsoleMethod(GuiParticleGraphCtrl, getPlotIndex, S32, (S32 plotID, F32 x, F32 y), , "(int plotID, float x, float y)\n"
"Gets the index of the point passed on the plotID passed (graph ID).\n"
"@param plotID The plot you wish to check.\n"
"@param x,y The coordinates of the point to get.\n"
@ -1181,14 +1153,10 @@ DefineConsoleMethod(GuiParticleGraphCtrl, getPlotIndex, const char*, (S32 plotID
{
Con::errorf("Invalid plotID.");
}
char *retBuffer = Con::getReturnBuffer(32);
const S32 &index = object->getPlotIndex(plotID, x, y);
dSprintf(retBuffer, 32, "%d", index);
return retBuffer;
return object->getPlotIndex(plotID, x, y);
}
DefineConsoleMethod(GuiParticleGraphCtrl, getGraphColor, const char*, (S32 plotID), , "(int plotID)"
DefineConsoleMethod(GuiParticleGraphCtrl, getGraphColor, ColorF, (S32 plotID), , "(int plotID)"
"Get the color of the graph passed."
"@return Returns the color of the graph as a string of RGB values formatted as \"R G B\"")
{
@ -1197,14 +1165,12 @@ DefineConsoleMethod(GuiParticleGraphCtrl, getGraphColor, const char*, (S32 plotI
{
Con::errorf("Invalid plotID.");
}
char *retBuffer = Con::getReturnBuffer(64);
const ColorF &color = object->getGraphColor(plotID);
dSprintf(retBuffer, 64, "%f %f %f", color.red, color.green, color.blue);
return retBuffer;
return object->getGraphColor(plotID);
}
DefineConsoleMethod(GuiParticleGraphCtrl, getGraphMin, const char*, (S32 plotID), , "(int plotID) "
DefineConsoleMethod(GuiParticleGraphCtrl, getGraphMin, Point2F, (S32 plotID), , "(int plotID) "
"Get the minimum values of the graph ranges.\n"
"@return Returns the minimum of the range formatted as \"x-min y-min\"")
{
@ -1213,14 +1179,10 @@ DefineConsoleMethod(GuiParticleGraphCtrl, getGraphMin, const char*, (S32 plotID)
{
Con::errorf("Invalid plotID.");
}
char *retBuffer = Con::getReturnBuffer(64);
const Point2F graphMin = object->getGraphMin(plotID);
dSprintf(retBuffer, 64, "%f %f", graphMin.x, graphMin.y);
return retBuffer;
return object->getGraphMin(plotID);
}
DefineConsoleMethod(GuiParticleGraphCtrl, getGraphMax, const char*, (S32 plotID), , "(int plotID) "
DefineConsoleMethod(GuiParticleGraphCtrl, getGraphMax, Point2F, (S32 plotID), , "(int plotID) "
"Get the maximum values of the graph ranges.\n"
"@return Returns the maximum of the range formatted as \"x-max y-max\"")
{
@ -1229,11 +1191,8 @@ DefineConsoleMethod(GuiParticleGraphCtrl, getGraphMax, const char*, (S32 plotID)
{
Con::errorf("Invalid plotID.");
}
char *retBuffer = Con::getReturnBuffer(64);
const Point2F graphMax = object->getGraphMax(plotID);
dSprintf(retBuffer, 64, "%f %f", graphMax.x, graphMax.y);
return retBuffer;
return object->getGraphMax(plotID);
}
DefineConsoleMethod(GuiParticleGraphCtrl, getGraphName, const char*, (S32 plotID), , "(int plotID) "

View file

@ -20,8 +20,6 @@
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "platform/platform.h"
#include "console/console.h"
#include "console/consoleTypes.h"
#include "gfx/bitmap/gBitmap.h"

View file

@ -818,15 +818,17 @@ DefineConsoleMethod( GuiDecalEditorCtrl, getDecalCount, S32, (), , "getDecalCoun
DefineConsoleMethod( GuiDecalEditorCtrl, getDecalTransform, const char*, ( U32 id ), , "getDecalTransform()" )
{
DecalInstance *decalInstance = gDecalManager->mDecalInstanceVec[id];
if( decalInstance == NULL )
return "";
char* returnBuffer = Con::getReturnBuffer(256);
returnBuffer[0] = 0;
static const U32 bufSize = 256;
char* returnBuffer = Con::getReturnBuffer(bufSize);
if ( decalInstance )
{
dSprintf(returnBuffer, 256, "%f %f %f %f %f %f %f",
dSprintf(returnBuffer, bufSize, "%f %f %f %f %f %f %f",
decalInstance->mPosition.x, decalInstance->mPosition.y, decalInstance->mPosition.z,
decalInstance->mTangent.x, decalInstance->mTangent.y, decalInstance->mTangent.z,
decalInstance->mSize);

View file

@ -97,7 +97,7 @@ void GuiMissionAreaEditorCtrl::setSelectedMissionArea( MissionArea *missionArea
DefineConsoleMethod( GuiMissionAreaEditorCtrl, setSelectedMissionArea, void, (const char * missionAreaName), (""), "" )
{
if ( missionAreaName == "" )
if ( dStrcmp( missionAreaName, "" )==0 )
object->setSelectedMissionArea(NULL);
else
{

View file

@ -1464,7 +1464,7 @@ DefineConsoleFunction( sfxCreateSource, S32, ( const char * SFXType, const char
if ( track )
{
if ( x == "" )
if (dStrcmp(x, "") == 0)
{
source = SFX->createSource( track );
}
@ -1674,7 +1674,7 @@ DefineConsoleFunction( sfxPlayOnce, S32, ( const char * SFXType, const char * fi
SFXSource* source = NULL;
if( track )
{
if( x == "" )
if (dStrcmp(x, "") == 0)
{
source = SFX->playOnce( track );
}
@ -1695,7 +1695,7 @@ DefineConsoleFunction( sfxPlayOnce, S32, ( const char * SFXType, const char * fi
}
else
{
if( x == "" )
if (dStrcmp(x, "") == 0)
source = SFX->playOnce( tempProfile );
else
{

View file

@ -169,7 +169,7 @@ DefineConsoleFunction( loadColladaLights, bool, (const char * filename, const ch
// the MissionGroup if not specified.
SimGroup* missionGroup = dynamic_cast<SimGroup*>(Sim::findObject("MissionGroup"));
SimGroup* group = 0;
if ( parentGroup != "" ) {
if (dStrcmp(parentGroup, "") == 0){
if (!Sim::findObject(parentGroup, group)) {
// Create the group if it could not be found
group = new SimGroup;
@ -188,7 +188,7 @@ DefineConsoleFunction( loadColladaLights, bool, (const char * filename, const ch
// Optional object to provide the base transform
MatrixF offset(true);
if (baseObject != "") {
if (dStrcmp(baseObject, "") != 0){
SceneObject *obj;
if (Sim::findObject(baseObject, obj))
offset = obj->getTransform();

View file

@ -507,7 +507,7 @@ DefineConsoleMethod( EventManager, dumpSubscribers, void, ( const char * listene
"Print all subscribers to an event to the console.\n"
"@param event The event whose subscribers are to be printed. If this parameter isn't specified, all events will be dumped." )
{
if( listenerName != "" )
if (dStrcmp(listenerName, "") != 0)
object->dumpSubscribers( listenerName );
else
object->dumpSubscribers();

View file

@ -648,7 +648,7 @@ DefineConsoleMethod(Settings, setValue, void, (const char * settingName, const c
{
const char *fieldName = StringTable->insert( settingName );
if( value != "")
if (dStrcmp(value, "") != 0)
object->setValue( fieldName, value );
else
object->setValue( fieldName );
@ -664,9 +664,9 @@ DefineConsoleMethod(Settings, value, const char*, (const char * settingName, con
{
const char *fieldName = StringTable->insert( settingName );
if(defaultValue != "")
if (dStrcmp(defaultValue, "") != 0)
return object->value( fieldName, defaultValue );
else if(settingName != "")
else if (dStrcmp(settingName, "") != 0)
return object->value( fieldName );
return "";

View file

@ -504,7 +504,7 @@ void UndoManager::popCompound( bool discard )
DefineConsoleMethod(UndoAction, addToManager, void, (const char * undoManager), (""), "action.addToManager([undoManager])")
{
UndoManager *theMan = NULL;
if(undoManager != "")
if (dStrcmp(undoManager, "") != 0)
{
SimObject *obj = Sim::findObject(undoManager);
if(obj)
@ -582,7 +582,7 @@ DefineConsoleMethod( UndoManager, popCompound, void, ( bool discard ), (false),
{
if( !object->getCompoundStackDepth() )
{
Con::errorf( "UndoManager::popCompound - no compound on stack" );
Con::errorf( "UndoManager::popCompound - no compound on stack (%s) ",object->getName() );
return;
}

View file

@ -112,7 +112,7 @@ function FormControlClass::onWake( %this )
%parentId = %this.getParent();
%extent = %parentID.getExtent();
%this.setExtent( GetWord(%extent, 0), GetWord(%extent, 1) );
%this.setExtent( GetWord(%extent, 0) @ " " @ GetWord(%extent, 1) );
GuiFormClass::BuildFormMenu( %this );

View file

@ -284,7 +284,7 @@ function GuiFormManager::ActivateLayout( %library, %layoutName, %parent )
// Size to fit parent container.
%extent = %parent.getExtent();
%layoutObj.setExtent( GetWord(%extent, 0), GetWord(%extent, 1) );
%layoutObj.setExtent( GetWord(%extent, 0) @ " " @ GetWord(%extent, 1) );
// Add to parent.
%parent.add( %layoutObj );

View file

@ -154,15 +154,15 @@ function GuiEditCanvas::onCreateMenu(%this)
barTitle = "Move";
internalName = "MoveMenu";
item[0] = "Nudge Left" TAB "Left" TAB "GuiEditor.moveSelection( -1, 0);";
item[1] = "Nudge Right" TAB "Right" TAB "GuiEditor.moveSelection( 1, 0);";
item[2] = "Nudge Up" TAB "Up" TAB "GuiEditor.moveSelection( 0, -1);";
item[3] = "Nudge Down" TAB "Down" TAB "GuiEditor.moveSelection( 0, 1 );";
item[0] = "Nudge Left" TAB "Left" TAB "GuiEditor.tmoveSelection( -1, 0);";
item[1] = "Nudge Right" TAB "Right" TAB "GuiEditor.tmoveSelection( 1, 0);";
item[2] = "Nudge Up" TAB "Up" TAB "GuiEditor.tmoveSelection( 0, -1);";
item[3] = "Nudge Down" TAB "Down" TAB "GuiEditor.tmoveSelection( 0, 1 );";
item[4] = "-";
item[5] = "Big Nudge Left" TAB "Shift Left" TAB "GuiEditor.moveSelection( - GuiEditor.snap2gridsize, 0 );";
item[6] = "Big Nudge Right" TAB "Shift Right" TAB "GuiEditor.moveSelection( GuiEditor.snap2gridsize, 0 );";
item[7] = "Big Nudge Up" TAB "Shift Up" TAB "GuiEditor.moveSelection( 0, - GuiEditor.snap2gridsize );";
item[8] = "Big Nudge Down" TAB "Shift Down" TAB "GuiEditor.moveSelection( 0, GuiEditor.snap2gridsize );";
item[5] = "Big Nudge Left" TAB "Shift Left" TAB "GuiEditor.tmoveSelection( - GuiEditor.snap2gridsize, 0 );";
item[6] = "Big Nudge Right" TAB "Shift Right" TAB "GuiEditor.tmoveSelection( GuiEditor.snap2gridsize, 0 );";
item[7] = "Big Nudge Up" TAB "Shift Up" TAB "GuiEditor.tmoveSelection( 0, - GuiEditor.snap2gridsize );";
item[8] = "Big Nudge Down" TAB "Shift Down" TAB "GuiEditor.tmoveSelection( 0, GuiEditor.snap2gridsize );";
};
new PopupMenu()
@ -201,6 +201,11 @@ function GuiEditCanvas::onCreateMenu(%this)
%this.menuBar.attachToCanvas( Canvas, 0 );
}
function GuiEditor::tMoveSelection (%x, %y)
{
GuiEditor.moveSelection(%x @ " " @ %y);
}
$GUI_EDITOR_MENU_EDGESNAP_INDEX = 0;
$GUI_EDITOR_MENU_CENTERSNAP_INDEX = 1;
$GUI_EDITOR_MENU_GUIDESNAP_INDEX = 3;

View file

@ -92,7 +92,7 @@ function GuiEditorGroup::group( %this )
%y = getWord( %bounds, 1 ) - getWord( %parentGlobalPos, 1 );
%group.setPosition( %x, %y );
%group.setExtent( getWord( %bounds, 2 ), getWord( %bounds, 3 ) );
%group.setExtent( getWord( %bounds, 2 ) @ " " @ getWord( %bounds, 3 ) );
// Reparent all objects to group.

View file

@ -402,3 +402,4 @@ function generateProceduralTerrainMask()
Canvas.popDialog(ProceduralTerrainPainterGui);
ETerrainEditor.autoMaterialLayer($TPPHeightMin, $TPPHeightMax, $TPPSlopeMin, $TPPSlopeMax, $TPPCoverage);
}

View file

@ -2350,12 +2350,12 @@ function EWToolsToolbar::reset( %this )
for( %i = 0 ; %i < %count; %i++ )
ToolsToolbarArray.getObject(%i).setVisible(true);
%this.setExtent((29 + 4) * %count + 12, 33);
%this.setExtent(((29 + 4) * %count + 12) @ " 33");
%this.isClosed = 0;
EWToolsToolbar.isDynamic = 0;
EWToolsToolbarDecoy.setVisible(false);
EWToolsToolbarDecoy.setExtent((29 + 4) * %count + 4, 31);
EWToolsToolbarDecoy.setExtent(((29 + 4) * %count + 4) @ " 31");
%this-->resizeArrow.setBitmap( "tools/gui/images/collapse-toolbar" );
}
@ -2376,7 +2376,7 @@ function EWToolsToolbar::toggleSize( %this, %useDynamics )
ToolsToolbarArray.getObject(%i).setVisible(false);
}
%this.setExtent(43, 33);
%this.setExtent("43 33");
%this.isClosed = 1;
if(!%useDynamics)
@ -2385,7 +2385,7 @@ function EWToolsToolbar::toggleSize( %this, %useDynamics )
EWToolsToolbar.isDynamic = 1;
}
EWToolsToolbarDecoy.setExtent(35, 31);
EWToolsToolbarDecoy.setExtent("35 31");
}
else
{
@ -2395,7 +2395,7 @@ function EWToolsToolbar::toggleSize( %this, %useDynamics )
for( %i = 0 ; %i < %count; %i++ )
ToolsToolbarArray.getObject(%i).setVisible(true);
%this.setExtent((29 + 4) * %count + 12, 33);
%this.setExtent(((29 + 4) * %count + 12) @ " 33");
%this.isClosed = 0;
if(!%useDynamics)
@ -2404,7 +2404,7 @@ function EWToolsToolbar::toggleSize( %this, %useDynamics )
EWToolsToolbar.isDynamic = 0;
}
EWToolsToolbarDecoy.setExtent((29 + 4) * %count + 4, 32);
EWToolsToolbarDecoy.setExtent(((29 + 4) * %count + 4) @ " 32");
}
%this-->resizeArrow.setBitmap( %image );

View file

@ -180,9 +180,9 @@ function MessageBoxOKCancelDetails(%title, %message, %details, %callback, %cance
%extentY = %textPosY + %textExtentY + 65;
MBOKCancelDetailsInfoText.setExtent(285, 128);
MBOKCancelDetailsInfoText.setExtent("285 128");
MBOKCancelDetailsFrame.setExtent(300, %extentY);
MBOKCancelDetailsFrame.setExtent("300 " @ %extentY);
MessageBoxOKCancelDetailsDlg.callback = %callback;
MessageBoxOKCancelDetailsDlg.cancelCallback = %cancelCallback;
@ -212,14 +212,14 @@ function MBOKCancelDetailsToggleInfoFrame()
%posY = %textPosY + %textExtentY + 10;
%posX = getWord(MBOKCancelDetailsScroll.getPosition(), 0);
MBOKCancelDetailsScroll.setPosition(%posX, %posY);
MBOKCancelDetailsScroll.setExtent(getWord(MBOKCancelDetailsScroll.getExtent(), 0), %verticalStretch);
MBOKCancelDetailsFrame.setExtent(300, %height + %verticalStretch + 10);
MBOKCancelDetailsScroll.setExtent(getWord(MBOKCancelDetailsScroll.getExtent(), 0) @ " " @ %verticalStretch);
MBOKCancelDetailsFrame.setExtent("300 " @ %height + %verticalStretch + 10);
} else
{
%extent = MBOKCancelDetailsFrame.defaultExtent;
%width = getWord(%extent, 0);
%height = getWord(%extent, 1);
MBOKCancelDetailsFrame.setExtent(%width, %height);
MBOKCancelDetailsFrame.setExtent(%width @ " " @ %height);
MBOKCancelDetailsScroll.setVisible(false);
}
}

View file

@ -159,7 +159,7 @@ function MainChatHud::setChatHudLength( %this, %length )
%lengthInPixels = $outerChatLenY[%length] * %textHeight;
%chatMargin = getWord(OuterChatHud.extent, 1) - getWord(ChatScrollHud.Extent, 1)
+ 2 * ChatScrollHud.profile.borderThickness;
OuterChatHud.setExtent(firstWord(OuterChatHud.extent), %lengthInPixels + %chatMargin);
OuterChatHud.setExtent(firstWord(OuterChatHud.extent) @ " " @ ( %lengthInPixels + %chatMargin));
ChatScrollHud.scrollToBottom();
ChatPageDown.setVisible(false);
}

View file

@ -181,7 +181,7 @@ function ChooseLevelDlg::onWake( %this )
%extentX = getWord(ChooseLevelWindow.getExtent(), 0);
%extentY = getWord(ChooseLevelWindow->SmallPreviews.getPosition(), 1);
ChooseLevelWIndow.setExtent(%extentX, %extentY);
ChooseLevelWIndow.setExtent(%extentX @ " " @ %extentY);
}
else
{
@ -194,7 +194,7 @@ function ChooseLevelDlg::onWake( %this )
%extentY = %extentY + getWord(ChooseLevelWindow->SmallPreviews.getExtent(), 1);
%extentY = %extentY + 9;
ChooseLevelWIndow.setExtent(%extentX, %extentY);
ChooseLevelWIndow.setExtent(%extentX @ " " @ %extentY);
}
}

View file

@ -112,7 +112,7 @@ function FormControlClass::onWake( %this )
%parentId = %this.getParent();
%extent = %parentID.getExtent();
%this.setExtent( GetWord(%extent, 0), GetWord(%extent, 1) );
%this.setExtent( GetWord(%extent, 0) @ " " @ GetWord(%extent, 1) );
GuiFormClass::BuildFormMenu( %this );

View file

@ -284,7 +284,7 @@ function GuiFormManager::ActivateLayout( %library, %layoutName, %parent )
// Size to fit parent container.
%extent = %parent.getExtent();
%layoutObj.setExtent( GetWord(%extent, 0), GetWord(%extent, 1) );
%layoutObj.setExtent( GetWord(%extent, 0) @ " " @ GetWord(%extent, 1) );
// Add to parent.
%parent.add( %layoutObj );

View file

@ -154,15 +154,15 @@ function GuiEditCanvas::onCreateMenu(%this)
barTitle = "Move";
internalName = "MoveMenu";
item[0] = "Nudge Left" TAB "Left" TAB "GuiEditor.moveSelection( -1, 0);";
item[1] = "Nudge Right" TAB "Right" TAB "GuiEditor.moveSelection( 1, 0);";
item[2] = "Nudge Up" TAB "Up" TAB "GuiEditor.moveSelection( 0, -1);";
item[3] = "Nudge Down" TAB "Down" TAB "GuiEditor.moveSelection( 0, 1 );";
item[0] = "Nudge Left" TAB "Left" TAB "GuiEditor.tmoveSelection( -1, 0);";
item[1] = "Nudge Right" TAB "Right" TAB "GuiEditor.tmoveSelection( 1, 0);";
item[2] = "Nudge Up" TAB "Up" TAB "GuiEditor.tmoveSelection( 0, -1);";
item[3] = "Nudge Down" TAB "Down" TAB "GuiEditor.tmoveSelection( 0, 1 );";
item[4] = "-";
item[5] = "Big Nudge Left" TAB "Shift Left" TAB "GuiEditor.moveSelection( - GuiEditor.snap2gridsize, 0 );";
item[6] = "Big Nudge Right" TAB "Shift Right" TAB "GuiEditor.moveSelection( GuiEditor.snap2gridsize, 0 );";
item[7] = "Big Nudge Up" TAB "Shift Up" TAB "GuiEditor.moveSelection( 0, - GuiEditor.snap2gridsize );";
item[8] = "Big Nudge Down" TAB "Shift Down" TAB "GuiEditor.moveSelection( 0, GuiEditor.snap2gridsize );";
item[5] = "Big Nudge Left" TAB "Shift Left" TAB "GuiEditor.tmoveSelection( - GuiEditor.snap2gridsize, 0 );";
item[6] = "Big Nudge Right" TAB "Shift Right" TAB "GuiEditor.tmoveSelection( GuiEditor.snap2gridsize, 0 );";
item[7] = "Big Nudge Up" TAB "Shift Up" TAB "GuiEditor.tmoveSelection( 0, - GuiEditor.snap2gridsize );";
item[8] = "Big Nudge Down" TAB "Shift Down" TAB "GuiEditor.tmoveSelection( 0, GuiEditor.snap2gridsize );";
};
new PopupMenu()
@ -201,6 +201,11 @@ function GuiEditCanvas::onCreateMenu(%this)
%this.menuBar.attachToCanvas( Canvas, 0 );
}
function GuiEditor::tMoveSelection (%x, %y)
{
GuiEditor.moveSelection(%x @ " " @ %y);
}
$GUI_EDITOR_MENU_EDGESNAP_INDEX = 0;
$GUI_EDITOR_MENU_CENTERSNAP_INDEX = 1;
$GUI_EDITOR_MENU_GUIDESNAP_INDEX = 3;

View file

@ -92,7 +92,7 @@ function GuiEditorGroup::group( %this )
%y = getWord( %bounds, 1 ) - getWord( %parentGlobalPos, 1 );
%group.setPosition( %x, %y );
%group.setExtent( getWord( %bounds, 2 ), getWord( %bounds, 3 ) );
%group.setExtent( getWord( %bounds, 2 ) @ " " @ getWord( %bounds, 3 ) );
// Reparent all objects to group.

View file

@ -2350,12 +2350,12 @@ function EWToolsToolbar::reset( %this )
for( %i = 0 ; %i < %count; %i++ )
ToolsToolbarArray.getObject(%i).setVisible(true);
%this.setExtent((29 + 4) * %count + 12, 33);
%this.setExtent(((29 + 4) * %count + 12) @ " 33");
%this.isClosed = 0;
EWToolsToolbar.isDynamic = 0;
EWToolsToolbarDecoy.setVisible(false);
EWToolsToolbarDecoy.setExtent((29 + 4) * %count + 4, 31);
EWToolsToolbarDecoy.setExtent(((29 + 4) * %count + 4) @ " 31");
%this-->resizeArrow.setBitmap( "tools/gui/images/collapse-toolbar" );
}
@ -2376,7 +2376,7 @@ function EWToolsToolbar::toggleSize( %this, %useDynamics )
ToolsToolbarArray.getObject(%i).setVisible(false);
}
%this.setExtent(43, 33);
%this.setExtent("43 33");
%this.isClosed = 1;
if(!%useDynamics)
@ -2385,7 +2385,7 @@ function EWToolsToolbar::toggleSize( %this, %useDynamics )
EWToolsToolbar.isDynamic = 1;
}
EWToolsToolbarDecoy.setExtent(35, 31);
EWToolsToolbarDecoy.setExtent("35 31");
}
else
{
@ -2395,7 +2395,7 @@ function EWToolsToolbar::toggleSize( %this, %useDynamics )
for( %i = 0 ; %i < %count; %i++ )
ToolsToolbarArray.getObject(%i).setVisible(true);
%this.setExtent((29 + 4) * %count + 12, 33);
%this.setExtent(((29 + 4) * %count + 12) @ " 33");
%this.isClosed = 0;
if(!%useDynamics)
@ -2404,7 +2404,7 @@ function EWToolsToolbar::toggleSize( %this, %useDynamics )
EWToolsToolbar.isDynamic = 0;
}
EWToolsToolbarDecoy.setExtent((29 + 4) * %count + 4, 32);
EWToolsToolbarDecoy.setExtent(((29 + 4) * %count + 4) @ " 32");
}
%this-->resizeArrow.setBitmap( %image );