Rename fret/truck to cargo/transporter

master
Piotr Dziwinski 2015-06-29 23:05:31 +02:00
parent f0374dca38
commit f6bc8f94bf
41 changed files with 497 additions and 497 deletions

View File

@ -46,13 +46,13 @@ void SetTransparency(CObject* obj, float value)
{ {
obj->SetTransparency(value); obj->SetTransparency(value);
CObject *fret = obj->GetFret(); CObject *cargo = obj->GetCargo();
if (fret != NULL) if (cargo != NULL)
fret->SetTransparency(value); cargo->SetTransparency(value);
fret = obj->GetPower(); cargo = obj->GetPower();
if (fret != NULL) if (cargo != NULL)
fret->SetTransparency(value); cargo->SetTransparency(value);
} }
@ -245,7 +245,7 @@ void CCamera::SetType(CameraType type)
{ {
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {
if (obj->GetTruck()) if (obj->GetTransporter())
continue; // battery or cargo? continue; // battery or cargo?
SetTransparency(obj, 0.0f); // opaque object SetTransparency(obj, 0.0f); // opaque object
@ -890,7 +890,7 @@ bool CCamera::IsCollisionBack(Math::Vector &eye, Math::Vector lookat)
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {
if (obj->GetTruck()) continue; // battery or cargo? if (obj->GetTransporter()) continue; // battery or cargo?
SetTransparency(obj, 0.0f); // opaque object SetTransparency(obj, 0.0f); // opaque object

View File

@ -320,7 +320,7 @@ CObject* CLightning::SearchObject(Math::Vector pos)
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {
if (!obj->GetActive()) continue; // inactive object? if (!obj->GetActive()) continue; // inactive object?
if (obj->GetTruck() != nullptr) continue; // object transported? if (obj->GetTransporter() != nullptr) continue; // object transported?
ObjectType type = obj->GetType(); ObjectType type = obj->GetType();
if ( type == OBJECT_BASE || if ( type == OBJECT_BASE ||

View File

@ -1374,24 +1374,24 @@ void CPyro::DeleteObject(bool primary, bool secondary)
m_object->SetPower(nullptr); m_object->SetPower(nullptr);
} }
sub = m_object->GetFret(); sub = m_object->GetCargo();
if ( sub != nullptr ) if ( sub != nullptr )
{ {
CObjectManager::GetInstancePointer()->DeleteObject(sub); CObjectManager::GetInstancePointer()->DeleteObject(sub);
m_object->SetFret(nullptr); m_object->SetCargo(nullptr);
} }
} }
if (primary) if (primary)
{ {
CObject* truck = m_object->GetTruck(); CObject* transporter = m_object->GetTransporter();
if ( truck != nullptr ) // object carries? if ( transporter != nullptr ) // object carries?
{ {
if (truck->GetPower() == m_object) if (transporter->GetPower() == m_object)
truck->SetPower(nullptr); transporter->SetPower(nullptr);
if (truck->GetFret() == m_object) if (transporter->GetCargo() == m_object)
truck->SetFret(nullptr); transporter->SetCargo(nullptr);
} }
CObjectManager::GetInstancePointer()->DeleteObject(m_object); CObjectManager::GetInstancePointer()->DeleteObject(m_object);
@ -2262,7 +2262,7 @@ CObject* CPyro::FallSearchBeeExplo()
oType != OBJECT_POWER && oType != OBJECT_POWER &&
oType != OBJECT_ATOMIC ) continue; oType != OBJECT_ATOMIC ) continue;
if ( obj->GetTruck() != nullptr ) continue; // object transported? if ( obj->GetTransporter() != nullptr ) continue; // object transported?
Math::Vector oPos = obj->GetPosition(0); Math::Vector oPos = obj->GetPosition(0);

View File

@ -1244,7 +1244,7 @@ void CAutoBase::FreezeCargo(bool freeze)
obj->SetSpaceshipCargo(false); obj->SetSpaceshipCargo(false);
if ( obj == m_object ) continue; // yourself? if ( obj == m_object ) continue; // yourself?
if ( obj->GetTruck() != nullptr ) continue; // transport object? if ( obj->GetTransporter() != nullptr ) continue; // transport object?
Math::Vector oPos = obj->GetPosition(0); Math::Vector oPos = obj->GetPosition(0);
float dist = Math::DistanceProjected(m_pos, oPos); float dist = Math::DistanceProjected(m_pos, oPos);

View File

@ -58,10 +58,10 @@ void CAutoConvert::DeleteObject(bool all)
{ {
if ( !all ) if ( !all )
{ {
CObject* fret = SearchStone(OBJECT_STONE); CObject* cargo = SearchStone(OBJECT_STONE);
if ( fret != nullptr ) if ( cargo != nullptr )
{ {
CObjectManager::GetInstancePointer()->DeleteObject(fret); CObjectManager::GetInstancePointer()->DeleteObject(cargo);
} }
} }
@ -95,7 +95,7 @@ void CAutoConvert::Init()
bool CAutoConvert::EventProcess(const Event &event) bool CAutoConvert::EventProcess(const Event &event)
{ {
CObject* fret; CObject* cargo;
Math::Vector pos, speed; Math::Vector pos, speed;
Math::Point dim, c, p; Math::Point dim, c, p;
float angle; float angle;
@ -133,8 +133,8 @@ bool CAutoConvert::EventProcess(const Event &event)
{ {
if ( m_progress >= 1.0f ) if ( m_progress >= 1.0f )
{ {
fret = SearchStone(OBJECT_STONE); // Has stone transformed? cargo = SearchStone(OBJECT_STONE); // Has stone transformed?
if ( fret == 0 || SearchVehicle() ) if ( cargo == 0 || SearchVehicle() )
{ {
m_phase = ACP_WAIT; // still waiting ... m_phase = ACP_WAIT; // still waiting ...
m_progress = 0.0f; m_progress = 0.0f;
@ -142,7 +142,7 @@ bool CAutoConvert::EventProcess(const Event &event)
} }
else else
{ {
fret->SetLock(true); // stone usable cargo->SetLock(true); // stone usable
SetBusy(true); SetBusy(true);
InitProgressTotal(3.0f+10.0f+1.5f); InitProgressTotal(3.0f+10.0f+1.5f);
@ -229,12 +229,12 @@ bool CAutoConvert::EventProcess(const Event &event)
m_object->SetAngleY(2, 0.0f); m_object->SetAngleY(2, 0.0f);
m_object->SetAngleY(3, Math::PI); m_object->SetAngleY(3, Math::PI);
fret = SearchStone(OBJECT_STONE); cargo = SearchStone(OBJECT_STONE);
if ( fret != nullptr ) if ( cargo != nullptr )
{ {
m_bResetDelete = ( fret->GetResetCap() != RESET_NONE ); m_bResetDelete = ( cargo->GetResetCap() != RESET_NONE );
CObjectManager::GetInstancePointer()->DeleteObject(fret); CObjectManager::GetInstancePointer()->DeleteObject(cargo);
} }
CreateMetal(); // Create the metal CreateMetal(); // Create the metal
@ -401,7 +401,7 @@ CObject* CAutoConvert::SearchStone(ObjectType type)
{ {
ObjectType oType = obj->GetType(); ObjectType oType = obj->GetType();
if ( oType != type ) continue; if ( oType != type ) continue;
if ( obj->GetTruck() != nullptr ) continue; if ( obj->GetTransporter() != nullptr ) continue;
Math::Vector oPos = obj->GetPosition(0); Math::Vector oPos = obj->GetPosition(0);
float dist = Math::Distance(oPos, cPos); float dist = Math::Distance(oPos, cPos);
@ -480,11 +480,11 @@ void CAutoConvert::CreateMetal()
Math::Vector pos = m_object->GetPosition(0); Math::Vector pos = m_object->GetPosition(0);
float angle = m_object->GetAngleY(0); float angle = m_object->GetAngleY(0);
CObject* fret = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, OBJECT_METAL); CObject* cargo = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, OBJECT_METAL);
if ( m_bResetDelete ) if ( m_bResetDelete )
{ {
fret->SetResetCap(RESET_DELETE); cargo->SetResetCap(RESET_DELETE);
} }
m_main->DisplayError(INFO_CONVERT, m_object); m_main->DisplayError(INFO_CONVERT, m_object);

View File

@ -65,10 +65,10 @@ void CAutoDerrick::DeleteObject(bool all)
{ {
if ( !all ) if ( !all )
{ {
CObject* fret = SearchFret(); CObject* cargo = SearchCargo();
if ( fret != nullptr && fret->GetLock() ) if ( cargo != nullptr && cargo->GetLock() )
{ {
CObjectManager::GetInstancePointer()->DeleteObject(fret); CObjectManager::GetInstancePointer()->DeleteObject(cargo);
} }
} }
@ -129,7 +129,7 @@ void CAutoDerrick::Init()
mat = m_object->GetWorldMatrix(0); mat = m_object->GetWorldMatrix(0);
pos = Math::Transform(*mat, pos); pos = Math::Transform(*mat, pos);
m_terrain->AdjustToFloor(pos); m_terrain->AdjustToFloor(pos);
m_fretPos = pos; m_cargoPos = pos;
} }
@ -137,7 +137,7 @@ void CAutoDerrick::Init()
bool CAutoDerrick::EventProcess(const Event &event) bool CAutoDerrick::EventProcess(const Event &event)
{ {
CObject* fret; CObject* cargo;
Math::Vector pos, speed; Math::Vector pos, speed;
Math::Point dim; Math::Point dim;
float angle, duration, factor; float angle, duration, factor;
@ -309,10 +309,10 @@ bool CAutoDerrick::EventProcess(const Event &event)
{ {
if ( m_progress == 0.0f ) if ( m_progress == 0.0f )
{ {
if ( SearchFree(m_fretPos) ) if ( SearchFree(m_cargoPos) )
{ {
angle = m_object->GetAngleY(0); angle = m_object->GetAngleY(0);
CreateFret(m_fretPos, angle, m_type, 16.0f); CreateCargo(m_cargoPos, angle, m_type, 16.0f);
} }
else else
{ {
@ -323,9 +323,9 @@ bool CAutoDerrick::EventProcess(const Event &event)
} }
} }
fret = SearchFret(); cargo = SearchCargo();
if ( fret != 0 && if ( cargo != 0 &&
m_progress <= 0.5f && m_progress <= 0.5f &&
m_lastParticle+m_engine->ParticleAdapt(0.1f) <= m_time ) m_lastParticle+m_engine->ParticleAdapt(0.1f) <= m_time )
{ {
@ -333,7 +333,7 @@ bool CAutoDerrick::EventProcess(const Event &event)
if ( m_progress < 0.3f ) if ( m_progress < 0.3f )
{ {
pos = fret->GetPosition(0); pos = cargo->GetPosition(0);
pos.x += (Math::Rand()-0.5f)*5.0f; pos.x += (Math::Rand()-0.5f)*5.0f;
pos.z += (Math::Rand()-0.5f)*5.0f; pos.z += (Math::Rand()-0.5f)*5.0f;
pos.y += (Math::Rand()-0.5f)*5.0f; pos.y += (Math::Rand()-0.5f)*5.0f;
@ -344,7 +344,7 @@ bool CAutoDerrick::EventProcess(const Event &event)
} }
else else
{ {
pos = fret->GetPosition(0); pos = cargo->GetPosition(0);
pos.x += (Math::Rand()-0.5f)*5.0f; pos.x += (Math::Rand()-0.5f)*5.0f;
pos.z += (Math::Rand()-0.5f)*5.0f; pos.z += (Math::Rand()-0.5f)*5.0f;
pos.y += Math::Rand()*2.5f; pos.y += Math::Rand()*2.5f;
@ -357,21 +357,21 @@ bool CAutoDerrick::EventProcess(const Event &event)
if ( m_progress < 1.0f ) if ( m_progress < 1.0f )
{ {
if ( fret != 0 ) if ( cargo != 0 )
{ {
pos = fret->GetPosition(0); pos = cargo->GetPosition(0);
pos.y -= event.rTime*20.0f; // grave pos.y -= event.rTime*20.0f; // grave
if ( !m_bSoundFall && pos.y < m_fretPos.y ) if ( !m_bSoundFall && pos.y < m_cargoPos.y )
{ {
m_sound->Play(SOUND_BOUM, m_fretPos); m_sound->Play(SOUND_BOUM, m_cargoPos);
m_bSoundFall = true; m_bSoundFall = true;
} }
if ( pos.y < m_fretPos.y ) if ( pos.y < m_cargoPos.y )
{ {
pos.y = m_fretPos.y; pos.y = m_cargoPos.y;
fret->SetLock(false); // object usable cargo->SetLock(false); // object usable
} }
fret->SetPosition(0, pos); cargo->SetPosition(0, pos);
} }
} }
else else
@ -459,7 +459,7 @@ bool CAutoDerrick::Read(CLevelParserLine* line)
// Seeks the subject cargo. // Seeks the subject cargo.
CObject* CAutoDerrick::SearchFret() CObject* CAutoDerrick::SearchCargo()
{ {
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {
@ -468,8 +468,8 @@ CObject* CAutoDerrick::SearchFret()
Math::Vector oPos = obj->GetPosition(0); Math::Vector oPos = obj->GetPosition(0);
if ( oPos.x == m_fretPos.x && if ( oPos.x == m_cargoPos.x &&
oPos.z == m_fretPos.z ) return obj; oPos.z == m_cargoPos.z ) return obj;
} }
return nullptr; return nullptr;
@ -500,20 +500,20 @@ bool CAutoDerrick::SearchFree(Math::Vector pos)
// Create a transportable object. // Create a transportable object.
void CAutoDerrick::CreateFret(Math::Vector pos, float angle, ObjectType type, void CAutoDerrick::CreateCargo(Math::Vector pos, float angle, ObjectType type,
float height) float height)
{ {
CObject* fret = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, type); CObject* cargo = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, type);
fret->SetLock(true); // object not yet usable cargo->SetLock(true); // object not yet usable
if ( m_object->GetResetCap() == RESET_MOVE ) if ( m_object->GetResetCap() == RESET_MOVE )
{ {
fret->SetResetCap(RESET_DELETE); cargo->SetResetCap(RESET_DELETE);
} }
pos = fret->GetPosition(0); pos = cargo->GetPosition(0);
pos.y += height; pos.y += height;
fret->SetPosition(0, pos); cargo->SetPosition(0, pos);
} }
// Look if there is already a key. // Look if there is already a key.

View File

@ -55,9 +55,9 @@ public:
bool Read(CLevelParserLine* line); bool Read(CLevelParserLine* line);
protected: protected:
CObject* SearchFret(); CObject* SearchCargo();
bool SearchFree(Math::Vector pos); bool SearchFree(Math::Vector pos);
void CreateFret(Math::Vector pos, float angle, ObjectType type, float height); void CreateCargo(Math::Vector pos, float angle, ObjectType type, float height);
bool ExistKey(); bool ExistKey();
protected: protected:
@ -67,7 +67,7 @@ protected:
float m_timeVirus; float m_timeVirus;
float m_lastParticle; float m_lastParticle;
float m_lastTrack; float m_lastTrack;
Math::Vector m_fretPos; Math::Vector m_cargoPos;
int m_soundChannel; int m_soundChannel;
bool m_bSoundFall; bool m_bSoundFall;
}; };

View File

@ -92,7 +92,7 @@ Error CAutoDestroyer::StartAction(int param)
if ( m_phase == ADEP_WAIT ) if ( m_phase == ADEP_WAIT )
{ {
scrap->SetLock(true); // usable waste scrap->SetLock(true); // usable waste
//? scrap->SetTruck(m_object); // usable waste //? scrap->SetTransporter(m_object); // usable waste
m_sound->Play(SOUND_PSHHH2, m_object->GetPosition(0), 1.0f, 1.0f); m_sound->Play(SOUND_PSHHH2, m_object->GetPosition(0), 1.0f, 1.0f);

View File

@ -276,7 +276,7 @@ CObject* CAutoEgg::SearchAlien()
CObject* best = nullptr; CObject* best = nullptr;
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {
if ( obj->GetTruck() != nullptr ) continue; if ( obj->GetTransporter() != nullptr ) continue;
ObjectType type = obj->GetType(); ObjectType type = obj->GetType();
if ( type != OBJECT_ANT && if ( type != OBJECT_ANT &&

View File

@ -71,16 +71,16 @@ void CAutoEnergy::DeleteObject(bool all)
if ( !all ) if ( !all )
{ {
CObject* fret = SearchMetal(); CObject* cargo = SearchMetal();
if ( fret != nullptr ) if ( cargo != nullptr )
{ {
CObjectManager::GetInstancePointer()->DeleteObject(fret); CObjectManager::GetInstancePointer()->DeleteObject(cargo);
} }
fret = SearchPower(); cargo = SearchPower();
if ( fret != nullptr ) if ( cargo != nullptr )
{ {
CObjectManager::GetInstancePointer()->DeleteObject(fret); CObjectManager::GetInstancePointer()->DeleteObject(cargo);
} }
} }
@ -109,7 +109,7 @@ void CAutoEnergy::Init()
bool CAutoEnergy::EventProcess(const Event &event) bool CAutoEnergy::EventProcess(const Event &event)
{ {
CObject* fret; CObject* cargo;
Math::Vector pos, ppos, speed; Math::Vector pos, ppos, speed;
Math::Point dim, c, p; Math::Point dim, c, p;
Gfx::TerrainRes res; Gfx::TerrainRes res;
@ -162,10 +162,10 @@ bool CAutoEnergy::EventProcess(const Event &event)
if ( m_progress >= 1.0f ) if ( m_progress >= 1.0f )
{ {
bGO = false; bGO = false;
fret = SearchMetal(); // transform metal? cargo = SearchMetal(); // transform metal?
if ( fret != 0 ) if ( cargo != 0 )
{ {
if ( fret->GetType() == OBJECT_METAL ) if ( cargo->GetType() == OBJECT_METAL )
{ {
if ( big > ENERGY_POWER ) bGO = true; if ( big > ENERGY_POWER ) bGO = true;
} }
@ -177,9 +177,9 @@ bool CAutoEnergy::EventProcess(const Event &event)
if ( bGO ) if ( bGO )
{ {
if ( fret->GetType() == OBJECT_METAL ) if ( cargo->GetType() == OBJECT_METAL )
{ {
fret->SetLock(true); // usable metal cargo->SetLock(true); // usable metal
CreatePower(); // creates the battery CreatePower(); // creates the battery
} }
@ -245,10 +245,10 @@ bool CAutoEnergy::EventProcess(const Event &event)
{ {
if ( m_progress < 1.0f ) if ( m_progress < 1.0f )
{ {
fret = SearchMetal(); cargo = SearchMetal();
if ( fret != 0 ) if ( cargo != 0 )
{ {
if ( fret->GetType() == OBJECT_METAL ) if ( cargo->GetType() == OBJECT_METAL )
{ {
big -= event.rTime/ENERGY_DELAY*ENERGY_POWER; big -= event.rTime/ENERGY_DELAY*ENERGY_POWER;
} }
@ -256,13 +256,13 @@ bool CAutoEnergy::EventProcess(const Event &event)
{ {
big += event.rTime/ENERGY_DELAY*0.25f; big += event.rTime/ENERGY_DELAY*0.25f;
} }
fret->SetZoom(0, 1.0f-m_progress); cargo->SetZoom(0, 1.0f-m_progress);
} }
fret = SearchPower(); cargo = SearchPower();
if ( fret != 0 ) if ( cargo != 0 )
{ {
fret->SetZoom(0, m_progress); cargo->SetZoom(0, m_progress);
} }
if ( m_lastParticle+m_engine->ParticleAdapt(0.10f) <= m_time ) if ( m_lastParticle+m_engine->ParticleAdapt(0.10f) <= m_time )
@ -307,21 +307,21 @@ bool CAutoEnergy::EventProcess(const Event &event)
} }
else else
{ {
fret = SearchMetal(); cargo = SearchMetal();
if ( fret != nullptr ) if ( cargo != nullptr )
{ {
m_object->SetPower(nullptr); m_object->SetPower(nullptr);
CObjectManager::GetInstancePointer()->DeleteObject(fret); CObjectManager::GetInstancePointer()->DeleteObject(cargo);
} }
fret = SearchPower(); cargo = SearchPower();
if ( fret != 0 ) if ( cargo != 0 )
{ {
fret->SetZoom(0, 1.0f); cargo->SetZoom(0, 1.0f);
fret->SetLock(false); // usable battery cargo->SetLock(false); // usable battery
fret->SetTruck(m_object); cargo->SetTransporter(m_object);
fret->SetPosition(0, Math::Vector(0.0f, 3.0f, 0.0f)); cargo->SetPosition(0, Math::Vector(0.0f, 3.0f, 0.0f));
m_object->SetPower(fret); m_object->SetPower(cargo);
m_main->DisplayError(INFO_ENERGY, m_object); m_main->DisplayError(INFO_ENERGY, m_object);
} }

View File

@ -66,10 +66,10 @@ void CAutoFactory::DeleteObject(bool all)
{ {
if ( !all ) if ( !all )
{ {
CObject* fret = SearchFret(); // transform metal? CObject* cargo = SearchCargo(); // transform metal?
if ( fret != nullptr ) if ( cargo != nullptr )
{ {
CObjectManager::GetInstancePointer()->DeleteObject(fret); CObjectManager::GetInstancePointer()->DeleteObject(cargo);
} }
CObject* vehicle = SearchVehicle(); CObject* vehicle = SearchVehicle();
@ -101,7 +101,7 @@ void CAutoFactory::Init()
m_time = 0.0f; m_time = 0.0f;
m_lastParticle = 0.0f; m_lastParticle = 0.0f;
m_fretPos = m_object->GetPosition(0); m_cargoPos = m_object->GetPosition(0);
m_program = nullptr; m_program = nullptr;
@ -113,7 +113,7 @@ void CAutoFactory::Init()
Error CAutoFactory::StartAction(int param) Error CAutoFactory::StartAction(int param)
{ {
CObject* fret; CObject* cargo;
ObjectType type = static_cast<ObjectType>(param); ObjectType type = static_cast<ObjectType>(param);
if ( type != OBJECT_NULL ) if ( type != OBJECT_NULL )
@ -125,8 +125,8 @@ Error CAutoFactory::StartAction(int param)
m_type = type; m_type = type;
fret = SearchFret(); // transform metal? cargo = SearchCargo(); // transform metal?
if ( fret == 0 ) if ( cargo == 0 )
{ {
return ERR_FACTORY_NULL; return ERR_FACTORY_NULL;
} }
@ -139,7 +139,7 @@ Error CAutoFactory::StartAction(int param)
InitProgressTotal(3.0f+2.0f+15.0f+2.0f+3.0f); InitProgressTotal(3.0f+2.0f+15.0f+2.0f+3.0f);
UpdateInterface(); UpdateInterface();
fret->SetLock(true); // usable metal cargo->SetLock(true); // usable metal
SoundManip(3.0f, 1.0f, 0.5f); SoundManip(3.0f, 1.0f, 0.5f);
m_phase = AFP_CLOSE_S; m_phase = AFP_CLOSE_S;
@ -165,7 +165,7 @@ void CAutoFactory::SetProgram(const char* program)
bool CAutoFactory::EventProcess(const Event &event) bool CAutoFactory::EventProcess(const Event &event)
{ {
ObjectType type; ObjectType type;
CObject* fret; CObject* cargo;
CObject* vehicle; CObject* vehicle;
Math::Matrix* mat; Math::Matrix* mat;
CPhysics* physics; CPhysics* physics;
@ -296,10 +296,10 @@ bool CAutoFactory::EventProcess(const Event &event)
{ {
if ( !CreateVehicle() ) if ( !CreateVehicle() )
{ {
fret = SearchFret(); // transform metal? cargo = SearchCargo(); // transform metal?
if ( fret != 0 ) if ( cargo != 0 )
{ {
fret->SetLock(false); // metal usable again cargo->SetLock(false); // metal usable again
} }
if ( m_channelSound != -1 ) if ( m_channelSound != -1 )
@ -339,10 +339,10 @@ bool CAutoFactory::EventProcess(const Event &event)
vehicle->SetZoom(0, m_progress); vehicle->SetZoom(0, m_progress);
} }
fret = SearchFret(); // transform metal? cargo = SearchCargo(); // transform metal?
if ( fret != 0 ) if ( cargo != 0 )
{ {
fret->SetZoom(0, 1.0f-m_progress); cargo->SetZoom(0, 1.0f-m_progress);
} }
if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time ) if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
@ -350,7 +350,7 @@ bool CAutoFactory::EventProcess(const Event &event)
m_lastParticle = m_time; m_lastParticle = m_time;
#if 0 #if 0
pos = m_fretPos; pos = m_cargoPos;
pos.x += (Math::Rand()-0.5f)*20.0f; pos.x += (Math::Rand()-0.5f)*20.0f;
pos.z += (Math::Rand()-0.5f)*20.0f; pos.z += (Math::Rand()-0.5f)*20.0f;
pos.y += 1.0f; pos.y += 1.0f;
@ -381,10 +381,10 @@ bool CAutoFactory::EventProcess(const Event &event)
m_main->DisplayError(INFO_FACTORY, m_object); m_main->DisplayError(INFO_FACTORY, m_object);
SoundManip(2.0f, 1.0f, 1.2f); SoundManip(2.0f, 1.0f, 1.2f);
fret = SearchFret(); // transform metal? cargo = SearchCargo(); // transform metal?
if ( fret != nullptr ) if ( cargo != nullptr )
{ {
CObjectManager::GetInstancePointer()->DeleteObject(fret); CObjectManager::GetInstancePointer()->DeleteObject(cargo);
} }
m_vehicle = vehicle = SearchVehicle(); m_vehicle = vehicle = SearchVehicle();
@ -425,7 +425,7 @@ bool CAutoFactory::EventProcess(const Event &event)
{ {
m_lastParticle = m_time; m_lastParticle = m_time;
pos = m_fretPos; pos = m_cargoPos;
pos.x += (Math::Rand()-0.5f)*10.0f; pos.x += (Math::Rand()-0.5f)*10.0f;
pos.z += (Math::Rand()-0.5f)*10.0f; pos.z += (Math::Rand()-0.5f)*10.0f;
pos.y += Math::Rand()*10.0f; pos.y += Math::Rand()*10.0f;
@ -468,7 +468,7 @@ bool CAutoFactory::EventProcess(const Event &event)
{ {
m_lastParticle = m_time; m_lastParticle = m_time;
pos = m_fretPos; pos = m_cargoPos;
pos.x += (Math::Rand()-0.5f)*10.0f; pos.x += (Math::Rand()-0.5f)*10.0f;
pos.z += (Math::Rand()-0.5f)*10.0f; pos.z += (Math::Rand()-0.5f)*10.0f;
pos.y += Math::Rand()*10.0f; pos.y += Math::Rand()*10.0f;
@ -537,7 +537,7 @@ bool CAutoFactory::Read(CLevelParserLine* line)
m_speed = line->GetParam("aSpeed")->AsFloat(1.0f); m_speed = line->GetParam("aSpeed")->AsFloat(1.0f);
m_lastParticle = 0.0f; m_lastParticle = 0.0f;
m_fretPos = m_object->GetPosition(0); m_cargoPos = m_object->GetPosition(0);
return true; return true;
} }
@ -545,16 +545,16 @@ bool CAutoFactory::Read(CLevelParserLine* line)
//Seeks the cargo. //Seeks the cargo.
CObject* CAutoFactory::SearchFret() CObject* CAutoFactory::SearchCargo()
{ {
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {
ObjectType type = obj->GetType(); ObjectType type = obj->GetType();
if ( type != OBJECT_METAL ) continue; if ( type != OBJECT_METAL ) continue;
if ( obj->GetTruck() != nullptr ) continue; if ( obj->GetTransporter() != nullptr ) continue;
Math::Vector oPos = obj->GetPosition(0); Math::Vector oPos = obj->GetPosition(0);
float dist = Math::Distance(oPos, m_fretPos); float dist = Math::Distance(oPos, m_cargoPos);
if ( dist < 8.0f ) return obj; if ( dist < 8.0f ) return obj;
} }
@ -676,10 +676,10 @@ CObject* CAutoFactory::SearchVehicle()
ObjectType type = obj->GetType(); ObjectType type = obj->GetType();
if ( type != m_type ) continue; if ( type != m_type ) continue;
if ( obj->GetTruck() != nullptr ) continue; if ( obj->GetTransporter() != nullptr ) continue;
Math::Vector oPos = obj->GetPosition(0); Math::Vector oPos = obj->GetPosition(0);
float dist = Math::Distance(oPos, m_fretPos); float dist = Math::Distance(oPos, m_cargoPos);
if ( dist < 8.0f ) return obj; if ( dist < 8.0f ) return obj;
} }

View File

@ -62,7 +62,7 @@ protected:
void UpdateInterface(); void UpdateInterface();
void UpdateButton(Ui::CWindow *pw, EventType event, bool bBusy); void UpdateButton(Ui::CWindow *pw, EventType event, bool bBusy);
CObject* SearchFret(); CObject* SearchCargo();
bool NearestVehicle(); bool NearestVehicle();
bool CreateVehicle(); bool CreateVehicle();
CObject* SearchVehicle(); CObject* SearchVehicle();
@ -74,7 +74,7 @@ protected:
float m_progress; float m_progress;
float m_speed; float m_speed;
float m_lastParticle; float m_lastParticle;
Math::Vector m_fretPos; Math::Vector m_cargoPos;
int m_channelSound; int m_channelSound;
CObject* m_vehicle; CObject* m_vehicle;

View File

@ -52,10 +52,10 @@ void CAutoNest::DeleteObject(bool all)
{ {
if ( !all ) if ( !all )
{ {
CObject* fret = SearchFret(); CObject* cargo = SearchCargo();
if ( fret != nullptr ) if ( cargo != nullptr )
{ {
CObjectManager::GetInstancePointer()->DeleteObject(fret); CObjectManager::GetInstancePointer()->DeleteObject(cargo);
} }
} }
@ -78,7 +78,7 @@ void CAutoNest::Init()
pos = m_object->GetPosition(0); pos = m_object->GetPosition(0);
m_terrain->AdjustToFloor(pos); m_terrain->AdjustToFloor(pos);
m_fretPos = pos; m_cargoPos = pos;
} }
@ -86,7 +86,7 @@ void CAutoNest::Init()
bool CAutoNest::EventProcess(const Event &event) bool CAutoNest::EventProcess(const Event &event)
{ {
CObject* fret; CObject* cargo;
CAuto::EventProcess(event); CAuto::EventProcess(event);
@ -99,7 +99,7 @@ bool CAutoNest::EventProcess(const Event &event)
{ {
if ( m_progress >= 1.0f ) if ( m_progress >= 1.0f )
{ {
if ( !SearchFree(m_fretPos) ) if ( !SearchFree(m_cargoPos) )
{ {
m_phase = ANP_WAIT; m_phase = ANP_WAIT;
m_progress = 0.0f; m_progress = 0.0f;
@ -107,7 +107,7 @@ bool CAutoNest::EventProcess(const Event &event)
} }
else else
{ {
CreateFret(m_fretPos, 0.0f, OBJECT_BULLET); CreateCargo(m_cargoPos, 0.0f, OBJECT_BULLET);
m_phase = ANP_BIRTH; m_phase = ANP_BIRTH;
m_progress = 0.0f; m_progress = 0.0f;
m_speed = 1.0f/5.0f; m_speed = 1.0f/5.0f;
@ -117,21 +117,21 @@ bool CAutoNest::EventProcess(const Event &event)
if ( m_phase == ANP_BIRTH ) if ( m_phase == ANP_BIRTH )
{ {
fret = SearchFret(); cargo = SearchCargo();
if ( m_progress < 1.0f ) if ( m_progress < 1.0f )
{ {
if ( fret != 0 ) if ( cargo != 0 )
{ {
fret->SetZoom(0, m_progress); cargo->SetZoom(0, m_progress);
} }
} }
else else
{ {
if ( fret != 0 ) if ( cargo != 0 )
{ {
fret->SetZoom(0, 1.0f); cargo->SetZoom(0, 1.0f);
fret->SetLock(false); cargo->SetLock(false);
} }
m_phase = ANP_WAIT; m_phase = ANP_WAIT;
@ -169,16 +169,16 @@ bool CAutoNest::SearchFree(Math::Vector pos)
// Create a transportable object. // Create a transportable object.
void CAutoNest::CreateFret(Math::Vector pos, float angle, ObjectType type) void CAutoNest::CreateCargo(Math::Vector pos, float angle, ObjectType type)
{ {
CObject* fret = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, type); CObject* cargo = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, type);
fret->SetLock(true); // not usable cargo->SetLock(true); // not usable
fret->SetZoom(0, 0.0f); cargo->SetZoom(0, 0.0f);
} }
// Looking for the ball during manufacture. // Looking for the ball during manufacture.
CObject* CAutoNest::SearchFret() CObject* CAutoNest::SearchCargo()
{ {
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {
@ -188,8 +188,8 @@ CObject* CAutoNest::SearchFret()
if ( type != OBJECT_BULLET ) continue; if ( type != OBJECT_BULLET ) continue;
Math::Vector oPos = obj->GetPosition(0); Math::Vector oPos = obj->GetPosition(0);
if ( oPos.x == m_fretPos.x && if ( oPos.x == m_cargoPos.x &&
oPos.z == m_fretPos.z ) oPos.z == m_cargoPos.z )
{ {
return obj; return obj;
} }

View File

@ -51,14 +51,14 @@ public:
protected: protected:
bool SearchFree(Math::Vector pos); bool SearchFree(Math::Vector pos);
void CreateFret(Math::Vector pos, float angle, ObjectType type); void CreateCargo(Math::Vector pos, float angle, ObjectType type);
CObject* SearchFret(); CObject* SearchCargo();
protected: protected:
AutoNestPhase m_phase; AutoNestPhase m_phase;
float m_progress; float m_progress;
float m_speed; float m_speed;
float m_lastParticle; float m_lastParticle;
Math::Vector m_fretPos; Math::Vector m_cargoPos;
}; };

View File

@ -61,10 +61,10 @@ void CAutoNuclear::DeleteObject(bool all)
{ {
if ( !all ) if ( !all )
{ {
CObject* fret = SearchUranium(); CObject* cargo = SearchUranium();
if ( fret != nullptr ) if ( cargo != nullptr )
{ {
CObjectManager::GetInstancePointer()->DeleteObject(fret); CObjectManager::GetInstancePointer()->DeleteObject(cargo);
} }
} }
@ -104,7 +104,7 @@ void CAutoNuclear::Init()
bool CAutoNuclear::EventProcess(const Event &event) bool CAutoNuclear::EventProcess(const Event &event)
{ {
CObject* fret; CObject* cargo;
Math::Matrix* mat; Math::Matrix* mat;
Math::Vector pos, goal, speed; Math::Vector pos, goal, speed;
Math::Point dim, rot; Math::Point dim, rot;
@ -134,8 +134,8 @@ bool CAutoNuclear::EventProcess(const Event &event)
{ {
if ( m_progress >= 1.0f ) if ( m_progress >= 1.0f )
{ {
fret = SearchUranium(); // transform uranium? cargo = SearchUranium(); // transform uranium?
if ( fret == 0 || SearchVehicle() ) if ( cargo == 0 || SearchVehicle() )
{ {
m_phase = ANUP_WAIT; // still waiting ... m_phase = ANUP_WAIT; // still waiting ...
m_progress = 0.0f; m_progress = 0.0f;
@ -143,7 +143,7 @@ bool CAutoNuclear::EventProcess(const Event &event)
} }
else else
{ {
fret->SetLock(true); // usable uranium cargo->SetLock(true); // usable uranium
SetBusy(true); SetBusy(true);
InitProgressTotal(1.5f+NUCLEAR_DELAY+1.5f); InitProgressTotal(1.5f+NUCLEAR_DELAY+1.5f);
@ -227,10 +227,10 @@ bool CAutoNuclear::EventProcess(const Event &event)
} }
else else
{ {
fret = SearchUranium(); cargo = SearchUranium();
if ( fret != nullptr ) if ( cargo != nullptr )
{ {
CObjectManager::GetInstancePointer()->DeleteObject(fret); CObjectManager::GetInstancePointer()->DeleteObject(cargo);
m_object->SetPower(nullptr); m_object->SetPower(nullptr);
} }
@ -389,7 +389,7 @@ void CAutoNuclear::CreatePower()
float powerLevel = 1.0f; float powerLevel = 1.0f;
CObject* power = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, OBJECT_ATOMIC, powerLevel); CObject* power = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, OBJECT_ATOMIC, powerLevel);
power->SetTruck(m_object); power->SetTransporter(m_object);
power->SetPosition(0, Math::Vector(22.0f, 3.0f, 0.0f)); power->SetPosition(0, Math::Vector(22.0f, 3.0f, 0.0f));
m_object->SetPower(power); m_object->SetPower(power);
} }

View File

@ -251,7 +251,7 @@ void CAutoPara::ChargeObject(float rTime)
float dist = Math::Distance(oPos, sPos); float dist = Math::Distance(oPos, sPos);
if ( dist > 20.0f ) continue; if ( dist > 20.0f ) continue;
if ( obj->GetTruck() == nullptr && obj->GetType() == OBJECT_POWER ) if ( obj->GetTransporter() == nullptr && obj->GetType() == OBJECT_POWER )
{ {
float energy = obj->GetEnergy(); float energy = obj->GetEnergy();
energy += rTime/2.0f; energy += rTime/2.0f;
@ -268,7 +268,7 @@ void CAutoPara::ChargeObject(float rTime)
power->SetEnergy(energy); power->SetEnergy(energy);
} }
power = obj->GetFret(); power = obj->GetCargo();
if ( power != nullptr && power->GetType() == OBJECT_POWER ) if ( power != nullptr && power->GetType() == OBJECT_POWER )
{ {
float energy = power->GetEnergy(); float energy = power->GetEnergy();

View File

@ -396,7 +396,7 @@ int CAutoSafe::CountKeys()
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {
if ( obj->GetTruck() != nullptr ) continue; if ( obj->GetTransporter() != nullptr ) continue;
ObjectType oType = obj->GetType(); ObjectType oType = obj->GetType();
if ( oType != OBJECT_KEYa && if ( oType != OBJECT_KEYa &&
@ -468,7 +468,7 @@ void CAutoSafe::LockKeys()
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {
ObjectType oType = obj->GetType(); ObjectType oType = obj->GetType();
if ( obj->GetTruck() != nullptr ) continue; if ( obj->GetTransporter() != nullptr ) continue;
if ( oType != OBJECT_KEYa && if ( oType != OBJECT_KEYa &&
oType != OBJECT_KEYb && oType != OBJECT_KEYb &&
@ -492,7 +492,7 @@ void CAutoSafe::DownKeys(float progress)
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {
ObjectType oType = obj->GetType(); ObjectType oType = obj->GetType();
if ( obj->GetTruck() != nullptr ) continue; if ( obj->GetTransporter() != nullptr ) continue;
if ( oType != OBJECT_KEYa && if ( oType != OBJECT_KEYa &&
oType != OBJECT_KEYb && oType != OBJECT_KEYb &&
@ -521,7 +521,7 @@ void CAutoSafe::DeleteKeys()
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {
ObjectType oType = obj->GetType(); ObjectType oType = obj->GetType();
if ( obj->GetTruck() != nullptr ) continue; if ( obj->GetTransporter() != nullptr ) continue;
if ( oType != OBJECT_KEYa && if ( oType != OBJECT_KEYa &&
oType != OBJECT_KEYb && oType != OBJECT_KEYb &&
@ -549,7 +549,7 @@ CObject* CAutoSafe::SearchVehicle()
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {
if ( obj == m_object ) continue; if ( obj == m_object ) continue;
if ( obj->GetTruck() != nullptr ) continue; if ( obj->GetTransporter() != nullptr ) continue;
Math::Vector oPos = obj->GetPosition(0); Math::Vector oPos = obj->GetPosition(0);
float dist = Math::DistanceProjected(oPos, cPos); float dist = Math::DistanceProjected(oPos, cPos);

View File

@ -151,7 +151,7 @@ bool CAutoStation::EventProcess(const Event &event)
big -= add/4.0f; // discharge the large battery big -= add/4.0f; // discharge the large battery
} }
power = vehicle->GetFret(); power = vehicle->GetCargo();
if ( power != 0 && power->GetType() == OBJECT_POWER ) if ( power != 0 && power->GetType() == OBJECT_POWER )
{ {
energy = power->GetEnergy(); energy = power->GetEnergy();

View File

@ -52,7 +52,7 @@ protected:
float m_lastUpdateTime; float m_lastUpdateTime;
float m_lastParticle; float m_lastParticle;
int m_soundChannel; int m_soundChannel;
Math::Vector m_fretPos; Math::Vector m_cargoPos;
bool m_bLastVirus; bool m_bLastVirus;
float m_energyVirus; float m_energyVirus;
}; };

View File

@ -2394,7 +2394,7 @@ void CBrain::UpdateInterface()
bFly = bEnable; bFly = bEnable;
if ( bFly && (type == OBJECT_HUMAN || type == OBJECT_TECH) ) if ( bFly && (type == OBJECT_HUMAN || type == OBJECT_TECH) )
{ {
if ( m_object->GetFret() != 0 ) bFly = false; // if holder -> not fly if ( m_object->GetCargo() != 0 ) bFly = false; // if holder -> not fly
} }
EnableInterface(pw, EVENT_OBJECT_GASUP, bFly && m_main->CanPlayerInteract()); EnableInterface(pw, EVENT_OBJECT_GASUP, bFly && m_main->CanPlayerInteract());
EnableInterface(pw, EVENT_OBJECT_GASDOWN, bFly && m_main->CanPlayerInteract()); EnableInterface(pw, EVENT_OBJECT_GASDOWN, bFly && m_main->CanPlayerInteract());

View File

@ -436,7 +436,7 @@ bool CMotionBee::EventFrame(const Event &event)
action = MB_MARCH; // flying action = MB_MARCH; // flying
m_actionType = -1; m_actionType = -1;
if ( m_object->GetFret() != 0 ) m_actionType = MBS_HOLD; // carries the ball if ( m_object->GetCargo() != 0 ) m_actionType = MBS_HOLD; // carries the ball
if ( m_object->GetRuin() ) // destroyed? if ( m_object->GetRuin() ) // destroyed?
{ {

View File

@ -739,7 +739,7 @@ bool CMotionHuman::EventFrame(const Event &event)
s = 0.0f; s = 0.0f;
} }
if ( m_object->GetFret() != 0 ) // carries something? if ( m_object->GetCargo() != 0 ) // carries something?
{ {
s *= 1.3f; s *= 1.3f;
} }
@ -771,7 +771,7 @@ bool CMotionHuman::EventFrame(const Event &event)
s = 0.0f; s = 0.0f;
} }
if ( m_object->GetFret() != 0 ) // carries something? if ( m_object->GetCargo() != 0 ) // carries something?
{ {
s *= 1.3f; s *= 1.3f;
} }
@ -836,7 +836,7 @@ bool CMotionHuman::EventFrame(const Event &event)
else else
{ {
action = MH_MARCH; // walking action = MH_MARCH; // walking
if ( m_object->GetFret() != 0 ) action = MH_MARCHTAKE; // take walking if ( m_object->GetCargo() != 0 ) action = MH_MARCHTAKE; // take walking
rTime[0] = rTime[1] = m_armMember; rTime[0] = rTime[1] = m_armMember;
lTime[0] = lTime[1] = m_armMember+0.5f; lTime[0] = lTime[1] = m_armMember+0.5f;
} }
@ -875,7 +875,7 @@ bool CMotionHuman::EventFrame(const Event &event)
armAction = action; armAction = action;
legAction = action; legAction = action;
if ( m_object->GetFret() != 0 ) // carries something? if ( m_object->GetCargo() != 0 ) // carries something?
{ {
armAction = MH_MARCHTAKE; // take walking armAction = MH_MARCHTAKE; // take walking
} }
@ -989,7 +989,7 @@ bool CMotionHuman::EventFrame(const Event &event)
aa = 0.5f; aa = 0.5f;
if ( i%2 == 0 ) // arm? if ( i%2 == 0 ) // arm?
{ {
if ( m_object->GetFret() == 0 ) // does nothing? if ( m_object->GetCargo() == 0 ) // does nothing?
{ {
aa = 2.0f; // moves a lot aa = 2.0f; // moves a lot
} }
@ -1620,7 +1620,7 @@ bool CMotionHuman::EventFrame(const Event &event)
float speedX = m_physics->GetLinMotionX(MO_REASPEED); float speedX = m_physics->GetLinMotionX(MO_REASPEED);
if ( m_object->GetFret() == 0 ) if ( m_object->GetCargo() == 0 )
{ {
if ( speedX > 0.0f ) synchro = 0.21f; // synchro forward if ( speedX > 0.0f ) synchro = 0.21f; // synchro forward
else synchro = 0.29f; // synchro backward else synchro = 0.29f; // synchro backward
@ -1637,7 +1637,7 @@ bool CMotionHuman::EventFrame(const Event &event)
{ {
volume[0] = 0.5f; volume[0] = 0.5f;
freq[0] = 1.0f; freq[0] = 1.0f;
if ( m_object->GetFret() != 0 ) if ( m_object->GetCargo() != 0 )
{ {
//? volume[0] *= 2.0f; //? volume[0] *= 2.0f;
freq[0] = 0.7f; freq[0] = 0.7f;

View File

@ -939,7 +939,7 @@ void CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
powerCell->SetPosition(0, powerCellPos); powerCell->SetPosition(0, powerCellPos);
powerCell->SetAngle(0, Math::Vector(0.0f, powerCellAngle, 0.0f)); powerCell->SetAngle(0, Math::Vector(0.0f, powerCellAngle, 0.0f));
powerCell->SetTruck(m_object); powerCell->SetTransporter(m_object);
m_object->SetPower(powerCell); m_object->SetPower(powerCell);
} }

View File

@ -84,7 +84,7 @@ void uObject(CBotVar* botThis, void* user)
{ {
CObject* object = static_cast<CObject*>(user); CObject* object = static_cast<CObject*>(user);
CObject* power; CObject* power;
CObject* fret; CObject* cargo;
CPhysics* physics; CPhysics* physics;
CBotVar *pVar, *pSub; CBotVar *pVar, *pSub;
ObjectType type; ObjectType type;
@ -102,7 +102,7 @@ void uObject(CBotVar* botThis, void* user)
// Updates the position of the object. // Updates the position of the object.
pVar = pVar->GetNext(); // "position" pVar = pVar->GetNext(); // "position"
if ( object->GetTruck() == 0 ) if ( object->GetTransporter() == 0 )
{ {
pos = object->GetPosition(0); pos = object->GetPosition(0);
float waterLevel = Gfx::CEngine::GetInstancePointer()->GetWater()->GetLevel(); float waterLevel = Gfx::CEngine::GetInstancePointer()->GetWater()->GetLevel();
@ -169,9 +169,9 @@ void uObject(CBotVar* botThis, void* user)
// Updates the transported object's type. // Updates the transported object's type.
pVar = pVar->GetNext(); // "load" pVar = pVar->GetNext(); // "load"
fret = object->GetFret(); cargo = object->GetCargo();
if ( fret == 0 ) pVar->SetPointer(0); if ( cargo == 0 ) pVar->SetPointer(0);
else pVar->SetPointer(fret->GetBotVar()); else pVar->SetPointer(cargo->GetBotVar());
pVar = pVar->GetNext(); // "id" pVar = pVar->GetNext(); // "id"
value = object->GetID(); value = object->GetID();
@ -205,9 +205,9 @@ CObject::CObject(int id)
m_tilt = Math::Vector(0.0f, 0.0f, 0.0f); m_tilt = Math::Vector(0.0f, 0.0f, 0.0f);
m_power = 0; m_power = 0;
m_fret = 0; m_cargo = 0;
m_truck = 0; m_transporter = 0;
m_truckLink = 0; m_transporterLink = 0;
m_energy = 1.0f; m_energy = 1.0f;
m_capacity = 1.0f; m_capacity = 1.0f;
m_shield = 1.0f; m_shield = 1.0f;
@ -483,7 +483,7 @@ void CObject::Simplify()
} }
// Detonates an object, when struck by a shot. // Detonates an object, when stransporter by a shot.
// If false is returned, the object is still screwed. // If false is returned, the object is still screwed.
// If true is returned, the object is destroyed. // If true is returned, the object is destroyed.
@ -1677,36 +1677,36 @@ CObject* CObject::GetPower()
// Management of the object transport. // Management of the object transport.
void CObject::SetFret(CObject* fret) void CObject::SetCargo(CObject* cargo)
{ {
m_fret = fret; m_cargo = cargo;
} }
CObject* CObject::GetFret() CObject* CObject::GetCargo()
{ {
return m_fret; return m_cargo;
} }
// Management of the object "truck" that transports it. // Management of the object "transporter" that transports it.
void CObject::SetTruck(CObject* truck) void CObject::SetTransporter(CObject* transporter)
{ {
m_truck = truck; m_transporter = transporter;
// Invisible shadow if the object is transported. // Invisible shadow if the object is transported.
m_engine->SetObjectShadowHide(m_objectPart[0].object, (m_truck != 0)); m_engine->SetObjectShadowHide(m_objectPart[0].object, (m_transporter != 0));
} }
CObject* CObject::GetTruck() CObject* CObject::GetTransporter()
{ {
return m_truck; return m_transporter;
} }
// Management of the conveying portion. // Management of the conveying portion.
void CObject::SetTruckPart(int part) void CObject::SetTransporterPart(int part)
{ {
m_truckLink = part; m_transporterLink = part;
} }
void CObject::SetInfoReturn(float value) void CObject::SetInfoReturn(float value)
@ -1912,7 +1912,7 @@ bool CObject::UpdateTransformObject(int part, bool bForceUpdate)
bool bModif = false; bool bModif = false;
int parent; int parent;
if ( m_truck != 0 ) // transported by truck? if ( m_transporter != 0 ) // transported by transporter?
{ {
m_objectPart[part].bTranslate = true; m_objectPart[part].bTranslate = true;
m_objectPart[part].bRotate = true; m_objectPart[part].bRotate = true;
@ -1971,11 +1971,11 @@ bool CObject::UpdateTransformObject(int part, bool bForceUpdate)
{ {
parent = m_objectPart[part].parentPart; parent = m_objectPart[part].parentPart;
if ( part == 0 && m_truck != 0 ) // transported by a truck? if ( part == 0 && m_transporter != 0 ) // transported by a transporter?
{ {
Math::Matrix* matWorldTruck; Math::Matrix* matWorldTransporter;
matWorldTruck = m_truck->GetWorldMatrix(m_truckLink); matWorldTransporter = m_transporter->GetWorldMatrix(m_transporterLink);
m_objectPart[part].matWorld = Math::MultiplyMatrices(*matWorldTruck, m_objectPart[part].matWorld = Math::MultiplyMatrices(*matWorldTransporter,
m_objectPart[part].matTransform); m_objectPart[part].matTransform);
} }
else else

View File

@ -218,11 +218,11 @@ public:
void SetPower(CObject* power); void SetPower(CObject* power);
CObject* GetPower(); CObject* GetPower();
void SetFret(CObject* fret); void SetCargo(CObject* cargo);
CObject* GetFret(); CObject* GetCargo();
void SetTruck(CObject* truck); void SetTransporter(CObject* transporter);
CObject* GetTruck(); CObject* GetTransporter();
void SetTruckPart(int part); void SetTransporterPart(int part);
bool SetCmdLine(int rank, float value); bool SetCmdLine(int rank, float value);
float GetCmdLine(int rank); float GetCmdLine(int rank);
@ -400,9 +400,9 @@ protected:
Math::Vector m_cirVibration; // circular vibration Math::Vector m_cirVibration; // circular vibration
Math::Vector m_tilt; // tilt Math::Vector m_tilt; // tilt
CObject* m_power; // battery used by the vehicle CObject* m_power; // battery used by the vehicle
CObject* m_fret; // object transported CObject* m_cargo; // object transported
CObject* m_truck; // object with the latter CObject* m_transporter; // object with the latter
int m_truckLink; // part int m_transporterLink; // part
float m_energy; // energy contained (if battery) float m_energy; // energy contained (if battery)
float m_lastEnergy; float m_lastEnergy;
float m_capacity; // capacity (if battery) float m_capacity; // capacity (if battery)

View File

@ -1091,7 +1091,7 @@ CObjectUPtr CObjectFactory::CreateBuilding(const ObjectCreateParams& params)
pPower->obj->CreateCrashSphere(Math::Vector(0.0f, 1.0f, 0.0f), 1.0f, SOUND_BOUMm, 0.45f); pPower->obj->CreateCrashSphere(Math::Vector(0.0f, 1.0f, 0.0f), 1.0f, SOUND_BOUMm, 0.45f);
pPower->obj->SetGlobalSphere(Math::Vector(0.0f, 1.0f, 0.0f), 1.5f); pPower->obj->SetGlobalSphere(Math::Vector(0.0f, 1.0f, 0.0f), 1.5f);
pPower->SetTruck(obj.get()); pPower->SetTransporter(obj.get());
SetPower(pPower); SetPower(pPower);
if ( power <= 1.0f ) pPower->obj->SetEnergy(power); if ( power <= 1.0f ) pPower->obj->SetEnergy(power);

View File

@ -201,7 +201,7 @@ CObject* CObjectManager::Radar(CObject* pThis, Math::Vector thisPosition, float
pObj = it->second.get(); pObj = it->second.get();
if ( pObj == pThis ) continue; // pThis may be nullptr but it doesn't matter if ( pObj == pThis ) continue; // pThis may be nullptr but it doesn't matter
if ( pObj->GetTruck() != 0 ) continue; // object transported? if ( pObj->GetTransporter() != 0 ) continue; // object transported?
if ( !pObj->GetActive() ) continue; if ( !pObj->GetActive() ) continue;
if ( pObj->GetProxyActivate() ) continue; if ( pObj->GetProxyActivate() ) continue;

View File

@ -1996,8 +1996,8 @@ CObject* CRobotMain::DetectObject(Math::Point pos)
for (CObject* obj : m_objMan->GetAllObjects()) for (CObject* obj : m_objMan->GetAllObjects())
{ {
if (!obj->GetActive()) continue; if (!obj->GetActive()) continue;
CObject* truck = obj->GetTruck(); CObject* transporter = obj->GetTransporter();
if (truck != nullptr && !truck->GetActive()) continue; if (transporter != nullptr && !transporter->GetActive()) continue;
if (obj->GetProxyActivate()) continue; if (obj->GetProxyActivate()) continue;
CObject* target = nullptr; CObject* target = nullptr;
@ -2113,7 +2113,7 @@ CObject* CRobotMain::DetectObject(Math::Point pos)
} }
else if (type == OBJECT_POWER || type == OBJECT_ATOMIC) else if (type == OBJECT_POWER || type == OBJECT_ATOMIC)
{ {
target = obj->GetTruck(); // battery connected target = obj->GetTransporter(); // battery connected
if (!target) target = obj; // standalone battery if (!target) target = obj; // standalone battery
} }
@ -2617,7 +2617,7 @@ bool CRobotMain::EventFrame(const Event &event)
for (CObject* obj : m_objMan->GetAllObjects()) for (CObject* obj : m_objMan->GetAllObjects())
{ {
if (pm != nullptr) pm->UpdateObject(obj); if (pm != nullptr) pm->UpdateObject(obj);
if (obj->GetTruck() != nullptr) continue; if (obj->GetTransporter() != nullptr) continue;
ObjectType type = obj->GetType(); ObjectType type = obj->GetType();
if (type == OBJECT_TOTO) if (type == OBJECT_TOTO)
toto = obj; toto = obj;
@ -2627,7 +2627,7 @@ bool CRobotMain::EventFrame(const Event &event)
// Advances all objects transported by robots. // Advances all objects transported by robots.
for (CObject* obj : m_objMan->GetAllObjects()) for (CObject* obj : m_objMan->GetAllObjects())
{ {
if (obj->GetTruck() == nullptr) continue; if (obj->GetTransporter() == nullptr) continue;
obj->EventProcess(event); obj->EventProcess(event);
} }
@ -4189,7 +4189,7 @@ float CRobotMain::SearchNearestObject(Math::Vector center, CObject *exclu)
for (CObject* obj : m_objMan->GetAllObjects()) for (CObject* obj : m_objMan->GetAllObjects())
{ {
if (!obj->GetActive()) continue; // inactive? if (!obj->GetActive()) continue; // inactive?
if (obj->GetTruck() != nullptr) continue; // object carries? if (obj->GetTransporter() != nullptr) continue; // object carries?
if (obj == exclu) continue; if (obj == exclu) continue;
ObjectType type = obj->GetType(); ObjectType type = obj->GetType();
@ -4325,7 +4325,7 @@ void CRobotMain::HideDropZone(CObject* metal)
} }
//! Shows the buildable area when a cube of metal is deposited //! Shows the buildable area when a cube of metal is deposited
void CRobotMain::ShowDropZone(CObject* metal, CObject* truck) void CRobotMain::ShowDropZone(CObject* metal, CObject* transporter)
{ {
if (metal == nullptr) return; if (metal == nullptr) return;
@ -4337,9 +4337,9 @@ void CRobotMain::ShowDropZone(CObject* metal, CObject* truck)
for (CObject* obj : m_objMan->GetAllObjects()) for (CObject* obj : m_objMan->GetAllObjects())
{ {
if (!obj->GetActive()) continue; // inactive? if (!obj->GetActive()) continue; // inactive?
if (obj->GetTruck() != nullptr) continue; // object carried? if (obj->GetTransporter() != nullptr) continue; // object carried?
if (obj == metal) continue; if (obj == metal) continue;
if (obj == truck) continue; if (obj == transporter) continue;
Math::Vector oPos; Math::Vector oPos;
float oRadius; float oRadius;
@ -4540,7 +4540,7 @@ void CRobotMain::CompileScript(bool soluce)
nbError = 0; nbError = 0;
for (CObject* obj : m_objMan->GetAllObjects()) for (CObject* obj : m_objMan->GetAllObjects())
{ {
if (obj->GetTruck() != nullptr) continue; if (obj->GetTransporter() != nullptr) continue;
CBrain* brain = obj->GetBrain(); CBrain* brain = obj->GetBrain();
if (brain == nullptr) continue; if (brain == nullptr) continue;
@ -4568,7 +4568,7 @@ void CRobotMain::CompileScript(bool soluce)
{ {
for (CObject* obj : m_objMan->GetAllObjects()) for (CObject* obj : m_objMan->GetAllObjects())
{ {
if (obj->GetTruck() != 0) continue; if (obj->GetTransporter() != 0) continue;
CBrain* brain = obj->GetBrain(); CBrain* brain = obj->GetBrain();
if (brain == 0) continue; if (brain == 0) continue;
@ -4584,7 +4584,7 @@ void CRobotMain::CompileScript(bool soluce)
// Start all programs according to the command "run". // Start all programs according to the command "run".
for (CObject* obj : m_objMan->GetAllObjects()) for (CObject* obj : m_objMan->GetAllObjects())
{ {
if (obj->GetTruck() != nullptr) continue; if (obj->GetTransporter() != nullptr) continue;
CBrain* brain = obj->GetBrain(); CBrain* brain = obj->GetBrain();
if (brain == nullptr) continue; if (brain == nullptr) continue;
@ -4949,18 +4949,18 @@ bool CRobotMain::IOWriteScene(const char *filename, const char *filecbot, char *
{ {
if (obj->GetType() == OBJECT_TOTO) continue; if (obj->GetType() == OBJECT_TOTO) continue;
if (obj->GetType() == OBJECT_FIX) continue; if (obj->GetType() == OBJECT_FIX) continue;
if (obj->GetTruck() != nullptr) continue; if (obj->GetTransporter() != nullptr) continue;
if (obj->GetBurn()) continue; if (obj->GetBurn()) continue;
if (obj->GetDead()) continue; if (obj->GetDead()) continue;
if (obj->IsExploding()) continue; if (obj->IsExploding()) continue;
CObject* power = obj->GetPower(); CObject* power = obj->GetPower();
CObject* fret = obj->GetFret(); CObject* cargo = obj->GetCargo();
if (fret != nullptr) // object transported? if (cargo != nullptr) // object transported?
{ {
line.reset(new CLevelParserLine("CreateFret")); line.reset(new CLevelParserLine("CreateFret"));
IOWriteObject(line.get(), fret); IOWriteObject(line.get(), cargo);
levelParser.AddLine(std::move(line)); levelParser.AddLine(std::move(line));
} }
@ -5002,7 +5002,7 @@ bool CRobotMain::IOWriteScene(const char *filename, const char *filecbot, char *
{ {
if (obj->GetType() == OBJECT_TOTO) continue; if (obj->GetType() == OBJECT_TOTO) continue;
if (obj->GetType() == OBJECT_FIX) continue; if (obj->GetType() == OBJECT_FIX) continue;
if (obj->GetTruck() != nullptr) continue; if (obj->GetTransporter() != nullptr) continue;
if (obj->GetBurn()) continue; if (obj->GetBurn()) continue;
if (obj->GetDead()) continue; if (obj->GetDead()) continue;
@ -5102,7 +5102,7 @@ CObject* CRobotMain::IOReadScene(const char *filename, const char *filecbot)
levelParser.Load(); levelParser.Load();
m_base = nullptr; m_base = nullptr;
CObject* fret = nullptr; CObject* cargo = nullptr;
CObject* power = nullptr; CObject* power = nullptr;
CObject* sel = nullptr; CObject* sel = nullptr;
int objRank = 0; int objRank = 0;
@ -5124,7 +5124,7 @@ CObject* CRobotMain::IOReadScene(const char *filename, const char *filecbot)
} }
if (line->GetCommand() == "CreateFret") if (line->GetCommand() == "CreateFret")
fret = IOReadObject(line.get(), filename, -1); cargo = IOReadObject(line.get(), filename, -1);
if (line->GetCommand() == "CreatePower") if (line->GetCommand() == "CreatePower")
power = IOReadObject(line.get(), filename, -1); power = IOReadObject(line.get(), filename, -1);
@ -5136,9 +5136,9 @@ CObject* CRobotMain::IOReadScene(const char *filename, const char *filecbot)
if (line->GetParam("select")->AsBool(false)) if (line->GetParam("select")->AsBool(false))
sel = obj; sel = obj;
if (fret != nullptr) if (cargo != nullptr)
{ {
obj->SetFret(fret); obj->SetCargo(cargo);
CTaskManip* task = new CTaskManip(obj); CTaskManip* task = new CTaskManip(obj);
task->Start(TMO_AUTO, TMA_GRAB); // holds the object! task->Start(TMO_AUTO, TMA_GRAB); // holds the object!
delete task; delete task;
@ -5147,10 +5147,10 @@ CObject* CRobotMain::IOReadScene(const char *filename, const char *filecbot)
if (power != nullptr) if (power != nullptr)
{ {
obj->SetPower(power); obj->SetPower(power);
power->SetTruck(obj); power->SetTransporter(obj);
} }
fret = nullptr; cargo = nullptr;
power = nullptr; power = nullptr;
} }
} }
@ -5164,7 +5164,7 @@ CObject* CRobotMain::IOReadScene(const char *filename, const char *filecbot)
nbError = 0; nbError = 0;
for (CObject* obj : m_objMan->GetAllObjects()) for (CObject* obj : m_objMan->GetAllObjects())
{ {
if (obj->GetTruck() != nullptr) continue; if (obj->GetTransporter() != nullptr) continue;
objRank = obj->GetDefRank(); objRank = obj->GetDefRank();
if (objRank == -1) continue; if (objRank == -1) continue;
@ -5177,7 +5177,7 @@ CObject* CRobotMain::IOReadScene(const char *filename, const char *filecbot)
// Starts scripts // Starts scripts
for (CObject* obj : m_objMan->GetAllObjects()) for (CObject* obj : m_objMan->GetAllObjects())
{ {
if (obj->GetTruck() != nullptr) continue; if (obj->GetTransporter() != nullptr) continue;
if (obj->GetDefRank() == -1) continue; if (obj->GetDefRank() == -1) continue;
CBrain* brain = obj->GetBrain(); CBrain* brain = obj->GetBrain();
@ -5206,7 +5206,7 @@ CObject* CRobotMain::IOReadScene(const char *filename, const char *filecbot)
{ {
if (obj->GetType() == OBJECT_TOTO) continue; if (obj->GetType() == OBJECT_TOTO) continue;
if (obj->GetType() == OBJECT_FIX) continue; if (obj->GetType() == OBJECT_FIX) continue;
if (obj->GetTruck() != nullptr) continue; if (obj->GetTransporter() != nullptr) continue;
if (obj->GetBurn()) continue; if (obj->GetBurn()) continue;
if (obj->GetDead()) continue; if (obj->GetDead()) continue;
@ -5277,7 +5277,7 @@ void CRobotMain::ResetObject()
// TODO: ? // TODO: ?
#if 0 #if 0
CObject* obj; CObject* obj;
CObject* truck; CObject* transporter;
CAuto* objAuto; CAuto* objAuto;
CBrain* brain; CBrain* brain;
CPyro* pyro; CPyro* pyro;
@ -5313,11 +5313,11 @@ void CRobotMain::ResetObject()
if ( cap == RESET_DELETE ) if ( cap == RESET_DELETE )
{ {
truck = obj->GetTruck(); transporter = obj->GetTransporter();
if ( truck != 0 ) if ( transporter != 0 )
{ {
truck->SetFret(0); transporter->SetCargo(0);
obj->SetTruck(0); obj->SetTransporter(0);
} }
obj->DeleteObject(); obj->DeleteObject();
delete obj; delete obj;
@ -5471,10 +5471,10 @@ void CRobotMain::UpdateAudio(bool frame)
if (energyLevel < m_audioChange[t].powermin || energyLevel > m_audioChange[t].powermax) if (energyLevel < m_audioChange[t].powermin || energyLevel > m_audioChange[t].powermax)
continue; continue;
if (obj->GetTruck() == 0) if (obj->GetTransporter() == 0)
oPos = obj->GetPosition(0); oPos = obj->GetPosition(0);
else else
oPos = obj->GetTruck()->GetPosition(0); oPos = obj->GetTransporter()->GetPosition(0);
oPos.y = 0.0f; oPos.y = 0.0f;
@ -5566,7 +5566,7 @@ Error CRobotMain::CheckEndMission(bool frame)
if (!m_endTake[t].countTransported) if (!m_endTake[t].countTransported)
{ {
if (obj->GetTruck() != nullptr) continue; if (obj->GetTransporter() != nullptr) continue;
} }
ObjectType type = obj->GetType(); ObjectType type = obj->GetType();
@ -5610,10 +5610,10 @@ Error CRobotMain::CheckEndMission(bool frame)
} }
if (energyLevel < m_endTake[t].powermin || energyLevel > m_endTake[t].powermax) continue; if (energyLevel < m_endTake[t].powermin || energyLevel > m_endTake[t].powermax) continue;
if (obj->GetTruck() == 0) if (obj->GetTransporter() == 0)
oPos = obj->GetPosition(0); oPos = obj->GetPosition(0);
else else
oPos = obj->GetTruck()->GetPosition(0); oPos = obj->GetTransporter()->GetPosition(0);
oPos.y = 0.0f; oPos.y = 0.0f;

View File

@ -308,7 +308,7 @@ public:
bool FreeSpace(Math::Vector &center, float minRadius, float maxRadius, float space, CObject *exclu); bool FreeSpace(Math::Vector &center, float minRadius, float maxRadius, float space, CObject *exclu);
float GetFlatZoneRadius(Math::Vector center, float maxRadius, CObject *exclu); float GetFlatZoneRadius(Math::Vector center, float maxRadius, CObject *exclu);
void HideDropZone(CObject* metal); void HideDropZone(CObject* metal);
void ShowDropZone(CObject* metal, CObject* truck); void ShowDropZone(CObject* metal, CObject* transporter);
void FlushShowLimit(int i); void FlushShowLimit(int i);
void SetShowLimit(int i, Gfx::ParticleType parti, CObject *pObj, Math::Vector pos, void SetShowLimit(int i, Gfx::ParticleType parti, CObject *pObj, Math::Vector pos,
float radius, float duration=SHOWLIMITTIME); float radius, float duration=SHOWLIMITTIME);

View File

@ -346,7 +346,7 @@ Error CTaskBuild::Start(ObjectType type)
if ( speed.x != 0.0f || if ( speed.x != 0.0f ||
speed.z != 0.0f ) return ERR_BUILD_MOTOR; speed.z != 0.0f ) return ERR_BUILD_MOTOR;
if ( m_object->GetFret() != 0 ) return ERR_MANIP_BUSY; if ( m_object->GetCargo() != 0 ) return ERR_MANIP_BUSY;
m_metal = SearchMetalObject(oAngle, 2.0f, 100.0f, Math::PI*0.25f, err); m_metal = SearchMetalObject(oAngle, 2.0f, 100.0f, Math::PI*0.25f, err);
if ( err == ERR_BUILD_METALNEAR && m_metal != 0 ) if ( err == ERR_BUILD_METALNEAR && m_metal != 0 )
@ -592,7 +592,7 @@ Error CTaskBuild::FlatFloor()
for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {
if ( !pObj->GetActive() ) continue; // inactive? if ( !pObj->GetActive() ) continue; // inactive?
if ( pObj->GetTruck() != 0 ) continue; // object transported? if ( pObj->GetTransporter() != 0 ) continue; // object transported?
if ( pObj == m_metal ) continue; if ( pObj == m_metal ) continue;
if ( pObj == m_object ) continue; if ( pObj == m_object ) continue;
@ -637,7 +637,7 @@ Error CTaskBuild::FlatFloor()
for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {
if ( !pObj->GetActive() ) continue; // inactive? if ( !pObj->GetActive() ) continue; // inactive?
if ( pObj->GetTruck() != 0 ) continue; // object transported? if ( pObj->GetTransporter() != 0 ) continue; // object transported?
if ( pObj == m_metal ) continue; if ( pObj == m_metal ) continue;
if ( pObj == m_object ) continue; if ( pObj == m_object ) continue;
@ -705,7 +705,7 @@ CObject* CTaskBuild::SearchMetalObject(float &angle, float dMin, float dMax,
for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {
if ( !pObj->GetActive() ) continue; // objet inactive? if ( !pObj->GetActive() ) continue; // objet inactive?
if ( pObj->GetTruck() != 0 ) continue; // object transported? if ( pObj->GetTransporter() != 0 ) continue; // object transported?
type = pObj->GetType(); type = pObj->GetType();
if ( type != OBJECT_METAL ) continue; if ( type != OBJECT_METAL ) continue;

View File

@ -85,7 +85,7 @@ Error CTaskFlag::Start(TaskFlagOrder order, int rank)
if ( speed.x != 0.0f || if ( speed.x != 0.0f ||
speed.z != 0.0f ) return ERR_FLAG_MOTOR; speed.z != 0.0f ) return ERR_FLAG_MOTOR;
if ( m_object->GetFret() != 0 ) return ERR_FLAG_BUSY; if ( m_object->GetCargo() != 0 ) return ERR_FLAG_BUSY;
if ( order == TFL_CREATE ) if ( order == TFL_CREATE )
{ {

View File

@ -144,7 +144,7 @@ bool CTaskGoto::EventProcess(const Event &event)
pos = m_object->GetPosition(0); pos = m_object->GetPosition(0);
if ( m_bmFretObject == 0 ) if ( m_bmCargoObject == 0 )
{ {
goal = m_goal; goal = m_goal;
dist = 0.0f; dist = 0.0f;
@ -153,7 +153,7 @@ bool CTaskGoto::EventProcess(const Event &event)
{ {
goal = m_goalObject; goal = m_goalObject;
dist = TAKE_DIST+2.0f; dist = TAKE_DIST+2.0f;
if ( m_bmFretObject->GetType() == OBJECT_BASE ) dist = 12.0f; if ( m_bmCargoObject->GetType() == OBJECT_BASE ) dist = 12.0f;
} }
ret = BeamSearch(pos, goal, dist); ret = BeamSearch(pos, goal, dist);
@ -647,7 +647,7 @@ Error CTaskGoto::Start(Math::Vector goal, float altitude,
m_phase = TGP_ADVANCE; m_phase = TGP_ADVANCE;
m_error = ERR_OK; m_error = ERR_OK;
m_try = 0; m_try = 0;
m_bmFretObject = 0; m_bmCargoObject = 0;
m_bmFinalMove = 0.0f; m_bmFinalMove = 0.0f;
pos = m_object->GetPosition(0); pos = m_object->GetPosition(0);
@ -715,7 +715,7 @@ Error CTaskGoto::Start(Math::Vector goal, float altitude,
dist = 4.0f; dist = 4.0f;
if ( AdjustTarget(target, m_goal, dist) ) if ( AdjustTarget(target, m_goal, dist) )
{ {
m_bmFretObject = target; // cargo on the ground m_bmCargoObject = target; // cargo on the ground
} }
else else
{ {
@ -737,7 +737,7 @@ Error CTaskGoto::Start(Math::Vector goal, float altitude,
BeamStart(); BeamStart();
if ( m_bmFretObject == 0 ) if ( m_bmCargoObject == 0 )
{ {
x = static_cast<int>((m_goal.x+1600.0f)/BM_DIM_STEP); x = static_cast<int>((m_goal.x+1600.0f)/BM_DIM_STEP);
y = static_cast<int>((m_goal.z+1600.0f)/BM_DIM_STEP); y = static_cast<int>((m_goal.z+1600.0f)/BM_DIM_STEP);
@ -1148,7 +1148,7 @@ bool CTaskGoto::AdjustBuilding(Math::Vector &pos, float margin, float &distance)
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {
if ( !obj->GetActive() ) continue; if ( !obj->GetActive() ) continue;
if ( obj->GetTruck() != nullptr ) continue; // object transported? if ( obj->GetTransporter() != nullptr ) continue; // object transported?
Math::Vector oPos; Math::Vector oPos;
float suppl = 0.0f; float suppl = 0.0f;
@ -1309,7 +1309,7 @@ bool CTaskGoto::LeakSearch(Math::Vector &pos, float &delay)
{ {
if ( pObj == m_object ) continue; if ( pObj == m_object ) continue;
if ( !pObj->GetActive() ) continue; if ( !pObj->GetActive() ) continue;
if ( pObj->GetTruck() != 0 ) continue; // object transported? if ( pObj->GetTransporter() != 0 ) continue; // object transported?
j = 0; j = 0;
while ( pObj->GetCrashSphere(j++, oPos, oRadius) ) while ( pObj->GetCrashSphere(j++, oPos, oRadius) )
@ -1366,7 +1366,7 @@ void CTaskGoto::ComputeRepulse(Math::Point &dir)
if ( pObj == 0 ) break; if ( pObj == 0 ) break;
if ( pObj == m_object ) continue; if ( pObj == m_object ) continue;
if ( pObj->GetTruck() != 0 ) continue; if ( pObj->GetTransporter() != 0 ) continue;
oPos = pObj->GetPosition(0); oPos = pObj->GetPosition(0);
dist = Math::Distance(oPos, m_goalObject); dist = Math::Distance(oPos, m_goalObject);
@ -1485,7 +1485,7 @@ void CTaskGoto::ComputeRepulse(Math::Point &dir)
for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {
if ( pObj == m_object ) continue; if ( pObj == m_object ) continue;
if ( pObj->GetTruck() != 0 ) continue; if ( pObj->GetTransporter() != 0 ) continue;
oType = pObj->GetType(); oType = pObj->GetType();
@ -1573,7 +1573,7 @@ void CTaskGoto::ComputeFlyingRepulse(float &dir)
for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {
if ( pObj == m_object ) continue; if ( pObj == m_object ) continue;
if ( pObj->GetTruck() != 0 ) continue; if ( pObj->GetTransporter() != 0 ) continue;
oType = pObj->GetType(); oType = pObj->GetType();
@ -1885,8 +1885,8 @@ void CTaskGoto::BitmapObject()
type = pObj->GetType(); type = pObj->GetType();
if ( pObj == m_object ) continue; if ( pObj == m_object ) continue;
if ( pObj == m_bmFretObject ) continue; if ( pObj == m_bmCargoObject ) continue;
if ( pObj->GetTruck() != 0 ) continue; if ( pObj->GetTransporter() != 0 ) continue;
h = m_terrain->GetFloorLevel(pObj->GetPosition(0), false); h = m_terrain->GetFloorLevel(pObj->GetPosition(0), false);
if ( m_physics->GetType() == TYPE_FLYING && m_altitude > 0.0f ) if ( m_physics->GetType() == TYPE_FLYING && m_altitude > 0.0f )

View File

@ -145,7 +145,7 @@ protected:
Math::Vector m_bmPoints[MAXPOINTS+2]; Math::Vector m_bmPoints[MAXPOINTS+2];
char m_bmIter[MAXPOINTS+2]; char m_bmIter[MAXPOINTS+2];
int m_bmIterCounter; int m_bmIterCounter;
CObject* m_bmFretObject; CObject* m_bmCargoObject;
float m_bmFinalMove; // final advance distance float m_bmFinalMove; // final advance distance
float m_bmFinalDist; // effective distance to advance float m_bmFinalDist; // effective distance to advance
Math::Vector m_bmFinalPos; // initial position before advance Math::Vector m_bmFinalPos; // initial position before advance

View File

@ -317,22 +317,22 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
type = m_object->GetType(); type = m_object->GetType();
if ( type == OBJECT_BEE ) // bee? if ( type == OBJECT_BEE ) // bee?
{ {
if ( m_object->GetFret() == 0 ) if ( m_object->GetCargo() == 0 )
{ {
if ( !m_physics->GetLand() ) return ERR_MANIP_FLY; if ( !m_physics->GetLand() ) return ERR_MANIP_FLY;
other = SearchTakeUnderObject(m_targetPos, MARGIN_BEE); other = SearchTakeUnderObject(m_targetPos, MARGIN_BEE);
if ( other == 0 ) return ERR_MANIP_NIL; if ( other == 0 ) return ERR_MANIP_NIL;
m_object->SetFret(other); // takes the ball m_object->SetCargo(other); // takes the ball
other->SetTruck(m_object); other->SetTransporter(m_object);
other->SetTruckPart(0); // taken with the base other->SetTransporterPart(0); // taken with the base
other->SetPosition(0, Math::Vector(0.0f, -3.0f, 0.0f)); other->SetPosition(0, Math::Vector(0.0f, -3.0f, 0.0f));
} }
else else
{ {
other = m_object->GetFret(); // other = ball other = m_object->GetCargo(); // other = ball
m_object->SetFret(0); // lick the ball m_object->SetCargo(0); // lick the ball
other->SetTruck(0); other->SetTransporter(0);
pos = m_object->GetPosition(0); pos = m_object->GetPosition(0);
pos.y -= 3.0f; pos.y -= 3.0f;
other->SetPosition(0, pos); other->SetPosition(0, pos);
@ -354,7 +354,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
if ( m_arm == TMA_GRAB ) // takes immediately? if ( m_arm == TMA_GRAB ) // takes immediately?
{ {
TruckTakeObject(); TransporterTakeObject();
Abort(); Abort();
return ERR_OK; return ERR_OK;
} }
@ -384,7 +384,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
if ( order == TMO_AUTO ) if ( order == TMO_AUTO )
{ {
if ( m_object->GetFret() == 0 ) if ( m_object->GetCargo() == 0 )
{ {
m_order = TMO_GRAB; m_order = TMO_GRAB;
} }
@ -398,11 +398,11 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
m_order = order; m_order = order;
} }
if ( m_order == TMO_GRAB && m_object->GetFret() != 0 ) if ( m_order == TMO_GRAB && m_object->GetCargo() != 0 )
{ {
return ERR_MANIP_BUSY; return ERR_MANIP_BUSY;
} }
if ( m_order == TMO_DROP && m_object->GetFret() == 0 ) if ( m_order == TMO_DROP && m_object->GetCargo() == 0 )
{ {
return ERR_MANIP_EMPTY; return ERR_MANIP_EMPTY;
} }
@ -498,7 +498,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
if ( m_timeLimit < 0.5f ) m_timeLimit = 0.5f; if ( m_timeLimit < 0.5f ) m_timeLimit = 0.5f;
} }
if ( m_object->GetFret() == 0 ) // not carrying anything? if ( m_object->GetCargo() == 0 ) // not carrying anything?
{ {
m_hand = TMH_OPEN; // open clamp m_hand = TMH_OPEN; // open clamp
} }
@ -534,7 +534,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
Error CTaskManip::IsEnded() Error CTaskManip::IsEnded()
{ {
CObject* fret; CObject* cargo;
Math::Vector pos; Math::Vector pos;
float angle, dist; float angle, dist;
int i; int i;
@ -622,8 +622,8 @@ Error CTaskManip::IsEnded()
if ( m_step == 2 ) if ( m_step == 2 )
{ {
if ( m_bSubm ) m_speed = 1.0f/1.5f; if ( m_bSubm ) m_speed = 1.0f/1.5f;
if ( !TruckTakeObject() && if ( !TransporterTakeObject() &&
m_object->GetFret() == 0 ) m_object->GetCargo() == 0 )
{ {
m_hand = TMH_OPEN; // reopens the clamp m_hand = TMH_OPEN; // reopens the clamp
m_arm = TMA_NEUTRAL; m_arm = TMA_NEUTRAL;
@ -634,8 +634,8 @@ Error CTaskManip::IsEnded()
{ {
if ( (m_arm == TMA_OTHER || if ( (m_arm == TMA_OTHER ||
m_arm == TMA_POWER ) && m_arm == TMA_POWER ) &&
(m_fretType == OBJECT_POWER || (m_cargoType == OBJECT_POWER ||
m_fretType == OBJECT_ATOMIC ) ) m_cargoType == OBJECT_ATOMIC ) )
{ {
m_sound->Play(SOUND_POWEROFF, m_object->GetPosition(0)); m_sound->Play(SOUND_POWEROFF, m_object->GetPosition(0));
} }
@ -652,19 +652,19 @@ Error CTaskManip::IsEnded()
if ( m_step == 1 ) if ( m_step == 1 )
{ {
if ( m_bSubm ) m_speed = 1.0f/0.7f; if ( m_bSubm ) m_speed = 1.0f/0.7f;
fret = m_object->GetFret(); cargo = m_object->GetCargo();
if ( TruckDeposeObject() ) if ( TransporterDeposeObject() )
{ {
if ( (m_arm == TMA_OTHER || if ( (m_arm == TMA_OTHER ||
m_arm == TMA_POWER ) && m_arm == TMA_POWER ) &&
(m_fretType == OBJECT_POWER || (m_cargoType == OBJECT_POWER ||
m_fretType == OBJECT_ATOMIC ) ) m_cargoType == OBJECT_ATOMIC ) )
{ {
m_sound->Play(SOUND_POWERON, m_object->GetPosition(0)); m_sound->Play(SOUND_POWERON, m_object->GetPosition(0));
} }
if ( fret != 0 && m_fretType == OBJECT_METAL && m_arm == TMA_FFRONT ) if ( cargo != 0 && m_cargoType == OBJECT_METAL && m_arm == TMA_FFRONT )
{ {
m_main->ShowDropZone(fret, m_object); // shows buildable area m_main->ShowDropZone(cargo, m_object); // shows buildable area
} }
m_hand = TMH_OPEN; // opens the clamp to deposit m_hand = TMH_OPEN; // opens the clamp to deposit
SoundManip(1.0f/m_speed, 0.8f, 1.5f); SoundManip(1.0f/m_speed, 0.8f, 1.5f);
@ -692,7 +692,7 @@ bool CTaskManip::Abort()
{ {
int i; int i;
if ( m_object->GetFret() == 0 ) // not carrying anything? if ( m_object->GetCargo() == 0 ) // not carrying anything?
{ {
m_hand = TMH_OPEN; // open clamp m_hand = TMH_OPEN; // open clamp
m_arm = TMA_NEUTRAL; m_arm = TMA_NEUTRAL;
@ -749,7 +749,7 @@ CObject* CTaskManip::SearchTakeUnderObject(Math::Vector &pos, float dLimit)
type != OBJECT_KEYd && type != OBJECT_KEYd &&
type != OBJECT_TNT ) continue; type != OBJECT_TNT ) continue;
if ( pObj->GetTruck() != 0 ) continue; // object transported? if ( pObj->GetTransporter() != 0 ) continue; // object transported?
if ( pObj->GetLock() ) continue; if ( pObj->GetLock() ) continue;
if ( pObj->GetZoomY(0) != 1.0f ) continue; if ( pObj->GetZoomY(0) != 1.0f ) continue;
@ -821,7 +821,7 @@ CObject* CTaskManip::SearchTakeFrontObject(bool bAdvance, Math::Vector &pos,
type != OBJECT_SCRAP4 && type != OBJECT_SCRAP4 &&
type != OBJECT_SCRAP5 ) continue; type != OBJECT_SCRAP5 ) continue;
if ( pObj->GetTruck() != 0 ) continue; // object transported? if ( pObj->GetTransporter() != 0 ) continue; // object transported?
if ( pObj->GetLock() ) continue; if ( pObj->GetLock() ) continue;
if ( pObj->GetZoomY(0) != 1.0f ) continue; if ( pObj->GetZoomY(0) != 1.0f ) continue;
@ -908,7 +908,7 @@ CObject* CTaskManip::SearchTakeBackObject(bool bAdvance, Math::Vector &pos,
type != OBJECT_SCRAP4 && type != OBJECT_SCRAP4 &&
type != OBJECT_SCRAP5 ) continue; type != OBJECT_SCRAP5 ) continue;
if ( pObj->GetTruck() != 0 ) continue; // object transported? if ( pObj->GetTransporter() != 0 ) continue; // object transported?
if ( pObj->GetLock() ) continue; if ( pObj->GetLock() ) continue;
if ( pObj->GetZoomY(0) != 1.0f ) continue; if ( pObj->GetZoomY(0) != 1.0f ) continue;
@ -1077,9 +1077,9 @@ CObject* CTaskManip::SearchOtherObject(bool bAdvance, Math::Vector &pos,
// Takes the object placed in front. // Takes the object placed in front.
bool CTaskManip::TruckTakeObject() bool CTaskManip::TransporterTakeObject()
{ {
CObject* fret; CObject* cargo;
CObject* other; CObject* other;
Math::Matrix matRotate; Math::Matrix matRotate;
Math::Vector pos; Math::Vector pos;
@ -1087,112 +1087,112 @@ bool CTaskManip::TruckTakeObject()
if ( m_arm == TMA_GRAB ) // takes immediately? if ( m_arm == TMA_GRAB ) // takes immediately?
{ {
fret = m_object->GetFret(); cargo = m_object->GetCargo();
if ( fret == 0 ) return false; // nothing to take? if ( cargo == 0 ) return false; // nothing to take?
m_fretType = fret->GetType(); m_cargoType = cargo->GetType();
if ( m_object->GetType() == OBJECT_HUMAN || if ( m_object->GetType() == OBJECT_HUMAN ||
m_object->GetType() == OBJECT_TECH ) m_object->GetType() == OBJECT_TECH )
{ {
fret->SetTruck(m_object); cargo->SetTransporter(m_object);
fret->SetTruckPart(4); // takes with the hand cargo->SetTransporterPart(4); // takes with the hand
fret->SetPosition(0, Math::Vector(1.7f, -0.5f, 1.1f)); cargo->SetPosition(0, Math::Vector(1.7f, -0.5f, 1.1f));
fret->SetAngleY(0, 0.1f); cargo->SetAngleY(0, 0.1f);
fret->SetAngleX(0, 0.0f); cargo->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, 0.8f); cargo->SetAngleZ(0, 0.8f);
} }
else if ( m_bSubm ) else if ( m_bSubm )
{ {
fret->SetTruck(m_object); cargo->SetTransporter(m_object);
fret->SetTruckPart(2); // takes with the right claw cargo->SetTransporterPart(2); // takes with the right claw
pos = Math::Vector(1.1f, -1.0f, 1.0f); // relative pos = Math::Vector(1.1f, -1.0f, 1.0f); // relative
fret->SetPosition(0, pos); cargo->SetPosition(0, pos);
fret->SetAngleX(0, 0.0f); cargo->SetAngleX(0, 0.0f);
fret->SetAngleY(0, 0.0f); cargo->SetAngleY(0, 0.0f);
fret->SetAngleZ(0, 0.0f); cargo->SetAngleZ(0, 0.0f);
} }
else else
{ {
fret->SetTruck(m_object); cargo->SetTransporter(m_object);
fret->SetTruckPart(3); // takes with the hand cargo->SetTransporterPart(3); // takes with the hand
pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4) pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4)
fret->SetPosition(0, pos); cargo->SetPosition(0, pos);
fret->SetAngleX(0, 0.0f); cargo->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, Math::PI/2.0f); cargo->SetAngleZ(0, Math::PI/2.0f);
fret->SetAngleY(0, 0.0f); cargo->SetAngleY(0, 0.0f);
} }
m_object->SetFret(fret); // takes m_object->SetCargo(cargo); // takes
} }
if ( m_arm == TMA_FFRONT ) // takes on the ground in front? if ( m_arm == TMA_FFRONT ) // takes on the ground in front?
{ {
fret = SearchTakeFrontObject(false, pos, dist, angle); cargo = SearchTakeFrontObject(false, pos, dist, angle);
if ( fret == 0 ) return false; // nothing to take? if ( cargo == 0 ) return false; // nothing to take?
m_fretType = fret->GetType(); m_cargoType = cargo->GetType();
if ( m_bSubm ) if ( m_bSubm )
{ {
fret->SetTruck(m_object); cargo->SetTransporter(m_object);
fret->SetTruckPart(2); // takes with the right claw cargo->SetTransporterPart(2); // takes with the right claw
pos = Math::Vector(1.1f, -1.0f, 1.0f); // relative pos = Math::Vector(1.1f, -1.0f, 1.0f); // relative
fret->SetPosition(0, pos); cargo->SetPosition(0, pos);
fret->SetAngleX(0, 0.0f); cargo->SetAngleX(0, 0.0f);
fret->SetAngleY(0, 0.0f); cargo->SetAngleY(0, 0.0f);
fret->SetAngleZ(0, 0.0f); cargo->SetAngleZ(0, 0.0f);
} }
else else
{ {
fret->SetTruck(m_object); cargo->SetTransporter(m_object);
fret->SetTruckPart(3); // takes with the hand cargo->SetTransporterPart(3); // takes with the hand
pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4) pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4)
fret->SetPosition(0, pos); cargo->SetPosition(0, pos);
fret->SetAngleX(0, 0.0f); cargo->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, Math::PI/2.0f); cargo->SetAngleZ(0, Math::PI/2.0f);
fret->SetAngleY(0, 0.0f); cargo->SetAngleY(0, 0.0f);
} }
m_object->SetFret(fret); // takes m_object->SetCargo(cargo); // takes
} }
if ( m_arm == TMA_FBACK ) // takes on the ground behind? if ( m_arm == TMA_FBACK ) // takes on the ground behind?
{ {
fret = SearchTakeBackObject(false, pos, dist, angle); cargo = SearchTakeBackObject(false, pos, dist, angle);
if ( fret == 0 ) return false; // nothing to take? if ( cargo == 0 ) return false; // nothing to take?
m_fretType = fret->GetType(); m_cargoType = cargo->GetType();
fret->SetTruck(m_object); cargo->SetTransporter(m_object);
fret->SetTruckPart(3); // takes with the hand cargo->SetTransporterPart(3); // takes with the hand
pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4) pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4)
fret->SetPosition(0, pos); cargo->SetPosition(0, pos);
fret->SetAngleX(0, 0.0f); cargo->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, Math::PI/2.0f); cargo->SetAngleZ(0, Math::PI/2.0f);
fret->SetAngleY(0, 0.0f); cargo->SetAngleY(0, 0.0f);
m_object->SetFret(fret); // takes m_object->SetCargo(cargo); // takes
} }
if ( m_arm == TMA_POWER ) // takes battery in the back? if ( m_arm == TMA_POWER ) // takes battery in the back?
{ {
fret = m_object->GetPower(); cargo = m_object->GetPower();
if ( fret == 0 ) return false; // no battery? if ( cargo == 0 ) return false; // no battery?
m_fretType = fret->GetType(); m_cargoType = cargo->GetType();
pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4) pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4)
fret->SetPosition(0, pos); cargo->SetPosition(0, pos);
fret->SetAngleX(0, 0.0f); cargo->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, Math::PI/2.0f); cargo->SetAngleZ(0, Math::PI/2.0f);
fret->SetAngleY(0, 0.0f); cargo->SetAngleY(0, 0.0f);
fret->SetTruckPart(3); // takes with the hand cargo->SetTransporterPart(3); // takes with the hand
m_object->SetPower(0); m_object->SetPower(0);
m_object->SetFret(fret); // takes m_object->SetCargo(cargo); // takes
} }
if ( m_arm == TMA_OTHER ) // battery takes from friend? if ( m_arm == TMA_OTHER ) // battery takes from friend?
@ -1200,21 +1200,21 @@ bool CTaskManip::TruckTakeObject()
other = SearchOtherObject(false, pos, dist, angle, m_height); other = SearchOtherObject(false, pos, dist, angle, m_height);
if ( other == 0 ) return false; if ( other == 0 ) return false;
fret = other->GetPower(); cargo = other->GetPower();
if ( fret == 0 ) return false; // the other does not have a battery? if ( cargo == 0 ) return false; // the other does not have a battery?
m_fretType = fret->GetType(); m_cargoType = cargo->GetType();
other->SetPower(0); other->SetPower(0);
fret->SetTruck(m_object); cargo->SetTransporter(m_object);
fret->SetTruckPart(3); // takes with the hand cargo->SetTransporterPart(3); // takes with the hand
pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4) pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4)
fret->SetPosition(0, pos); cargo->SetPosition(0, pos);
fret->SetAngleX(0, 0.0f); cargo->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, Math::PI/2.0f); cargo->SetAngleZ(0, Math::PI/2.0f);
fret->SetAngleY(0, 0.0f); cargo->SetAngleY(0, 0.0f);
m_object->SetFret(fret); // takes m_object->SetCargo(cargo); // takes
} }
return true; return true;
@ -1222,10 +1222,10 @@ bool CTaskManip::TruckTakeObject()
// Deposes the object taken. // Deposes the object taken.
bool CTaskManip::TruckDeposeObject() bool CTaskManip::TransporterDeposeObject()
{ {
Character* character; Character* character;
CObject* fret; CObject* cargo;
CObject* other; CObject* other;
Math::Matrix* mat; Math::Matrix* mat;
Math::Vector pos; Math::Vector pos;
@ -1233,60 +1233,60 @@ bool CTaskManip::TruckDeposeObject()
if ( m_arm == TMA_FFRONT ) // deposits on the ground in front? if ( m_arm == TMA_FFRONT ) // deposits on the ground in front?
{ {
fret = m_object->GetFret(); cargo = m_object->GetCargo();
if ( fret == 0 ) return false; // nothing transported? if ( cargo == 0 ) return false; // nothing transported?
m_fretType = fret->GetType(); m_cargoType = cargo->GetType();
mat = fret->GetWorldMatrix(0); mat = cargo->GetWorldMatrix(0);
pos = Transform(*mat, Math::Vector(0.0f, 1.0f, 0.0f)); pos = Transform(*mat, Math::Vector(0.0f, 1.0f, 0.0f));
m_terrain->AdjustToFloor(pos); m_terrain->AdjustToFloor(pos);
fret->SetPosition(0, pos); cargo->SetPosition(0, pos);
fret->SetAngleY(0, m_object->GetAngleY(0)+Math::PI/2.0f); cargo->SetAngleY(0, m_object->GetAngleY(0)+Math::PI/2.0f);
fret->SetAngleX(0, 0.0f); cargo->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, 0.0f); cargo->SetAngleZ(0, 0.0f);
fret->FloorAdjust(); // plate well on the ground cargo->FloorAdjust(); // plate well on the ground
fret->SetTruck(0); cargo->SetTransporter(0);
m_object->SetFret(0); // deposit m_object->SetCargo(0); // deposit
} }
if ( m_arm == TMA_FBACK ) // deposited on the ground behind? if ( m_arm == TMA_FBACK ) // deposited on the ground behind?
{ {
fret = m_object->GetFret(); cargo = m_object->GetCargo();
if ( fret == 0 ) return false; // nothing transported? if ( cargo == 0 ) return false; // nothing transported?
m_fretType = fret->GetType(); m_cargoType = cargo->GetType();
mat = fret->GetWorldMatrix(0); mat = cargo->GetWorldMatrix(0);
pos = Transform(*mat, Math::Vector(0.0f, 1.0f, 0.0f)); pos = Transform(*mat, Math::Vector(0.0f, 1.0f, 0.0f));
m_terrain->AdjustToFloor(pos); m_terrain->AdjustToFloor(pos);
fret->SetPosition(0, pos); cargo->SetPosition(0, pos);
fret->SetAngleY(0, m_object->GetAngleY(0)+Math::PI/2.0f); cargo->SetAngleY(0, m_object->GetAngleY(0)+Math::PI/2.0f);
fret->SetAngleX(0, 0.0f); cargo->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, 0.0f); cargo->SetAngleZ(0, 0.0f);
fret->SetTruck(0); cargo->SetTransporter(0);
m_object->SetFret(0); // deposit m_object->SetCargo(0); // deposit
} }
if ( m_arm == TMA_POWER ) // deposits battery in the back? if ( m_arm == TMA_POWER ) // deposits battery in the back?
{ {
fret = m_object->GetFret(); cargo = m_object->GetCargo();
if ( fret == 0 ) return false; // nothing transported? if ( cargo == 0 ) return false; // nothing transported?
m_fretType = fret->GetType(); m_cargoType = cargo->GetType();
if ( m_object->GetPower() != 0 ) return false; if ( m_object->GetPower() != 0 ) return false;
fret->SetTruck(m_object); cargo->SetTransporter(m_object);
fret->SetTruckPart(0); // carried by the base cargo->SetTransporterPart(0); // carried by the base
character = m_object->GetCharacter(); character = m_object->GetCharacter();
fret->SetPosition(0, character->posPower); cargo->SetPosition(0, character->posPower);
fret->SetAngleY(0, 0.0f); cargo->SetAngleY(0, 0.0f);
fret->SetAngleX(0, 0.0f); cargo->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, 0.0f); cargo->SetAngleZ(0, 0.0f);
m_object->SetPower(fret); // uses m_object->SetPower(cargo); // uses
m_object->SetFret(0); m_object->SetCargo(0);
} }
if ( m_arm == TMA_OTHER ) // deposits battery on friend? if ( m_arm == TMA_OTHER ) // deposits battery on friend?
@ -1294,24 +1294,24 @@ bool CTaskManip::TruckDeposeObject()
other = SearchOtherObject(false, pos, dist, angle, m_height); other = SearchOtherObject(false, pos, dist, angle, m_height);
if ( other == 0 ) return false; if ( other == 0 ) return false;
fret = other->GetPower(); cargo = other->GetPower();
if ( fret != 0 ) return false; // the other already has a battery? if ( cargo != 0 ) return false; // the other already has a battery?
fret = m_object->GetFret(); cargo = m_object->GetCargo();
if ( fret == 0 ) return false; if ( cargo == 0 ) return false;
m_fretType = fret->GetType(); m_cargoType = cargo->GetType();
other->SetPower(fret); other->SetPower(cargo);
fret->SetTruck(other); cargo->SetTransporter(other);
character = other->GetCharacter(); character = other->GetCharacter();
fret->SetPosition(0, character->posPower); cargo->SetPosition(0, character->posPower);
fret->SetAngleY(0, 0.0f); cargo->SetAngleY(0, 0.0f);
fret->SetAngleX(0, 0.0f); cargo->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, 0.0f); cargo->SetAngleZ(0, 0.0f);
fret->SetTruckPart(0); // carried by the base cargo->SetTransporterPart(0); // carried by the base
m_object->SetFret(0); // deposit m_object->SetCargo(0); // deposit
} }
return true; return true;
@ -1328,7 +1328,7 @@ bool CTaskManip::IsFreeDeposeObject(Math::Vector pos)
{ {
if ( obj == m_object ) continue; if ( obj == m_object ) continue;
if ( !obj->GetActive() ) continue; // inactive? if ( !obj->GetActive() ) continue; // inactive?
if ( obj->GetTruck() != nullptr ) continue; // object transported? if ( obj->GetTransporter() != nullptr ) continue; // object transported?
Math::Vector oPos; Math::Vector oPos;
float oRadius = 0.0f; float oRadius = 0.0f;

View File

@ -72,8 +72,8 @@ protected:
CObject* SearchTakeFrontObject(bool bAdvance, Math::Vector &pos, float &distance, float &angle); CObject* SearchTakeFrontObject(bool bAdvance, Math::Vector &pos, float &distance, float &angle);
CObject* SearchTakeBackObject(bool bAdvance, Math::Vector &pos, float &distance, float &angle); CObject* SearchTakeBackObject(bool bAdvance, Math::Vector &pos, float &distance, float &angle);
CObject* SearchOtherObject(bool bAdvance, Math::Vector &pos, float &distance, float &angle, float &height); CObject* SearchOtherObject(bool bAdvance, Math::Vector &pos, float &distance, float &angle, float &height);
bool TruckTakeObject(); bool TransporterTakeObject();
bool TruckDeposeObject(); bool TransporterDeposeObject();
bool IsFreeDeposeObject(Math::Vector pos); bool IsFreeDeposeObject(Math::Vector pos);
void SoundManip(float time, float amplitude=1.0f, float frequency=1.0f); void SoundManip(float time, float amplitude=1.0f, float frequency=1.0f);
@ -97,6 +97,6 @@ protected:
float m_move; float m_move;
Math::Vector m_targetPos; Math::Vector m_targetPos;
float m_timeLimit; float m_timeLimit;
ObjectType m_fretType; ObjectType m_cargoType;
}; };

View File

@ -163,14 +163,14 @@ bool CTaskReset::EventProcess(const Event &event)
Error CTaskReset::Start(Math::Vector goal, Math::Vector angle) Error CTaskReset::Start(Math::Vector goal, Math::Vector angle)
{ {
CObject* fret; CObject* cargo;
int i; int i;
fret = m_object->GetFret(); cargo = m_object->GetCargo();
if ( fret != 0 && fret->GetResetCap() == RESET_MOVE ) if ( cargo != 0 && cargo->GetResetCap() == RESET_MOVE )
{ {
fret->SetTruck(0); cargo->SetTransporter(0);
m_object->SetFret(0); // does nothing m_object->SetCargo(0); // does nothing
} }
if ( !m_main->GetNiceReset() ) // quick return? if ( !m_main->GetNiceReset() ) // quick return?

View File

@ -112,7 +112,7 @@ Error CTaskTake::Start()
m_physics->SetMotorSpeed(Math::Vector(0.0f, 0.0f, 0.0f)); m_physics->SetMotorSpeed(Math::Vector(0.0f, 0.0f, 0.0f));
if ( m_object->GetFret() == 0 ) if ( m_object->GetCargo() == 0 )
{ {
m_order = TTO_TAKE; m_order = TTO_TAKE;
} }
@ -192,7 +192,7 @@ Error CTaskTake::Start()
Error CTaskTake::IsEnded() Error CTaskTake::IsEnded()
{ {
CObject* fret; CObject* cargo;
float angle; float angle;
if ( m_engine->GetPause() ) return ERR_CONTINUE; if ( m_engine->GetPause() ) return ERR_CONTINUE;
@ -238,11 +238,11 @@ Error CTaskTake::IsEnded()
{ {
if ( m_step == 1 ) if ( m_step == 1 )
{ {
if ( TruckTakeObject() ) if ( TransporterTakeObject() )
{ {
if ( m_arm == TTA_FRIEND && if ( m_arm == TTA_FRIEND &&
(m_fretType == OBJECT_POWER || (m_cargoType == OBJECT_POWER ||
m_fretType == OBJECT_ATOMIC ) ) m_cargoType == OBJECT_ATOMIC ) )
{ {
m_sound->Play(SOUND_POWEROFF, m_object->GetPosition(0)); m_sound->Play(SOUND_POWEROFF, m_object->GetPosition(0));
} }
@ -259,17 +259,17 @@ Error CTaskTake::IsEnded()
{ {
if ( m_step == 1 ) if ( m_step == 1 )
{ {
fret = m_object->GetFret(); cargo = m_object->GetCargo();
TruckDeposeObject(); TransporterDeposeObject();
if ( m_arm == TTA_FRIEND && if ( m_arm == TTA_FRIEND &&
(m_fretType == OBJECT_POWER || (m_cargoType == OBJECT_POWER ||
m_fretType == OBJECT_ATOMIC ) ) m_cargoType == OBJECT_ATOMIC ) )
{ {
m_sound->Play(SOUND_POWERON, m_object->GetPosition(0)); m_sound->Play(SOUND_POWERON, m_object->GetPosition(0));
} }
if ( fret != 0 && m_fretType == OBJECT_METAL && m_arm == TTA_FFRONT ) if ( cargo != 0 && m_cargoType == OBJECT_METAL && m_arm == TTA_FFRONT )
{ {
m_main->ShowDropZone(fret, m_object); // shows buildable area m_main->ShowDropZone(cargo, m_object); // shows buildable area
} }
m_motion->SetAction(-1); // gets up m_motion->SetAction(-1); // gets up
m_progress = 0.0f; m_progress = 0.0f;
@ -329,7 +329,7 @@ CObject* CTaskTake::SearchTakeObject(float &angle,
type != OBJECT_KEYd && type != OBJECT_KEYd &&
type != OBJECT_TNT ) continue; type != OBJECT_TNT ) continue;
if ( pObj->GetTruck() != 0 ) continue; // object transported? if ( pObj->GetTransporter() != 0 ) continue; // object transported?
if ( pObj->GetLock() ) continue; if ( pObj->GetLock() ) continue;
if ( pObj->GetZoomY(0) != 1.0f ) continue; if ( pObj->GetZoomY(0) != 1.0f ) continue;
@ -442,30 +442,30 @@ CObject* CTaskTake::SearchFriendObject(float &angle,
// Takes the object in front. // Takes the object in front.
bool CTaskTake::TruckTakeObject() bool CTaskTake::TransporterTakeObject()
{ {
CObject* fret; CObject* cargo;
CObject* other; CObject* other;
Math::Matrix matRotate; Math::Matrix matRotate;
float angle; float angle;
if ( m_arm == TTA_FFRONT ) // takes on the ground in front? if ( m_arm == TTA_FFRONT ) // takes on the ground in front?
{ {
//? fret = SearchTakeObject(angle, 1.5f, Math::PI*0.04f); //? cargo = SearchTakeObject(angle, 1.5f, Math::PI*0.04f);
fret = SearchTakeObject(angle, 1.5f, Math::PI*0.15f); //OK 1.9 cargo = SearchTakeObject(angle, 1.5f, Math::PI*0.15f); //OK 1.9
if ( fret == 0 ) return false; // rien <20> prendre ? if ( cargo == 0 ) return false; // rien <20> prendre ?
m_fretType = fret->GetType(); m_cargoType = cargo->GetType();
fret->SetTruck(m_object); cargo->SetTransporter(m_object);
fret->SetTruckPart(4); // takes with the hand cargo->SetTransporterPart(4); // takes with the hand
//? fret->SetPosition(0, Math::Vector(2.2f, -1.0f, 1.1f)); //? cargo->SetPosition(0, Math::Vector(2.2f, -1.0f, 1.1f));
fret->SetPosition(0, Math::Vector(1.7f, -0.5f, 1.1f)); cargo->SetPosition(0, Math::Vector(1.7f, -0.5f, 1.1f));
fret->SetAngleY(0, 0.1f); cargo->SetAngleY(0, 0.1f);
fret->SetAngleX(0, 0.0f); cargo->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, 0.8f); cargo->SetAngleZ(0, 0.8f);
m_object->SetFret(fret); // takes m_object->SetCargo(cargo); // takes
} }
if ( m_arm == TTA_FRIEND ) // takes friend's battery? if ( m_arm == TTA_FRIEND ) // takes friend's battery?
@ -473,21 +473,21 @@ bool CTaskTake::TruckTakeObject()
other = SearchFriendObject(angle, 1.5f, Math::PI*0.04f); other = SearchFriendObject(angle, 1.5f, Math::PI*0.04f);
if ( other == 0 ) return false; if ( other == 0 ) return false;
fret = other->GetPower(); cargo = other->GetPower();
if ( fret == 0 ) return false; // the other does not have a battery? if ( cargo == 0 ) return false; // the other does not have a battery?
m_fretType = fret->GetType(); m_cargoType = cargo->GetType();
other->SetPower(0); other->SetPower(0);
fret->SetTruck(m_object); cargo->SetTransporter(m_object);
fret->SetTruckPart(4); // takes with the hand cargo->SetTransporterPart(4); // takes with the hand
//? fret->SetPosition(0, Math::Vector(2.2f, -1.0f, 1.1f)); //? cargo->SetPosition(0, Math::Vector(2.2f, -1.0f, 1.1f));
fret->SetPosition(0, Math::Vector(1.7f, -0.5f, 1.1f)); cargo->SetPosition(0, Math::Vector(1.7f, -0.5f, 1.1f));
fret->SetAngleY(0, 0.1f); cargo->SetAngleY(0, 0.1f);
fret->SetAngleX(0, 0.0f); cargo->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, 0.8f); cargo->SetAngleZ(0, 0.8f);
m_object->SetFret(fret); // takes m_object->SetCargo(cargo); // takes
} }
return true; return true;
@ -495,10 +495,10 @@ bool CTaskTake::TruckTakeObject()
// Deposes the object taken. // Deposes the object taken.
bool CTaskTake::TruckDeposeObject() bool CTaskTake::TransporterDeposeObject()
{ {
Character* character; Character* character;
CObject* fret; CObject* cargo;
CObject* other; CObject* other;
Math::Matrix* mat; Math::Matrix* mat;
Math::Vector pos; Math::Vector pos;
@ -506,21 +506,21 @@ bool CTaskTake::TruckDeposeObject()
if ( m_arm == TTA_FFRONT ) // deposes on the ground in front? if ( m_arm == TTA_FFRONT ) // deposes on the ground in front?
{ {
fret = m_object->GetFret(); cargo = m_object->GetCargo();
if ( fret == 0 ) return false; // does nothing? if ( cargo == 0 ) return false; // does nothing?
m_fretType = fret->GetType(); m_cargoType = cargo->GetType();
mat = fret->GetWorldMatrix(0); mat = cargo->GetWorldMatrix(0);
pos = Transform(*mat, Math::Vector(-0.5f, 1.0f, 0.0f)); pos = Transform(*mat, Math::Vector(-0.5f, 1.0f, 0.0f));
m_terrain->AdjustToFloor(pos); m_terrain->AdjustToFloor(pos);
fret->SetPosition(0, pos); cargo->SetPosition(0, pos);
fret->SetAngleY(0, m_object->GetAngleY(0)+Math::PI/2.0f); cargo->SetAngleY(0, m_object->GetAngleY(0)+Math::PI/2.0f);
fret->SetAngleX(0, 0.0f); cargo->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, 0.0f); cargo->SetAngleZ(0, 0.0f);
fret->FloorAdjust(); // plate well on the ground cargo->FloorAdjust(); // plate well on the ground
fret->SetTruck(0); cargo->SetTransporter(0);
m_object->SetFret(0); // deposit m_object->SetCargo(0); // deposit
} }
if ( m_arm == TTA_FRIEND ) // deposes battery on friends? if ( m_arm == TTA_FRIEND ) // deposes battery on friends?
@ -528,24 +528,24 @@ bool CTaskTake::TruckDeposeObject()
other = SearchFriendObject(angle, 1.5f, Math::PI*0.04f); other = SearchFriendObject(angle, 1.5f, Math::PI*0.04f);
if ( other == 0 ) return false; if ( other == 0 ) return false;
fret = other->GetPower(); cargo = other->GetPower();
if ( fret != 0 ) return false; // the other already has a battery? if ( cargo != 0 ) return false; // the other already has a battery?
fret = m_object->GetFret(); cargo = m_object->GetCargo();
if ( fret == 0 ) return false; if ( cargo == 0 ) return false;
m_fretType = fret->GetType(); m_cargoType = cargo->GetType();
other->SetPower(fret); other->SetPower(cargo);
fret->SetTruck(other); cargo->SetTransporter(other);
character = other->GetCharacter(); character = other->GetCharacter();
fret->SetPosition(0, character->posPower); cargo->SetPosition(0, character->posPower);
fret->SetAngleY(0, 0.0f); cargo->SetAngleY(0, 0.0f);
fret->SetAngleX(0, 0.0f); cargo->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, 0.0f); cargo->SetAngleZ(0, 0.0f);
fret->SetTruckPart(0); // carried by the base cargo->SetTransporterPart(0); // carried by the base
m_object->SetFret(0); // deposit m_object->SetCargo(0); // deposit
} }
return true; return true;
@ -567,7 +567,7 @@ bool CTaskTake::IsFreeDeposeObject(Math::Vector pos)
{ {
if ( pObj == m_object ) continue; if ( pObj == m_object ) continue;
if ( !pObj->GetActive() ) continue; // inactive? if ( !pObj->GetActive() ) continue; // inactive?
if ( pObj->GetTruck() != 0 ) continue; // object transported? if ( pObj->GetTransporter() != 0 ) continue; // object transported?
j = 0; j = 0;
while ( pObj->GetCrashSphere(j++, oPos, oRadius) ) while ( pObj->GetCrashSphere(j++, oPos, oRadius) )

View File

@ -57,8 +57,8 @@ public:
protected: protected:
CObject* SearchTakeObject(float &angle, float dLimit, float aLimit); CObject* SearchTakeObject(float &angle, float dLimit, float aLimit);
CObject* SearchFriendObject(float &angle, float dLimit, float aLimit); CObject* SearchFriendObject(float &angle, float dLimit, float aLimit);
bool TruckTakeObject(); bool TransporterTakeObject();
bool TruckDeposeObject(); bool TransporterDeposeObject();
bool IsFreeDeposeObject(Math::Vector pos); bool IsFreeDeposeObject(Math::Vector pos);
protected: protected:
@ -74,6 +74,6 @@ protected:
bool m_bError; bool m_bError;
bool m_bTurn; bool m_bTurn;
float m_angle; float m_angle;
ObjectType m_fretType; ObjectType m_cargoType;
}; };

View File

@ -810,7 +810,7 @@ void CPhysics::MotorUpdate(float aTime, float rTime)
type == OBJECT_TECH ) type == OBJECT_TECH )
{ {
power = 0; power = 0;
if ( m_object->GetFret() != 0 && // carries something? if ( m_object->GetCargo() != 0 && // carries something?
!m_object->IsSpaceshipCargo() ) !m_object->IsSpaceshipCargo() )
{ {
motorSpeed.x *= 0.7f; // forward more slowly motorSpeed.x *= 0.7f; // forward more slowly
@ -825,7 +825,7 @@ void CPhysics::MotorUpdate(float aTime, float rTime)
motorSpeed.z *= 0.5f; motorSpeed.z *= 0.5f;
motorSpeed.y *= 0.5f; motorSpeed.y *= 0.5f;
if ( m_object->GetFret() != 0 ) // carries something? if ( m_object->GetCargo() != 0 ) // carries something?
{ {
motorSpeed.x *= 0.2f; motorSpeed.x *= 0.2f;
motorSpeed.z *= 0.9f; motorSpeed.z *= 0.9f;
@ -1780,7 +1780,7 @@ void CPhysics::WaterFrame(float aTime, float rTime)
level = m_water->GetLevel(); level = m_water->GetLevel();
if ( level == 0.0f ) return; // no water? if ( level == 0.0f ) return; // no water?
if ( m_object->GetTruck() != 0 ) return; // object transported? if ( m_object->GetTransporter() != 0 ) return; // object transported?
// Management of flames into the lava. // Management of flames into the lava.
pos = m_object->GetPosition(0); pos = m_object->GetPosition(0);
@ -2529,7 +2529,7 @@ int CPhysics::ObjectAdapt(const Math::Vector &pos, const Math::Vector &angle)
for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* pObj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {
if ( pObj == m_object ) continue; // yourself? if ( pObj == m_object ) continue; // yourself?
if ( pObj->GetTruck() != 0 ) continue; // object transported? if ( pObj->GetTransporter() != 0 ) continue; // object transported?
if ( !pObj->GetEnable() ) continue; // inactive? if ( !pObj->GetEnable() ) continue; // inactive?
if ( pObj->GetRuin() ) continue; // is burning or exploding? if ( pObj->GetRuin() ) continue; // is burning or exploding?
if ( pObj->GetDead() ) continue; // dead man? if ( pObj->GetDead() ) continue; // dead man?
@ -3039,15 +3039,15 @@ void CPhysics::FrameParticle(float aTime, float rTime)
void CPhysics::PowerParticle(float factor, bool bBreak) void CPhysics::PowerParticle(float factor, bool bBreak)
{ {
Character* character; Character* character;
CObject* fret; CObject* cargo;
Math::Matrix* mat; Math::Matrix* mat;
Math::Vector pos, ppos, eye, speed; Math::Vector pos, ppos, eye, speed;
Math::Point dim; Math::Point dim;
bool bCarryPower; bool bCarryPower;
bCarryPower = false; bCarryPower = false;
fret = m_object->GetFret(); cargo = m_object->GetCargo();
if ( fret != 0 && fret->GetType() == OBJECT_POWER && if ( cargo != 0 && cargo->GetType() == OBJECT_POWER &&
m_object->GetAngleZ(1) == ARM_STOCK_ANGLE1 ) m_object->GetAngleZ(1) == ARM_STOCK_ANGLE1 )
{ {
bCarryPower = true; // carries a battery bCarryPower = true; // carries a battery

View File

@ -1159,7 +1159,7 @@ void CMap::UpdateObject(CObject* pObj)
if ( !pObj->GetActive() ) return; if ( !pObj->GetActive() ) return;
if ( !pObj->GetSelectable() ) return; if ( !pObj->GetSelectable() ) return;
if ( pObj->GetProxyActivate() ) return; if ( pObj->GetProxyActivate() ) return;
if ( pObj->GetTruck() != 0 ) return; if ( pObj->GetTransporter() != 0 ) return;
type = pObj->GetType(); type = pObj->GetType();
pos = pObj->GetPosition(0); pos = pObj->GetPosition(0);

View File

@ -245,9 +245,9 @@ CObject* CTarget::DetectFriendObject(Math::Point pos)
} }
else if ( (type == OBJECT_POWER || else if ( (type == OBJECT_POWER ||
type == OBJECT_ATOMIC ) && type == OBJECT_ATOMIC ) &&
obj->GetTruck() != nullptr ) // battery used? obj->GetTransporter() != nullptr ) // battery used?
{ {
target = obj->GetTruck(); target = obj->GetTransporter();
if ( target->GetType() == OBJECT_MOBILEtg ) if ( target->GetType() == OBJECT_MOBILEtg )
{ {
target = nullptr; target = nullptr;