Null checks, initilizations, etc
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "llsdutil.h"
|
||||
#include "llsdutil_math.h"
|
||||
|
||||
#include "v3math.h"
|
||||
#include "v4math.h"
|
||||
|
||||
@@ -349,6 +349,12 @@ const LLVector3* LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly_
|
||||
}
|
||||
}
|
||||
|
||||
llassert(driven);
|
||||
if (!driven)
|
||||
{
|
||||
return NULL; // shouldn't happen, but...
|
||||
}
|
||||
|
||||
// We're already in the middle of a param's distortions, so get the next one.
|
||||
const LLVector3* v = driven->mParam->getNextDistortion( index, poly_mesh );
|
||||
if( (!v) && (iter != mDriven.end()) )
|
||||
|
||||
@@ -395,9 +395,9 @@ BOOL LLFilePicker::getSaveFile(ESaveFilter filter, const std::string& filename)
|
||||
{
|
||||
wcsncpy( mFilesW,L"untitled.jpeg", FILENAME_BUFFER_SIZE); /*Flawfinder: ignore*/
|
||||
}
|
||||
mOFN.lpstrDefExt = L"jpeg";
|
||||
mOFN.lpstrDefExt = L"jpg";
|
||||
mOFN.lpstrFilter =
|
||||
L"JPEG Images (*.jpeg)\0*.jpeg\0" \
|
||||
L"JPEG Images (*.jpg *.jpeg)\0*.jpg;*.jpeg\0" \
|
||||
L"\0";
|
||||
break;
|
||||
case FFSAVE_AVI:
|
||||
|
||||
@@ -67,6 +67,7 @@ LLVolumeImplFlexible::LLVolumeImplFlexible(LLViewerObject* vo, LLFlexibleObjectD
|
||||
mInitializedRes = -1;
|
||||
mSimulateRes = 0;
|
||||
mFrameNum = 0;
|
||||
mCollisionSphereRadius = 0.f;
|
||||
mRenderRes = 1;
|
||||
|
||||
if(mVO->mDrawable.notNull())
|
||||
|
||||
@@ -1115,12 +1115,11 @@ void LLGestureManager::notifyObservers()
|
||||
{
|
||||
lldebugs << "LLGestureManager::notifyObservers" << llendl;
|
||||
|
||||
std::vector<LLGestureManagerObserver*> observers = mObservers;
|
||||
|
||||
std::vector<LLGestureManagerObserver*>::iterator it;
|
||||
for (it = observers.begin(); it != observers.end(); ++it)
|
||||
for(std::vector<LLGestureManagerObserver*>::iterator iter = mObservers.begin();
|
||||
iter != mObservers.end();
|
||||
++iter)
|
||||
{
|
||||
LLGestureManagerObserver* observer = *it;
|
||||
LLGestureManagerObserver* observer = (*iter);
|
||||
observer->changed();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ void LLHUDEffectSpiral::unpackData(LLMessageSystem *mesgsys, S32 blocknum)
|
||||
|
||||
LLHUDEffect::unpackData(mesgsys, blocknum);
|
||||
LLUUID object_id, target_object_id;
|
||||
S32 size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData);
|
||||
size_t size = mesgsys->getSizeFast(_PREHASH_Effect, blocknum, _PREHASH_TypeData);
|
||||
if (size != EFFECT_SIZE)
|
||||
{
|
||||
llwarns << "Spiral effect with bad size " << size << llendl;
|
||||
|
||||
@@ -62,11 +62,12 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
|
||||
const LLColor4& color,
|
||||
const BOOL orthographic)
|
||||
{
|
||||
LLViewerCamera* camera = LLViewerCamera::getInstance();
|
||||
// Do cheap plane culling
|
||||
LLVector3 dir_vec = pos_agent - LLViewerCamera::getInstance()->getOrigin();
|
||||
LLVector3 dir_vec = pos_agent - camera->getOrigin();
|
||||
dir_vec /= dir_vec.magVec();
|
||||
|
||||
if (wstr.empty() || (!orthographic && dir_vec * LLViewerCamera::getInstance()->getAtAxis() <= 0.f))
|
||||
if (wstr.empty() || (!orthographic && dir_vec * camera->getAtAxis() <= 0.f))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -80,15 +81,15 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
|
||||
}
|
||||
else
|
||||
{
|
||||
LLViewerCamera::getInstance()->getPixelVectors(pos_agent, up_axis, right_axis);
|
||||
camera->getPixelVectors(pos_agent, up_axis, right_axis);
|
||||
}
|
||||
LLCoordFrame render_frame = *LLViewerCamera::getInstance();
|
||||
LLCoordFrame render_frame = *camera;
|
||||
LLQuaternion rot;
|
||||
if (!orthographic)
|
||||
{
|
||||
rot = render_frame.getQuaternion();
|
||||
rot = rot * LLQuaternion(-F_PI_BY_TWO, LLViewerCamera::getInstance()->getYAxis());
|
||||
rot = rot * LLQuaternion(F_PI_BY_TWO, LLViewerCamera::getInstance()->getXAxis());
|
||||
rot = rot * LLQuaternion(-F_PI_BY_TWO, camera->getYAxis());
|
||||
rot = rot * LLQuaternion(F_PI_BY_TWO, camera->getXAxis());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -512,10 +512,11 @@ void LLManip::renderXYZ(const LLVector3 &vec)
|
||||
const S32 PAD = 10;
|
||||
std::string feedback_string;
|
||||
LLVector3 camera_pos = LLViewerCamera::getInstance()->getOrigin() + LLViewerCamera::getInstance()->getAtAxis();
|
||||
S32 vertical_offset = gViewerWindow->getWindowHeight() / 2 - VERTICAL_OFFSET;
|
||||
S32 window_center_x = gViewerWindow->getWindowWidth() / 2;
|
||||
S32 window_center_y = gViewerWindow->getWindowHeight() / 2;
|
||||
|
||||
S32 vertical_offset = window_center_y - VERTICAL_OFFSET;
|
||||
|
||||
|
||||
glPushMatrix();
|
||||
{
|
||||
LLUIImagePtr imagep = LLUI::getUIImage("rounded_square.tga");
|
||||
@@ -536,29 +537,30 @@ void LLManip::renderXYZ(const LLVector3 &vec)
|
||||
gViewerWindow->setup3DRender();
|
||||
|
||||
{
|
||||
const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF );
|
||||
LLLocale locale(LLLocale::USER_LOCALE);
|
||||
LLGLDepthTest gls_depth(GL_FALSE);
|
||||
// render drop shadowed text
|
||||
feedback_string = llformat("X: %.3f", vec.mV[VX]);
|
||||
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -102.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE);
|
||||
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, -102.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE);
|
||||
|
||||
feedback_string = llformat("Y: %.3f", vec.mV[VY]);
|
||||
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -27.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE);
|
||||
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, -27.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE);
|
||||
|
||||
feedback_string = llformat("Z: %.3f", vec.mV[VZ]);
|
||||
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, 48.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE);
|
||||
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, 48.f + 1.f, (F32)vertical_offset - 1.f, LLColor4::black, FALSE);
|
||||
|
||||
// render text on top
|
||||
feedback_string = llformat("X: %.3f", vec.mV[VX]);
|
||||
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -102.f, (F32)vertical_offset, LLColor4(1.f, 0.5f, 0.5f, 1.f), FALSE);
|
||||
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, -102.f, (F32)vertical_offset, LLColor4(1.f, 0.5f, 0.5f, 1.f), FALSE);
|
||||
|
||||
glColor3f(0.5f, 1.f, 0.5f);
|
||||
feedback_string = llformat("Y: %.3f", vec.mV[VY]);
|
||||
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, -27.f, (F32)vertical_offset, LLColor4(0.5f, 1.f, 0.5f, 1.f), FALSE);
|
||||
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, -27.f, (F32)vertical_offset, LLColor4(0.5f, 1.f, 0.5f, 1.f), FALSE);
|
||||
|
||||
glColor3f(0.5f, 0.5f, 1.f);
|
||||
feedback_string = llformat("Z: %.3f", vec.mV[VZ]);
|
||||
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ), LLFontGL::NORMAL, 48.f, (F32)vertical_offset, LLColor4(0.5f, 0.5f, 1.f, 1.f), FALSE);
|
||||
hud_render_text(utf8str_to_wstring(feedback_string), camera_pos, *font, LLFontGL::NORMAL, 48.f, (F32)vertical_offset, LLColor4(0.5f, 0.5f, 1.f, 1.f), FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -180,6 +180,7 @@ LLManipScale::LLManipScale( LLToolComposite* composite )
|
||||
mScaleSnapUnit2(1.f),
|
||||
mSnapRegimeOffset(0.f),
|
||||
mSnapGuideLength(0.f),
|
||||
mInSnapRegime(FALSE),
|
||||
mScaleSnapValue(0.f)
|
||||
{
|
||||
mManipulatorScales = new F32[NUM_MANIPULATORS];
|
||||
|
||||
@@ -276,9 +276,12 @@ void LLPanelFace::sendAlpha()
|
||||
void LLPanelFace::sendGlow()
|
||||
{
|
||||
LLSpinCtrl* mCtrlGlow = getChild<LLSpinCtrl>("glow");
|
||||
F32 glow = mCtrlGlow->get();
|
||||
|
||||
LLSelectMgr::getInstance()->selectionSetGlow( glow );
|
||||
llassert(mCtrlGlow);
|
||||
if (mCtrlGlow)
|
||||
{
|
||||
F32 glow = mCtrlGlow->get();
|
||||
LLSelectMgr::getInstance()->selectionSetGlow( glow );
|
||||
}
|
||||
}
|
||||
|
||||
struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor
|
||||
@@ -296,6 +299,8 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor
|
||||
LLCheckBoxCtrl* checkFlipScaleS = mPanel->getChild<LLCheckBoxCtrl>("checkbox flip s");
|
||||
LLCheckBoxCtrl* checkFlipScaleT = mPanel->getChild<LLCheckBoxCtrl>("checkbox flip t");
|
||||
LLComboBox* comboTexGen = mPanel->getChild<LLComboBox>("combobox texgen");
|
||||
llassert(comboTexGen);
|
||||
llassert(object);
|
||||
if (ctrlTexScaleS)
|
||||
{
|
||||
valid = !ctrlTexScaleS->getTentative() || !checkFlipScaleS->getTentative();
|
||||
@@ -306,7 +311,8 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor
|
||||
{
|
||||
value = -value;
|
||||
}
|
||||
if (comboTexGen->getCurrentIndex() == 1)
|
||||
if (comboTexGen &&
|
||||
comboTexGen->getCurrentIndex() == 1)
|
||||
{
|
||||
value *= 0.5f;
|
||||
}
|
||||
@@ -324,7 +330,8 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor
|
||||
{
|
||||
value = -value;
|
||||
}
|
||||
if (comboTexGen->getCurrentIndex() == 1)
|
||||
if (comboTexGen &&
|
||||
comboTexGen->getCurrentIndex() == 1)
|
||||
{
|
||||
value *= 0.5f;
|
||||
}
|
||||
|
||||
@@ -975,7 +975,10 @@ void LLVOSky::calcAtmospherics(void)
|
||||
}
|
||||
|
||||
temp2.mV[1] = llmax(0.f, lighty);
|
||||
temp2.mV[1] = 1.f / temp2.mV[1];
|
||||
if(temp2.mV[1] > 0.f)
|
||||
{
|
||||
temp2.mV[1] = 1.f / temp2.mV[1];
|
||||
}
|
||||
componentMultBy(sunlight, componentExp((light_atten * -1.f) * temp2.mV[1]));
|
||||
|
||||
// Distance
|
||||
|
||||
@@ -123,6 +123,7 @@ LLWorld::LLWorld() :
|
||||
|
||||
void LLWorld::destroyClass()
|
||||
{
|
||||
mHoleWaterObjects.clear();
|
||||
gObjectList.destroy();
|
||||
for(region_list_t::iterator region_it = mRegionList.begin(); region_it != mRegionList.end(); )
|
||||
{
|
||||
@@ -263,6 +264,7 @@ void LLWorld::removeRegion(const LLHost &host)
|
||||
|
||||
llwarns << "Disabling region " << regionp->getName() << " that agent is in!" << llendl;
|
||||
LLAppViewer::instance()->forceDisconnect("You have been disconnected from the region you were in.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user