Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,9 @@ void MapObject::fastAssignAllUniqueIDs()
void MapObject::setThingTemplate(const ThingTemplate *thing)
{
m_thingTemplate = thing;
m_objectName = thing->getName();
if (thing) {
m_objectName = thing->getName();
}
}


Expand Down
14 changes: 8 additions & 6 deletions Generals/Code/Tools/WorldBuilder/src/CUndoable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "GameLogic/SidesList.h"
#include "W3DDevice/GameClient/HeightMap.h"
#include "Common/Debug.h"
#include "Common/ThingTemplate.h"
#include "mapobjectprops.h"
#include "ObjectOptions.h"
#include "BuildList.h"
Expand Down Expand Up @@ -346,6 +347,8 @@ MoveInfo::MoveInfo( MapObject *pObjToMove):
m_oldLocation = *m_objectToModify->getLocation();
m_newThing = m_objectToModify->getThingTemplate();
m_oldThing = m_objectToModify->getThingTemplate();
m_newName = m_objectToModify->getName();
m_oldName = m_objectToModify->getName();
}

//
Expand Down Expand Up @@ -375,6 +378,9 @@ void MoveInfo::SetZOffset(CWorldBuilderDoc *pDoc, Real z)
void MoveInfo::SetThingTemplate(CWorldBuilderDoc *pDoc, const ThingTemplate* thing)
{
m_newThing = thing;
if (thing && thing != m_oldThing) {
m_newName = thing->getName();
}
DoMove(pDoc);
}

Expand Down Expand Up @@ -406,9 +412,7 @@ void MoveInfo::DoMove(CWorldBuilderDoc *pDoc)
if (m_newThing != m_oldThing) {
m_objectToModify->setThingTemplate(m_newThing);
}
if (m_newName != m_oldName) {
m_objectToModify->setName(m_newName);
}
m_objectToModify->setName(m_newName);
}

void MoveInfo::UndoMove(CWorldBuilderDoc *pDoc)
Expand All @@ -421,9 +425,7 @@ void MoveInfo::UndoMove(CWorldBuilderDoc *pDoc)
if (m_newThing != m_oldThing) {
m_objectToModify->setThingTemplate(m_oldThing);
}
if (m_newName != m_oldName) {
m_objectToModify->setName(m_oldName);
}
m_objectToModify->setName(m_oldName);
}

/*************************************************************************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ BOOL EditObjectParameter::OnInitDialog()
void EditObjectParameter::addObject( const ThingTemplate *thingTemplate )
{
HTREEITEM parent = TVI_ROOT;
const char *leafName;
const char *leafName = nullptr;
//
// if we have an thing template in mapObject, we've read it from the new INI database,
// we will sort those items into the tree based on properties of the template that
Expand Down
20 changes: 13 additions & 7 deletions Generals/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2006,6 +2006,8 @@ void WorldHeightMapEdit::addObject(MapObject *pMapObj)
void WorldHeightMapEdit::removeFirstObject()
{
MapObject *firstObj = MapObject::TheMapObjectListPtr;
if (!firstObj)
return;
MapObject::TheMapObjectListPtr = firstObj->getNext();
firstObj->setNextMap(nullptr); // so we don't delete the whole list.
deleteInstance(firstObj);
Expand Down Expand Up @@ -2045,20 +2047,22 @@ Bool WorldHeightMapEdit::selectDuplicates()
}

if (pObj->getFlag(FLAG_ROAD_FLAGS)) {
if (pObj->getNext() == nullptr) continue;
if (!pObj->getFlag(FLAG_ROAD_POINT1)) {
continue;
}
if (!prevObj->getFlag(FLAG_ROAD_POINT1)) {
continue;
}
Coord3D nextLoc = *pObj->getNext()->getLocation();
prevObj = prevObj->getNext();
if (!prevObj) continue;
if (!prevObj->getFlag(FLAG_ROAD_POINT2)) {
MapObject *nextObj = pObj->getNext();
if (!nextObj || !nextObj->getFlag(FLAG_ROAD_POINT2)) {
continue;
}
MapObject *prevNextObj = prevObj->getNext();
if (!prevNextObj || prevNextObj == pObj || !prevNextObj->getFlag(FLAG_ROAD_POINT2)) {
continue;
}
prevLoc = *prevObj->getLocation();
Coord3D nextLoc = *nextObj->getLocation();
prevLoc = *prevNextObj->getLocation();
if (abs(nextLoc.x-prevLoc.x)>DELTA) {
continue; // locations don't match.
}
Expand Down Expand Up @@ -3442,5 +3446,7 @@ void WorldHeightMapEdit::findBoundaryNear(Coord3D *pt, float okDistance, Int *ou
}

(*outNdx) = -1;
(*outHandle) = -1;
if (outHandle) {
(*outHandle) = -1;
}
}
14 changes: 8 additions & 6 deletions GeneralsMD/Code/Tools/WorldBuilder/src/CUndoable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "GameLogic/SidesList.h"
#include "W3DDevice/GameClient/HeightMap.h"
#include "Common/Debug.h"
#include "Common/ThingTemplate.h"
#include "mapobjectprops.h"
#include "ObjectOptions.h"
#include "BuildList.h"
Expand Down Expand Up @@ -346,6 +347,8 @@ MoveInfo::MoveInfo( MapObject *pObjToMove):
m_oldLocation = *m_objectToModify->getLocation();
m_newThing = m_objectToModify->getThingTemplate();
m_oldThing = m_objectToModify->getThingTemplate();
m_newName = m_objectToModify->getName();
m_oldName = m_objectToModify->getName();
}

//
Expand Down Expand Up @@ -375,6 +378,9 @@ void MoveInfo::SetZOffset(CWorldBuilderDoc *pDoc, Real z)
void MoveInfo::SetThingTemplate(CWorldBuilderDoc *pDoc, const ThingTemplate* thing)
{
m_newThing = thing;
if (thing && thing != m_oldThing) {
m_newName = thing->getName();
}
DoMove(pDoc);
}

Expand Down Expand Up @@ -406,9 +412,7 @@ void MoveInfo::DoMove(CWorldBuilderDoc *pDoc)
if (m_newThing != m_oldThing) {
m_objectToModify->setThingTemplate(m_newThing);
}
if (m_newName != m_oldName) {
m_objectToModify->setName(m_newName);
}
m_objectToModify->setName(m_newName);
}

void MoveInfo::UndoMove(CWorldBuilderDoc *pDoc)
Expand All @@ -421,9 +425,7 @@ void MoveInfo::UndoMove(CWorldBuilderDoc *pDoc)
if (m_newThing != m_oldThing) {
m_objectToModify->setThingTemplate(m_oldThing);
}
if (m_newName != m_oldName) {
m_objectToModify->setName(m_oldName);
}
m_objectToModify->setName(m_oldName);
}

/*************************************************************************
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ BOOL EditObjectParameter::OnInitDialog()
void EditObjectParameter::addObject( const ThingTemplate *thingTemplate )
{
HTREEITEM parent = TVI_ROOT;
const char *leafName;
const char *leafName = nullptr;
//
// if we have an thing template in mapObject, we've read it from the new INI database,
// we will sort those items into the tree based on properties of the template that
Expand Down
20 changes: 13 additions & 7 deletions GeneralsMD/Code/Tools/WorldBuilder/src/WHeightMapEdit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2006,6 +2006,8 @@ void WorldHeightMapEdit::addObject(MapObject *pMapObj)
void WorldHeightMapEdit::removeFirstObject()
{
MapObject *firstObj = MapObject::TheMapObjectListPtr;
if (!firstObj)
return;
MapObject::TheMapObjectListPtr = firstObj->getNext();
firstObj->setNextMap(nullptr); // so we don't delete the whole list.
deleteInstance(firstObj);
Expand Down Expand Up @@ -2045,20 +2047,22 @@ Bool WorldHeightMapEdit::selectDuplicates()
}

if (pObj->getFlag(FLAG_ROAD_FLAGS)) {
if (pObj->getNext() == nullptr) continue;
if (!pObj->getFlag(FLAG_ROAD_POINT1)) {
continue;
}
if (!prevObj->getFlag(FLAG_ROAD_POINT1)) {
continue;
}
Coord3D nextLoc = *pObj->getNext()->getLocation();
prevObj = prevObj->getNext();
if (!prevObj) continue;
if (!prevObj->getFlag(FLAG_ROAD_POINT2)) {
MapObject *nextObj = pObj->getNext();
if (!nextObj || !nextObj->getFlag(FLAG_ROAD_POINT2)) {
continue;
}
MapObject *prevNextObj = prevObj->getNext();
if (!prevNextObj || prevNextObj == pObj || !prevNextObj->getFlag(FLAG_ROAD_POINT2)) {
continue;
}
prevLoc = *prevObj->getLocation();
Coord3D nextLoc = *nextObj->getLocation();
prevLoc = *prevNextObj->getLocation();
if (abs(nextLoc.x-prevLoc.x)>DELTA) {
continue; // locations don't match.
}
Expand Down Expand Up @@ -3442,5 +3446,7 @@ void WorldHeightMapEdit::findBoundaryNear(Coord3D *pt, float okDistance, Int *ou
}

(*outNdx) = -1;
(*outHandle) = -1;
if (outHandle) {
(*outHandle) = -1;
}
}
Loading