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
2 changes: 1 addition & 1 deletion Core/GameEngine/Include/GameClient/TerrainVisual.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class TerrainVisual : public Snapshot,
virtual void reset() override;
virtual void update() override;

virtual Bool load( AsciiString filename );
virtual Bool load( const AsciiString& filename );

/// get color of texture on the terrain at location specified
virtual void getTerrainColorAt( Real x, Real y, RGBColor *pColor ) = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void TerrainVisual::update()
//-------------------------------------------------------------------------------------------------
/** device independent implementation for common terrain visual systems */
//-------------------------------------------------------------------------------------------------
Bool TerrainVisual::load( AsciiString filename )
Bool TerrainVisual::load( const AsciiString& filename )
{

// save the filename
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class W3DTerrainVisual : public TerrainVisual
virtual void reset() override;
virtual void update() override;

virtual Bool load( AsciiString filename ) override;
virtual Bool load( const AsciiString& filename ) override;

virtual void getTerrainColorAt( Real x, Real y, RGBColor *pColor ) override;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class WorldHeightMap : public RefCountClass,
/// UV mapping data for a cell to map into the alpha terrain texture.
void getAlphaUVData(Int xIndex, Int yIndex, float U[4], float V[4], UnsignedByte alpha[4], Bool *flip);
void getTerrainColorAt(Real x, Real y, RGBColor *pColor);
AsciiString getTerrainNameAt(Real x, Real y);
const AsciiString& getTerrainNameAt(Real x, Real y);
Bool isCliffMappedTexture(Int xIndex, Int yIndex);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ void W3DTerrainVisual::updateSeismicSimulations()
//-------------------------------------------------------------------------------------------------
/** load method for W3D visual terrain */
//-------------------------------------------------------------------------------------------------
Bool W3DTerrainVisual::load( AsciiString filename )
Bool W3DTerrainVisual::load( const AsciiString& filename )
{

#if 0
Expand Down Expand Up @@ -748,13 +748,13 @@ TerrainType *W3DTerrainVisual::getTerrainTile( Real x, Real y )
#ifdef DO_SEISMIC_SIMULATIONS
if( m_clientHeightMap )
{
AsciiString tileName = m_clientHeightMap->getTerrainNameAt( x, y );
const AsciiString& tileName = m_clientHeightMap->getTerrainNameAt( x, y );
tile = TheTerrainTypes->findTerrain( tileName );
}
#else
if( m_logicHeightMap )
{
AsciiString tileName = m_logicHeightMap->getTerrainNameAt( x, y );
const AsciiString& tileName = m_logicHeightMap->getTerrainNameAt( x, y );
tile = TheTerrainTypes->findTerrain( tileName );
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -957,7 +957,7 @@ void WaterTracksRenderSystem::saveTracks()
if (!TheTerrainLogic)
return;

AsciiString fileName=TheTerrainLogic->getSourceFilename();
const AsciiString& fileName=TheTerrainLogic->getSourceFilename();
char path[256];

strlcpy(path, fileName.str(), ARRAY_SIZE(path));
Expand Down Expand Up @@ -993,7 +993,7 @@ void WaterTracksRenderSystem::loadTracks()
if (!TheTerrainLogic)
return;

AsciiString fileName=TheTerrainLogic->getSourceFilename();
const AsciiString& fileName=TheTerrainLogic->getSourceFilename();
char path[256];

strlcpy(path, fileName.str(), ARRAY_SIZE(path));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2336,7 +2336,7 @@ void WorldHeightMap::getTerrainColorAt(Real x, Real y, RGBColor *pColor)
}
}

AsciiString WorldHeightMap::getTerrainNameAt(Real x, Real y)
const AsciiString& WorldHeightMap::getTerrainNameAt(Real x, Real y)
{
Int xIndex = REAL_TO_INT_FLOOR(x/MAP_XY_FACTOR);
Int yIndex = REAL_TO_INT_FLOOR(y/MAP_XY_FACTOR);
Expand Down
4 changes: 2 additions & 2 deletions Generals/Code/GameEngine/Include/Common/MapReaderWriterInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class CachedFileInputStream : public ChunkInputStream
public:
CachedFileInputStream();
~CachedFileInputStream();
Bool open(AsciiString path); ///< Returns true if open succeeded.
Bool open(const AsciiString& path); ///< Returns true if open succeeded.
void close(); ///< Explict close. Destructor closes if file is left open.
virtual Int read(void *pData, Int numBytes) override;
virtual UnsignedInt tell() override;
Expand All @@ -104,7 +104,7 @@ class FileInputStream : public ChunkInputStream
public:
FileInputStream();
~FileInputStream();
Bool open(AsciiString path); ///< Returns true if open succeeded.
Bool open(const AsciiString& path); ///< Returns true if open succeeded.
void close(); ///< Explict close. Destructor closes if file is left open.
virtual Int read(void *pData, Int numBytes);
virtual UnsignedInt tell();
Expand Down
12 changes: 6 additions & 6 deletions Generals/Code/GameEngine/Include/Common/TerrainTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class TerrainType : public MemoryPoolObject
// destructor prototype defined by memory pool glue

/// get the name for this terrain
AsciiString getName() { return m_name; }
const AsciiString& getName() { return m_name; }

/// get whether this terrain is blend edge terrain.
Bool isBlendEdge() { return m_blendEdgeTexture; }
Expand All @@ -164,19 +164,19 @@ class TerrainType : public MemoryPoolObject
Bool getRestrictConstruction() { return m_restrictConstruction; }

/// get the texture file for this terrain
AsciiString getTexture() { return m_texture; }
const AsciiString& getTexture() { return m_texture; }

/// get next terrain in list, only for use by the terrain collection
TerrainType *friend_getNext() { return m_next; }

/// set the name for this terrain, for use by terrain collection only
void friend_setName( AsciiString name ) { m_name = name; }
void friend_setName( const AsciiString& name ) { m_name = name; }

/// set the next pointer for the terrain list, for use by terrain collection only
void friend_setNext( TerrainType *next ) { m_next = next; }

/// set the texture, for use by terrain collection only
void friend_setTexture( AsciiString texture ) { m_texture = texture; }
void friend_setTexture( const AsciiString& texture ) { m_texture = texture; }

/// set the class, for use by terrain collection only
void friend_setClass( TerrainClass terrainClass ) { m_class = terrainClass; }
Expand Down Expand Up @@ -219,8 +219,8 @@ class TerrainTypeCollection : public SubsystemInterface
virtual void reset() override { }
virtual void update() override { }

TerrainType *findTerrain( AsciiString name ); ///< find terrain by name
TerrainType *newTerrain( AsciiString name ); ///< allocate a new terrain
TerrainType *findTerrain( const AsciiString& name ); ///< find terrain by name
TerrainType *newTerrain( const AsciiString& name ); ///< allocate a new terrain

/// get first terrain in list
TerrainType *firstTerrain() { return m_terrainList; }
Expand Down
6 changes: 3 additions & 3 deletions Generals/Code/GameEngine/Include/Common/ThingTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ class ModuleInfo
}
#endif

AsciiString getNthName(size_t i) const
const AsciiString& getNthName(size_t i) const
{
if (i >= 0 && i < m_info.size())
{
Expand All @@ -303,7 +303,7 @@ class ModuleInfo
return AsciiString::TheEmptyString;
}

AsciiString getNthTag(size_t i) const
const AsciiString& getNthTag(size_t i) const
{
if (i >= 0 && i < m_info.size())
{
Expand Down Expand Up @@ -608,7 +608,7 @@ class ThingTemplate : public Overridable
UnsignedByte getCrushableLevel() const { return m_crushableLevel; }
UnsignedByte getCrusherLevel() const { return m_crusherLevel; }

AsciiString getUpgradeCameoName( Int n)const{ return m_upgradeCameoUpgradeNames[n]; }
const AsciiString& getUpgradeCameoName( Int n)const{ return m_upgradeCameoUpgradeNames[n]; }

protected:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class PolygonTrigger : public MemoryPoolObject,
Int getID() const {return m_triggerID;}
PolygonTrigger *getNext() {return m_nextPolygonTrigger;}
const PolygonTrigger *getNext() const {return m_nextPolygonTrigger;}
AsciiString getTriggerName() const {return m_triggerName;} ///< Gets the trigger name.
const AsciiString& getTriggerName() const {return m_triggerName;} ///< Gets the trigger name.
Bool pointInTrigger(ICoord3D &point) const;
Bool doExportWithScripts() const {return m_exportWithScripts;}
void setDoExportWithScripts(Bool val) {m_exportWithScripts = val;}
Expand Down
30 changes: 15 additions & 15 deletions Generals/Code/GameEngine/Include/GameLogic/TerrainLogic.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ class Waypoint : public MemoryPoolObject
// friends do not play well with MPO (srj)
//friend class TerrainLogic;
public:
Waypoint(WaypointID id, AsciiString name, const Coord3D *pLoc, AsciiString label1,
AsciiString label2, AsciiString label3, Bool biDirectional);
Waypoint(WaypointID id, const AsciiString& name, const Coord3D *pLoc, const AsciiString& label1,
const AsciiString& label2, const AsciiString& label3, Bool biDirectional);
//~Waypoint();
enum {MAX_LINKS=8};

Expand Down Expand Up @@ -106,17 +106,17 @@ class Waypoint : public MemoryPoolObject
/// Get the n'th directed link. (May be nullptr).
Waypoint *getLink(Int ndx) const {if (ndx>=0 && ndx <= MAX_LINKS) return m_links[ndx]; return nullptr; }
/// Get the waypoint's name.
AsciiString getName() const {return m_name; }
const AsciiString& getName() const {return m_name; }
/// Get the integer id.
WaypointID getID() const {return m_id; }
/// Get the waypoint's position
const Coord3D *getLocation() const { return &m_location; }
/// Get the waypoint's first path label
AsciiString getPathLabel1() const { return m_pathLabel1; }
const AsciiString& getPathLabel1() const { return m_pathLabel1; }
/// Get the waypoint's second path label
AsciiString getPathLabel2() const { return m_pathLabel2; }
const AsciiString& getPathLabel2() const { return m_pathLabel2; }
/// Get the waypoint's third path label
AsciiString getPathLabel3() const { return m_pathLabel3; }
const AsciiString& getPathLabel3() const { return m_pathLabel3; }
/// Get bi-directionality.
Bool getBiDirectional() const { return m_biDirectional; }

Expand Down Expand Up @@ -183,7 +183,7 @@ class Bridge : public MemoryPoolObject

public:
/// return the bridge template name
AsciiString getBridgeTemplateName() { return m_templateName; }
const AsciiString& getBridgeTemplateName() { return m_templateName; }
/// Enumerate all bridges using getNext;
Bridge *getNext() {return m_next; }
/// Get the height for an object on bridge. Note - assumes object is on bridge. Use isPointOnBridge to check.
Expand Down Expand Up @@ -224,7 +224,7 @@ class TerrainLogic : public Snapshot,
virtual void reset() override; ///< Reset
virtual void update() override; ///< Update

virtual Bool loadMap( AsciiString filename, Bool query );
virtual Bool loadMap( const AsciiString& filename, Bool query );
virtual void newMap( Bool saveGame ); ///< Initialize the logic for new map.

virtual Real getGroundHeight( Real x, Real y, Coord3D* normal = nullptr ) const;
Expand All @@ -236,14 +236,14 @@ class TerrainLogic : public Snapshot,
virtual Coord3D findFarthestEdgePoint( const Coord3D *farthestFrom ) const ;
virtual Bool isClearLineOfSight(const Coord3D& pos, const Coord3D& posOther) const;

virtual AsciiString getSourceFilename() { return m_filenameString; }
virtual const AsciiString& getSourceFilename() { return m_filenameString; }

virtual PathfindLayerEnum alignOnTerrain( Real angle, const Coord3D& pos, Bool stickToGround, Matrix3D& mtx);

virtual Bool isUnderwater( Real x, Real y, Real *waterZ = nullptr, Real *terrainZ = nullptr ); ///< is point under water
virtual Bool isCliffCell( Real x, Real y) const; ///< is point cliff cell
virtual const WaterHandle* getWaterHandle( Real x, Real y ); ///< get water handle at this location
virtual const WaterHandle* getWaterHandleByName( AsciiString name ); ///< get water handle by name
virtual const WaterHandle* getWaterHandleByName( const AsciiString& name ); ///< get water handle by name
virtual Real getWaterHeight( const WaterHandle *water ); ///< get height of water table
virtual void setWaterHeight( const WaterHandle *water,
Real height,
Expand All @@ -257,19 +257,19 @@ class TerrainLogic : public Snapshot,
virtual Waypoint *getFirstWaypoint() { return m_waypointListHead; }

/// Return the waypoint with the given name
virtual Waypoint *getWaypointByName( AsciiString name );
virtual Waypoint *getWaypointByName( const AsciiString& name );

/// Return the waypoint with the given ID
virtual Waypoint *getWaypointByID( UnsignedInt id );

/// Return the closest waypoint on the labeled path
virtual Waypoint *getClosestWaypointOnPath( const Coord3D *pos, AsciiString label );
virtual Waypoint *getClosestWaypointOnPath( const Coord3D *pos, const AsciiString& label );

/// Return true if the waypoint path containing pWay is labeled with the label.
virtual Bool isPurposeOfPath( Waypoint *pWay, AsciiString label );
virtual Bool isPurposeOfPath( Waypoint *pWay, const AsciiString& label );

/// Return the trigger area with the given name
virtual PolygonTrigger *getTriggerAreaByName( AsciiString name );
virtual PolygonTrigger *getTriggerAreaByName( const AsciiString& name );

///Gets the first bridge. Traverse all bridges using bridge->getNext();
virtual Bridge *getFirstBridge() const { return m_bridgeListHead; }
Expand All @@ -288,7 +288,7 @@ class TerrainLogic : public Snapshot,

virtual Drawable *pickBridge(const Vector3 &from, const Vector3 &to, Vector3 *pos);

virtual void addBridgeToLogic(BridgeInfo *pInfo, Dict *props, AsciiString bridgeTemplateName); ///< Adds a bridge's logical info.
virtual void addBridgeToLogic(BridgeInfo *pInfo, Dict *props, const AsciiString& bridgeTemplateName); ///< Adds a bridge's logical info.
virtual void addLandmarkBridgeToLogic(Object *bridgeObj); ///< Adds a bridge's logical info.
virtual void deleteBridge( Bridge *bridge ); ///< remove a bridge

Expand Down
4 changes: 2 additions & 2 deletions Generals/Code/GameEngine/Source/Common/System/DataChunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ CachedFileInputStream::~CachedFileInputStream()
m_buffer=nullptr;
}

Bool CachedFileInputStream::open(AsciiString path)
Bool CachedFileInputStream::open(const AsciiString& path)
{
File *file=TheFileSystem->openFile(path.str(), File::READ | File::BINARY);
m_size = 0;
Expand Down Expand Up @@ -166,7 +166,7 @@ FileInputStream::~FileInputStream()
}
}

Bool FileInputStream::open(AsciiString path)
Bool FileInputStream::open(const AsciiString& path)
{
m_file = TheFileSystem->openFile(path.str(), File::READ | File::BINARY);
return m_file == nullptr?false:true;
Expand Down
4 changes: 2 additions & 2 deletions Generals/Code/GameEngine/Source/Common/TerrainTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ TerrainTypeCollection::~TerrainTypeCollection()
//-------------------------------------------------------------------------------------------------
/** Find a terrain type given the name */
//-------------------------------------------------------------------------------------------------
TerrainType *TerrainTypeCollection::findTerrain( AsciiString name )
TerrainType *TerrainTypeCollection::findTerrain( const AsciiString& name )
{
TerrainType *terrain;

Expand All @@ -131,7 +131,7 @@ TerrainType *TerrainTypeCollection::findTerrain( AsciiString name )
//-------------------------------------------------------------------------------------------------
/** Allocate a new type, assign the name, and tie to type list */
//-------------------------------------------------------------------------------------------------
TerrainType *TerrainTypeCollection::newTerrain( AsciiString name )
TerrainType *TerrainTypeCollection::newTerrain( const AsciiString& name )
{
TerrainType *terrain = nullptr;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2661,7 +2661,7 @@ void ControlBar::setPortraitByObject( Object *obj )

for(Int i = 0; i < MAX_UPGRADE_CAMEO_UPGRADES; ++i)
{
AsciiString upgradeName = thing->getUpgradeCameoName(i);
const AsciiString& upgradeName = thing->getUpgradeCameoName(i);
if(upgradeName.isEmpty())
{
m_rightHUDUpgradeCameos[i]->winHide(TRUE);
Expand Down
Loading
Loading