Skip to content
Merged
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
2 changes: 1 addition & 1 deletion Core/GameEngine/Source/Common/ReplaySimulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ int ReplaySimulation::simulateReplaysInThisProcess(const std::vector<AsciiString
DWORD totalStartTimeMillis = GetTickCount();
for (size_t i = 0; i < filenames.size(); i++)
{
AsciiString filename = filenames[i];
const AsciiString &filename = filenames[i];
printf("Simulating Replay \"%s\"\n", filename.str());
fflush(stdout);
DWORD startTimeMillis = GetTickCount();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void ControlBar::populatePurchaseScience( Player* player )

setControlCommand( m_sciencePurchaseWindowsRank3[ i ], commandButton );
ScienceType st = SCIENCE_INVALID;
ScienceVec sv = commandButton->getScienceVec();
const ScienceVec &sv = commandButton->getScienceVec();
if (! sv.empty())
{
st = sv[ 0 ];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@ GameMessageDisposition SelectionTranslator::onMetaSelectTeam(MAYBE_UNUSED const
Squad *selectedSquad = player->getHotkeySquad(group);
if (selectedSquad != nullptr)
{
VecObjectPtr objlist = selectedSquad->getLiveObjects();
const VecObjectPtr& objlist = selectedSquad->getLiveObjects();
Int numObjs = objlist.size();
if (numObjs > 0)
{
Expand All @@ -1201,7 +1201,7 @@ GameMessageDisposition SelectionTranslator::onMetaSelectTeam(MAYBE_UNUSED const
Squad *selectedSquad = player->getHotkeySquad(group);
if (selectedSquad != nullptr)
{
VecObjectPtr objlist = selectedSquad->getLiveObjects();
const VecObjectPtr& objlist = selectedSquad->getLiveObjects();
Int numObjs = objlist.size();
for (Int i = 0; i < numObjs; ++i)
{
Expand Down Expand Up @@ -1244,7 +1244,7 @@ GameMessageDisposition SelectionTranslator::onMetaAddTeam(MAYBE_UNUSED const Gam
Squad *selectedSquad = player->getHotkeySquad(group);
if (selectedSquad != nullptr)
{
VecObjectPtr objlist = selectedSquad->getLiveObjects();
const VecObjectPtr& objlist = selectedSquad->getLiveObjects();
Int numObjs = objlist.size();
if (numObjs > 0)
{
Expand Down Expand Up @@ -1275,7 +1275,7 @@ GameMessageDisposition SelectionTranslator::onMetaAddTeam(MAYBE_UNUSED const Gam
Squad *selectedSquad = player->getHotkeySquad(group);
if (selectedSquad != nullptr)
{
VecObjectPtr objlist = selectedSquad->getLiveObjects();
const VecObjectPtr& objlist = selectedSquad->getLiveObjects();
Int numObjs = objlist.size();

// TheSuperHackers @bugfix skyaero 22/07/2025 Can't select other units if you have a structure selected. So deselect the structure to prevent group force attack exploit.
Expand Down Expand Up @@ -1311,7 +1311,7 @@ GameMessageDisposition SelectionTranslator::onMetaViewTeam(MAYBE_UNUSED const Ga
Squad *selectedSquad = player->getHotkeySquad(group);
if (selectedSquad != nullptr)
{
VecObjectPtr objlist = selectedSquad->getLiveObjects();
const VecObjectPtr& objlist = selectedSquad->getLiveObjects();
Int numObjs = objlist.size();
if (numObjs > 0)
{
Expand Down
4 changes: 2 additions & 2 deletions Core/GameEngine/Source/GameNetwork/GameSpy/LadderDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ static LadderInfo *parseLadder(AsciiString raw)
AsciiStringList validFactions = lad->validFactions;
for (AsciiStringListIterator it = validFactions.begin(); it != validFactions.end(); ++it)
{
AsciiString faction = *it;
const AsciiString &faction = *it;
AsciiString marker;
marker.format("INI:Faction%s", faction.str());
DEBUG_LOG(("Faction %s has marker %s corresponding to str %ls", faction.str(), marker.str(), TheGameText->fetch(marker).str()));
Expand All @@ -196,7 +196,7 @@ static LadderInfo *parseLadder(AsciiString raw)
std::list<AsciiString> qmMaps = TheGameSpyConfig->getQMMaps();
for (std::list<AsciiString>::const_iterator it = qmMaps.begin(); it != qmMaps.end(); ++it)
{
AsciiString mapName = *it;
const AsciiString &mapName = *it;

// check sizes on the maps before allowing them
const MapMetaData *md = TheMapCache->findMap(mapName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2619,7 +2619,7 @@ void W3DModelDraw::recalcBonesForClientParticleSystems()
tmp.Scale(getDrawable()->getScale());
m_renderObject->Set_Transform(tmp); // set to identity transform

const Matrix3D boneTransform = m_renderObject->Get_Bone_Transform(boneIndex);
const Matrix3D& boneTransform = m_renderObject->Get_Bone_Transform(boneIndex);
Vector3 vpos = boneTransform.Get_Translation();
rotation = boneTransform.Get_Z_Rotation();

Expand Down Expand Up @@ -2690,7 +2690,7 @@ Bool W3DModelDraw::updateBonesForClientParticleSystems()
Int boneIndex = (*it).boneIndex;
if ( (sys != nullptr) && (boneIndex != 0) )
{
const Matrix3D boneTransform = m_renderObject->Get_Bone_Transform(boneIndex);// just a little worried about state changes
const Matrix3D& boneTransform = m_renderObject->Get_Bone_Transform(boneIndex);// just a little worried about state changes

Vector3 vpos = boneTransform.Get_Translation();

Expand Down Expand Up @@ -3516,7 +3516,7 @@ Bool W3DModelDraw::clientOnly_getRenderObjBoundBox(OBBoxClass * boundbox) const
AABoxClass aabox;
m_renderObject->Get_Obj_Space_Bounding_Box(aabox);

Matrix3D tm = m_renderObject->Get_Transform();
const Matrix3D& tm = m_renderObject->Get_Transform();

// build an OBB for this AAB,transform
OBBoxClass box0(aabox.Center,aabox.Extent);
Expand Down Expand Up @@ -3720,7 +3720,7 @@ Bool W3DModelDraw::handleWeaponFireFX(WeaponSlotType wslot, Int specificBarrelTo
if( ! m_renderObject->Is_Hidden() || (logicObject == nullptr) )
{
// I can ask the drawable's bone position if I am not hidden (if I have no object I have no choice)
Matrix3D mtx = m_renderObject->Get_Bone_Transform(info.m_fxBone);
const Matrix3D& mtx = m_renderObject->Get_Bone_Transform(info.m_fxBone);
Coord3D pos;
pos.x = mtx.Get_X_Translation();
pos.y = mtx.Get_Y_Translation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,6 @@ void FlatHeightMapRenderObjClass::Render(RenderInfoClass & rinfo)
W3DShaderManager::updateCloud();
}

Matrix3D tm(Transform);
// If there are trees, tell them to draw at the transparent time to draw.
if (m_treeBuffer) {
m_treeBuffer->setIsTerrain();
Expand All @@ -494,8 +493,7 @@ void FlatHeightMapRenderObjClass::Render(RenderInfoClass & rinfo)
DX8Wrapper::Set_Texture(1,nullptr);
ShaderClass::Invalidate();

// tm.Scale(ObjSpaceExtent);
DX8Wrapper::Set_Transform(D3DTS_WORLD,tm);
DX8Wrapper::Set_Transform(D3DTS_WORLD,Transform);


DX8Wrapper::Set_Material(m_vertexMaterialClass);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1884,7 +1884,6 @@ void HeightMapRenderObjClass::Render(RenderInfoClass & rinfo)
W3DShaderManager::updateCloud();
}

Matrix3D tm(Transform);
#if 0 // There is some weirdness sometimes with the dx8 static buffers.
// This usually fixes terrain flashing. jba.
static Int delay = 1;
Expand Down Expand Up @@ -1926,8 +1925,7 @@ void HeightMapRenderObjClass::Render(RenderInfoClass & rinfo)
DX8Wrapper::Set_Texture(1,nullptr);
ShaderClass::Invalidate();

// tm.Scale(ObjSpaceExtent);
DX8Wrapper::Set_Transform(D3DTS_WORLD,tm);
DX8Wrapper::Set_Transform(D3DTS_WORLD,Transform);

//Apply the shader and material

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ void W3DTerrainVisual::addFactionBib(Object *factionBuilding, Bool highlight, Re
pos.set(0,0,0);
Real exitWidth = factionBuilding->getTemplate()->getFactoryExitWidth();
Real extraWidth = factionBuilding->getTemplate()->getFactoryExtraBibWidth() + extra;
const GeometryInfo info = factionBuilding->getGeometryInfo();
const GeometryInfo &info = factionBuilding->getGeometryInfo();
Real sizeX = info.getMajorRadius();
Real sizeY = info.getMinorRadius();
if (info.getGeomType() != GEOMETRY_BOX) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ void W3DTreeBuffer::cull(const CameraClass * camera)
Int curTree;

// Calculate the vector direction that the camera is looking at.
Matrix3D camera_matrix = camera->Get_Transform();
const Matrix3D &camera_matrix = camera->Get_Transform();
float zmod = -1;
float x = zmod * camera_matrix[0][2] ;
float y = zmod * camera_matrix[1][2] ;
Expand Down Expand Up @@ -1280,7 +1280,7 @@ Int W3DTreeBuffer::addTreeType(const W3DTreeDrawModuleData *data)
if (robj->Class_ID() == RenderObjClass::CLASSID_HLOD) {
RenderObjClass *hlod = robj;
robj = hlod->Get_Sub_Object(0);
const Matrix3D xfm = robj->Get_Bone_Transform(0);
const Matrix3D& xfm = robj->Get_Bone_Transform(0);
xfm.Get_Translation(&offset);
REF_PTR_RELEASE(hlod);
}
Expand All @@ -1296,7 +1296,6 @@ Int W3DTreeBuffer::addTreeType(const W3DTreeDrawModuleData *data)
Int numVertex = m_treeTypes[m_numTreeTypes].m_mesh->Peek_Model()->Get_Vertex_Count();
Vector3 *pVert = m_treeTypes[m_numTreeTypes].m_mesh->Peek_Model()->Get_Vertex_Array();

const Matrix3D xfm = m_treeTypes[m_numTreeTypes].m_mesh->Get_Transform();
SphereClass bounds(pVert, numVertex);
bounds.Center += offset;
m_treeTypes[m_numTreeTypes].m_bounds = bounds;
Expand Down
2 changes: 1 addition & 1 deletion Core/Libraries/Source/WWVegas/WW3D2/intersec.inl
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ inline void IntersectionClass::Get_Screen_Ray(float screen_x, float screen_y, co
CameraClass *camera = Layer.Camera;

// determine the ray corresponding to the camera and distance to projection plane
Matrix3D camera_matrix = camera->Get_Transform();
const Matrix3D& camera_matrix = camera->Get_Transform();
Vector3 camera_location = camera->Get_Position();

// the projected ray has the same origin as the camera
Expand Down
4 changes: 2 additions & 2 deletions Core/Libraries/Source/WWVegas/WW3D2/rendobj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ float RenderObjClass::Get_Screen_Size(CameraClass &camera)
// accurate (perhaps by using the object-space bounding-box)
Vector3 cam = camera.Get_Position();

ViewportClass viewport = camera.Get_Viewport();
const ViewportClass &viewport = camera.Get_Viewport();
Vector2 vpr_min, vpr_max;
camera.Get_View_Plane(vpr_min, vpr_max);
float width_factor = viewport.Width() / (vpr_max.X - vpr_min.X);
Expand Down Expand Up @@ -1277,7 +1277,7 @@ void RenderObjPersistFactoryClass::Save(ChunkSaveClass & csave,PersistClass * ob
{
RenderObjClass * robj = (RenderObjClass *)obj;
const char * name = robj->Get_Name();
Matrix3D tm = robj->Get_Transform();
const Matrix3D& tm = robj->Get_Transform();

csave.Begin_Chunk(RENDOBJFACTORY_CHUNKID_VARIABLES);
WRITE_MICRO_CHUNK(csave,RENDOBJFACTORY_VARIABLE_OBJPOINTER,robj);
Expand Down
2 changes: 0 additions & 2 deletions Core/Libraries/Source/WWVegas/WW3D2/ringobj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,8 +690,6 @@ void RingRenderObjClass::Render(RenderInfoClass & rinfo)
// Process texture reductions:
// if (RingTexture) RingTexture->Process_Reduction();

Matrix3D temp = Transform;

// Do Time Based Animation
animate ();

Expand Down
2 changes: 1 addition & 1 deletion Core/Libraries/Source/WWVegas/WW3D2/shattersystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ void ShatterSystem::Shatter_Mesh(MeshClass * mesh,const Vector3 & point,const Ve
/*
** Object-space to world-space transform
*/
Matrix3D Mobj_to_world = mesh->Get_Transform();
const Matrix3D& Mobj_to_world = mesh->Get_Transform();

/*
** World-space to shatter-space transform
Expand Down
6 changes: 2 additions & 4 deletions Core/Libraries/Source/WWVegas/WW3D2/texproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -931,9 +931,8 @@ bool TexProjectClass::Compute_Perspective_Projection
** Calculate the axis-aligned bounding box of the model in the camera's coordinate system.
*/
AABoxClass box = obj_box;
Matrix3D obj_to_world = tm;
Matrix3D obj_to_texture;
Matrix3D::Multiply(texture_tm_inv,obj_to_world,&obj_to_texture);
Matrix3D::Multiply(texture_tm_inv,tm,&obj_to_texture);
box.Transform(obj_to_texture);

/*
Expand Down Expand Up @@ -1060,9 +1059,8 @@ bool TexProjectClass::Compute_Ortho_Projection
** Calculate the axis-aligned bounding box of the model in the camera's coordinate system.
*/
AABoxClass box = obj_box;
Matrix3D obj_to_world = tm;
Matrix3D obj_to_texture;
Matrix3D::Multiply(texture_tm_inv,obj_to_world,&obj_to_texture);
Matrix3D::Multiply(texture_tm_inv,tm,&obj_to_texture);
box.Transform(obj_to_texture);

/*
Expand Down
3 changes: 1 addition & 2 deletions Core/Libraries/Source/WWVegas/WWAudio/Sound3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,8 @@ Sound3DClass::Set_Position (const Vector3 &position)
//
// Transform the sound's position into 'listener-space'
//
Vector3 sound_pos = position;
Vector3 listener_space_pos;
Matrix3D::Inverse_Transform_Vector (m_ListenerTransform, sound_pos, &listener_space_pos);
Matrix3D::Inverse_Transform_Vector (m_ListenerTransform, position, &listener_space_pos);

//
// Update the object's position inside of Miles
Expand Down
6 changes: 3 additions & 3 deletions Core/Tools/W3DView/W3DViewDoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1506,7 +1506,7 @@ CW3DViewDoc::SaveSettings
stringValue,
(LPCTSTR)stringCompleteFilename);

Matrix3D transform = m_pCSceneLight->Get_Transform ();
const Matrix3D& transform = m_pCSceneLight->Get_Transform ();
Quaternion orientation = ::Build_Quaternion (transform);

// Write the x-position out to the file
Expand Down Expand Up @@ -2379,7 +2379,7 @@ CW3DViewDoc::Make_Movie ()
if (index != -1) {

// Convert the bone's transform into a camera transform
Matrix3D transform = m_pCRenderObj->Get_Bone_Transform (index);
const Matrix3D& transform = m_pCRenderObj->Get_Bone_Transform (index);
Matrix3D cam_transform (Vector3 (0, -1, 0), Vector3 (0, 0, 1), Vector3 (-1, 0, 0), Vector3 (0, 0, 0));
#ifdef ALLOW_TEMPORARIES
Matrix3D new_transform = transform * cam_transform;
Expand Down Expand Up @@ -2719,7 +2719,7 @@ CW3DViewDoc::Copy_Assets_To_Dir (LPCTSTR directory)
//
// Determine the source and destination filenames
//
StringClass filename = dependency_list[counter];
const StringClass &filename = dependency_list[counter];
CString src_filename = src_path + CString (filename);
CString dest_filename = dest_path + CString (filename);

Expand Down
4 changes: 2 additions & 2 deletions Core/Tools/textureCompress/textureCompress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ static void scanDir( const std::string& sourceDirName, const std::string& target
FileInfoSet::iterator fit = sourceFiles->find(f);
if (fit != sourceFiles->end())
{
FileInfo sf = *fit;
const FileInfo &sf = *fit;
if (f.modTime < sf.modTime)
{
/**
Expand Down Expand Up @@ -563,7 +563,7 @@ static void scanDir( const std::string& sourceDirName, const std::string& target
FileInfoSet::iterator fit = cacheFiles->find(f);
if (fit != cacheFiles->end())
{
FileInfo cf = *fit;
const FileInfo &cf = *fit;
if (cf.modTime < f.modTime)
{
origFilesToCompress.insert(fname);
Expand Down
4 changes: 2 additions & 2 deletions Generals/Code/GameEngine/Source/Common/RTS/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3541,7 +3541,7 @@ void Player::processSelectTeamGameMessage(Int hotkeyNum) {

m_currentSelection->clearSquad();

VecObjectPtr objectList = m_squads[hotkeyNum]->getLiveObjects();
const VecObjectPtr& objectList = m_squads[hotkeyNum]->getLiveObjects();
Int numObjs = objectList.size();

for (Int i = 0; i < numObjs; ++i) {
Expand All @@ -3566,7 +3566,7 @@ void Player::processAddTeamGameMessage(Int hotkeyNum) {
m_currentSelection = newInstance( Squad );
}

VecObjectPtr objectList = m_squads[hotkeyNum]->getLiveObjects();
const VecObjectPtr& objectList = m_squads[hotkeyNum]->getLiveObjects();
Int numObjs = objectList.size();

for (Int i = 0; i < numObjs; ++i) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ void PopulateOldBuddyMessages()
BuddyMessageList *messages = TheGameSpyInfo->getBuddyMessages();
for (BuddyMessageList::iterator mIt = messages->begin(); mIt != messages->end(); ++mIt)
{
BuddyMessage message = *mIt;
const BuddyMessage &message = *mIt;
insertChat(message);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ static void populateQuickMatchMapSelectListbox( QuickMatchPreferences& pref )
GadgetListBoxReset(listboxMapSelect);
for (std::list<AsciiString>::const_iterator it = maps.begin(); it != maps.end(); ++it)
{
AsciiString theMap = *it;
const AsciiString &theMap = *it;
const MapMetaData *md = TheMapCache->findMap(theMap);
if (md && md->m_numPlayers >= numPlayers)
{
Expand Down Expand Up @@ -1670,7 +1670,7 @@ WindowMsgHandledType WOLQuickMatchMenuSystem( GameWindow *window, UnsignedInt ms
if (cit != ladderInfo->validFactions.end())
{
Int numPlayerTemplates = ThePlayerTemplateStore->getPlayerTemplateCount();
AsciiString sideStr = *cit;
const AsciiString &sideStr = *cit;
DEBUG_LOG(("Chose %s as our side... finding", sideStr.str()));
for (Int c=0; c<numPlayerTemplates; ++c)
{
Expand Down
4 changes: 2 additions & 2 deletions Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5781,7 +5781,7 @@ Object *AIAttackSquadState::chooseVictim()
case DIFFICULTY_EASY:
{
// pick a random unit
VecObjectPtr objects = victimSquad->getLiveObjects();
const VecObjectPtr& objects = victimSquad->getLiveObjects();
Int numUnits = objects.size();
if (numUnits == 0)
{
Expand Down Expand Up @@ -5809,7 +5809,7 @@ Object *AIAttackSquadState::chooseVictim()
case DIFFICULTY_HARD:
{
// everyone picks the same unit
VecObjectPtr objects = victimSquad->getLiveObjects();
const VecObjectPtr& objects = victimSquad->getLiveObjects();
if (!objects.empty())
{
return objects[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ void ScriptActions::doCreateReinforcements(const AsciiString& team, const AsciiS

PartitionSolver partition(vecOfUnits, vecOfTransports, PREFER_FAST_SOLUTION);
partition.solve();
SolutionVec solution = partition.getSolution();
const SolutionVec& solution = partition.getSolution();
for (size_t i = 0; i < solution.size(); ++i) {
Object *unit = TheGameLogic->findObjectByID(solution[i].first);
Object *trans = TheGameLogic->findObjectByID(solution[i].second);
Expand Down Expand Up @@ -1463,7 +1463,7 @@ void ScriptActions::doLoadAllTransports(const AsciiString& teamName)

PartitionSolver partition(vecOfUnits, vecOfTransports, PREFER_FAST_SOLUTION);
partition.solve();
SolutionVec solution = partition.getSolution();
const SolutionVec& solution = partition.getSolution();
for (size_t i = 0; i < solution.size(); ++i) {
Object *unit = TheGameLogic->findObjectByID(solution[i].first);
Object *trans = TheGameLogic->findObjectByID(solution[i].second);
Expand Down
Loading
Loading