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: 2 additions & 0 deletions bin/World/SimpleEstuary/buoy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,5 @@ Lat(67)=50.0088
Type(68)="safe"
Long(68)=-9.979
Lat(68)=50.0396
Racon(68)="M"
RaconOnTime(68)=20
4 changes: 0 additions & 4 deletions bin/World/SimpleEstuary/radarreflector.ini

This file was deleted.

17 changes: 12 additions & 5 deletions doc/WorldFileSpec.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,23 @@ <h5>terrain.ini</h5>

<h5>buoy.ini</h5>

<p>Contains 1 general variable, and a set of 3 to 6 variables for each buoy defined. The global variable is Number, which is the number of
<p>Contains 1 general variable, and a set of 3 to 8 variables for each buoy defined. The global variable is Number, which is the number of
buoys to be defined in the file. This can be zero, in which case no buoys are defined, and nothing further is required in this file. The three
required variables for each buoy are Type(#), Long(#) and Lat(#). Type(#) takes the buoy type, as a text string. This must correspond to an
available buoy model as defined in the <i>Models\Buoy</i> folder under the Bridge Command root directory.
Long(#) and Lat(#) take respectively the buoy's Longitude and Latitude in standard decimal degrees. Note that only the buoy model and its
location is specified here - if the buoy has a light attached, it must be specified in <i>light.ini</i>, as specified below.
The first optional variable is RCS(#), which sets the buoy's radar cross section in metres squared. If not set, a default value will be used.
The second optional variable is Grounded(#). If set to 1, this means that the 'buoy' will not respond to wave or tide, for example
for a post. The third optional variable is HeightCorrection, which adjusts the vertical position of the buoy, and is set in metres, with a positive
value moving the 'buoy' higher. Again this is useful for adjusting the height of a post.</p>
</p>
<p>The optional variables are:</p>
<p>
<ul>
<li>RCS(#), which sets the buoy's radar cross section in metres squared. If not set, a default value will be used.</li>
<li>Racon(#), if set to a string of 1 or more characters, this RACON code will be shown in morse code on the radar.</li>
<li>RaconOnTime(#), used with the Racon setting above, sets how many seconds per minute the RACON is active for (default 20s per minute).</li>
<li>Grounded(#), if set to 1, this means that the 'buoy' will not respond to wave or tide, for example for a post.</li>
<li>HeightCorrection(#), which adjusts the vertical position of the buoy, and is set in metres, with a positive value moving the 'buoy' higher. Again this is useful for adjusting the height of a post.</li>
</ul>
</p>

<p>Note that a folder <i>Models/Buoy</i> can be created in the world model folder to hold buoys required for this world model. </p>

Expand Down
14 changes: 11 additions & 3 deletions src/Buoy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@

#include <iostream>
#include <algorithm>
#include <cstdlib> //For rand()

//using namespace irr;

Buoy::Buoy(const std::string& name, const std::string& internalName, const std::string& worldName, const irr::core::vector3df& location, irr::f32 radarCrossSection, bool floating, irr::f32 heightCorrection, irr::scene::ISceneManager* smgr, irr::IrrlichtDevice* dev)
Buoy::Buoy(const std::string& name, const std::string& internalName, const std::string& worldName, const irr::core::vector3df& location, irr::f32 radarCrossSection, std::string raconCode, irr::f32 raconOnTime, bool floating, irr::f32 heightCorrection, irr::scene::ISceneManager* smgr, irr::IrrlichtDevice* dev)
{

std::string basePath = "Models/Buoy/" + name + "/";
Expand Down Expand Up @@ -100,6 +101,11 @@ Buoy::Buoy(const std::string& name, const std::string& internalName, const std::
rcs = 0.005*std::pow(length,3); //Default RCS if not set, base radar cross section on length^3 (following RCS table Ship_RCS_table.pdf)
}

racon = raconCode;
this->raconOnTime = raconOnTime;

raconOffsetTime = 60.0f * (irr::f32) rand() / RAND_MAX;

this->floating = floating; //Does the buoy respond to the water

}
Expand Down Expand Up @@ -190,10 +196,12 @@ RadarData Buoy::getRadarData(irr::core::vector3df scannerPosition) const
radarData.minAngle=std::min(relAngle1,relAngle2);
radarData.maxAngle=std::max(relAngle1,relAngle2);

radarData.racon = racon; //Racon code if set
radarData.raconOnTime = raconOnTime;
radarData.raconOffsetTime = raconOffsetTime;

//Initial defaults: Will need changing with full implementation
radarData.hidden=false;
radarData.racon=""; //Racon code if set
radarData.raconOffsetTime=0.0;
radarData.SART=false;

radarData.contact = (void*)this;
Expand Down
5 changes: 4 additions & 1 deletion src/Buoy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct RadarData;
class Buoy
{
public:
Buoy(const std::string& name, const std::string& internalName, const std::string& worldName, const irr::core::vector3df& location, irr::f32 radarCrossSection, bool floating, irr::f32 heightCorrection, irr::scene::ISceneManager* smgr, irr::IrrlichtDevice* dev);
Buoy(const std::string& name, const std::string& internalName, const std::string& worldName, const irr::core::vector3df& location, irr::f32 radarCrossSection, std::string raconCode, irr::f32 raconOnTime, bool floating, irr::f32 heightCorrection, irr::scene::ISceneManager* smgr, irr::IrrlichtDevice* dev);
virtual ~Buoy();
irr::core::vector3df getPosition() const;
void setPosition(irr::core::vector3df position);
Expand All @@ -49,6 +49,9 @@ class Buoy
irr::f32 height; //For radar calculation
irr::f32 heightCorrection;
irr::f32 rcs;
std::string racon;
irr::f32 raconOnTime;
irr::f32 raconOffsetTime;
bool floating; //Does the buoy move with water (normally true, false for a post etc)
bool triangleSelectorEnabled; //Keep track of this so we don't keep re-setting the selector
};
Expand Down
4 changes: 3 additions & 1 deletion src/Buoys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ void Buoys::load(const std::string& worldName, irr::scene::ISceneManager* smgr,

//get buoy RCS if set
irr::f32 rcs = IniFile::iniFileTof32(scenarioBuoyFilename,IniFile::enumerate1("RCS",currentBuoy));
std::string racon = IniFile::iniFileToString(scenarioBuoyFilename, IniFile::enumerate1("RACON", currentBuoy));
irr::f32 raconOnTime = IniFile::iniFileTof32(scenarioBuoyFilename,IniFile::enumerate1("RaconOnTime",currentBuoy), 20.0f);

irr::f32 heightCorrection = IniFile::iniFileTof32(scenarioBuoyFilename,IniFile::enumerate1("HeightCorrection",currentBuoy));

Expand All @@ -75,7 +77,7 @@ void Buoys::load(const std::string& worldName, irr::scene::ISceneManager* smgr,
//Create buoy and load into vector
std::string internalName = "Buoy_";
internalName.append(std::to_string(currentBuoy-1)); // -1 as we want index from 0
buoys.push_back(Buoy (buoyName.c_str(),internalName,worldName,irr::core::vector3df(buoyX,0.0f,buoyZ),rcs,floating,heightCorrection,smgr,dev));
buoys.push_back(Buoy (buoyName.c_str(),internalName,worldName,irr::core::vector3df(buoyX,0.0f,buoyZ),rcs,racon,raconOnTime,floating,heightCorrection,smgr,dev));

//Find scene node
irr::scene::ISceneNode* buoyNode = buoys.back().getSceneNode();
Expand Down
2 changes: 0 additions & 2 deletions src/OtherShip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,6 @@ RadarData OtherShip::getRadarData(irr::core::vector3df scannerPosition) const

//Initial defaults: Fixme: Will need changing with full implementation
radarData.hidden=false;
radarData.racon=""; //Racon code if set
radarData.raconOffsetTime=0.0;
radarData.SART=false;

radarData.contact = (void*)this;
Expand Down
Loading
Loading