Clean up more functions from COldObjectInterface

master
Piotr Dziwinski 2015-07-12 15:09:32 +02:00
parent 06e5d076f8
commit e72936c240
15 changed files with 121 additions and 499 deletions

View File

@ -18,8 +18,6 @@
*/ */
#include <stdio.h>
#include "object/auto/autobase.h" #include "object/auto/autobase.h"
#include "object/interface/transportable_object.h" #include "object/interface/transportable_object.h"
@ -1241,10 +1239,9 @@ void CAutoBase::UpdateInterface()
void CAutoBase::FreezeCargo(bool freeze) void CAutoBase::FreezeCargo(bool freeze)
{ {
m_cargoObjects.clear();
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects())
{ {
obj->SetSpaceshipCargo(false);
if ( obj == m_object ) continue; // yourself? if ( obj == m_object ) continue; // yourself?
if (IsObjectBeingTransported(obj)) continue; if (IsObjectBeingTransported(obj)) continue;
@ -1252,11 +1249,7 @@ void CAutoBase::FreezeCargo(bool freeze)
float dist = Math::DistanceProjected(m_pos, oPos); float dist = Math::DistanceProjected(m_pos, oPos);
if ( dist < 32.0f ) if ( dist < 32.0f )
{ {
if ( freeze ) m_cargoObjects.insert(obj);
{
obj->SetSpaceshipCargo(true);
}
CPhysics* physics = obj->GetPhysics(); CPhysics* physics = obj->GetPhysics();
if ( physics != nullptr ) if ( physics != nullptr )
{ {
@ -1272,10 +1265,8 @@ void CAutoBase::MoveCargo()
{ {
Math::Vector sPos = m_object->GetPosition(); Math::Vector sPos = m_object->GetPosition();
for (CObject* obj : CObjectManager::GetInstancePointer()->GetAllObjects()) for (CObject* obj : m_cargoObjects)
{ {
if ( !obj->IsSpaceshipCargo() ) continue;
Math::Vector oPos = obj->GetPosition(); Math::Vector oPos = obj->GetPosition();
oPos.y = sPos.y+30.0f; oPos.y = sPos.y+30.0f;
oPos.y += obj->GetCharacter()->height; oPos.y += obj->GetCharacter()->height;

View File

@ -26,7 +26,9 @@
#include "graphics/core/color.h" #include "graphics/core/color.h"
#include <set>
class CObject;
enum AutoBaseParam enum AutoBaseParam
{ {
@ -115,5 +117,6 @@ protected:
Gfx::Color m_bgDown; Gfx::Color m_bgDown;
Gfx::Color m_bgCloudUp; Gfx::Color m_bgCloudUp;
Gfx::Color m_bgCloudDown; Gfx::Color m_bgCloudDown;
std::set<CObject*> m_cargoObjects;
}; };

View File

@ -113,6 +113,7 @@ void CAutoEgg::Init()
alien->SetZoom(0, 0.01f); // invisible ! alien->SetZoom(0, 0.01f); // invisible !
} }
alien->SetLock(true); alien->SetLock(true);
alien->SetActivity(false); alien->SetActivity(false);
} }

View File

@ -638,7 +638,7 @@ bool CAutoFactory::CreateVehicle()
pos = Transform(*mat, pos); pos = Transform(*mat, pos);
CObject* vehicle = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, m_type); CObject* vehicle = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, m_type);
vehicle->UpdateMapping();
vehicle->SetLock(true); // not usable vehicle->SetLock(true); // not usable
vehicle->SetRange(30.0f); vehicle->SetRange(30.0f);
vehicle->SetTeam(m_object->GetTeam()); vehicle->SetTeam(m_object->GetTeam());
@ -657,7 +657,7 @@ bool CAutoFactory::CreateVehicle()
char* name = m_main->GetNewScriptName(m_type, i); char* name = m_main->GetNewScriptName(m_type, i);
if ( name == nullptr ) break; if ( name == nullptr ) break;
Program* prog = brain->GetOrAddProgram(i); Program* prog = brain->GetOrAddProgram(i);
vehicle->ReadProgram(prog, name); brain->ReadProgram(prog, name);
prog->readOnly = true; prog->readOnly = true;
} }
} }

View File

@ -139,6 +139,7 @@ bool CAutoRepair::EventProcess(const Event &event)
if ( m_phase == ARP_REPAIR ) if ( m_phase == ARP_REPAIR )
{ {
vehicle = SearchVehicle(); vehicle = SearchVehicle();
if ( m_progress < 1.0f || if ( m_progress < 1.0f ||
(vehicle != 0 && vehicle->GetShield() < 1.0f) ) (vehicle != 0 && vehicle->GetShield() < 1.0f) )
{ {

View File

@ -44,5 +44,6 @@ public:
* returned object will always be non-null*/ * returned object will always be non-null*/
virtual CBrain* GetBrain() = 0; virtual CBrain* GetBrain() = 0;
// TODO: CBrain interface can actually be moved here // TODO: CBrain interface can actually be moved here
}; };

View File

@ -1074,6 +1074,8 @@ CObjectUPtr CObjectFactory::CreateBuilding(const ObjectCreateParams& params)
AddObjectAuto(obj.get()); AddObjectAuto(obj.get());
m_engine->LoadAllTextures(); m_engine->LoadAllTextures();
obj->UpdateMapping();
return std::move(obj); return std::move(obj);
} }

View File

@ -80,14 +80,16 @@ static float debug_arm3 = 0.0f;
void uObject(CBotVar* botThis, void* user) void uObject(CBotVar* botThis, void* user)
{ {
CObject* object = static_cast<CObject*>(user);
CPhysics* physics; CPhysics* physics;
CBotVar *pVar, *pSub; CBotVar *pVar, *pSub;
ObjectType type; ObjectType type;
Math::Vector pos; Math::Vector pos;
float value; float value;
if ( object == 0 ) return; if ( user == nullptr ) return;
assert(static_cast<CObject*>(user)->Implements(ObjectInterfaceType::Old));
COldObject* object = static_cast<COldObject*>(user);
physics = object->GetPhysics(); physics = object->GetPhysics();
@ -162,8 +164,14 @@ void uObject(CBotVar* botThis, void* user)
if (object->Implements(ObjectInterfaceType::Powered)) if (object->Implements(ObjectInterfaceType::Powered))
{ {
CObject* power = dynamic_cast<CPoweredObject*>(object)->GetPower(); CObject* power = dynamic_cast<CPoweredObject*>(object)->GetPower();
if (power == nullptr) pVar->SetPointer(0); if (power == nullptr)
else pVar->SetPointer(power->GetBotVar()); {
pVar->SetPointer(nullptr);
}
else if (power->Implements(ObjectInterfaceType::Old))
{
pVar->SetPointer(dynamic_cast<COldObject*>(power)->GetBotVar());
}
} }
// Updates the transported object's type. // Updates the transported object's type.
@ -171,8 +179,14 @@ void uObject(CBotVar* botThis, void* user)
if (object->Implements(ObjectInterfaceType::Carrier)) if (object->Implements(ObjectInterfaceType::Carrier))
{ {
CObject* cargo = dynamic_cast<CCarrierObject*>(object)->GetCargo(); CObject* cargo = dynamic_cast<CCarrierObject*>(object)->GetCargo();
if (cargo == nullptr) pVar->SetPointer(0); if (cargo == nullptr)
else pVar->SetPointer(cargo->GetBotVar()); {
pVar->SetPointer(nullptr);
}
else if (cargo->Implements(ObjectInterfaceType::Old))
{
pVar->SetPointer(dynamic_cast<COldObject*>(cargo)->GetBotVar());
}
} }
pVar = pVar->GetNext(); // "id" pVar = pVar->GetNext(); // "id"
@ -902,6 +916,7 @@ void COldObject::Write(CLevelParserLine* line)
if ( !GetEnable() ) if ( !GetEnable() )
line->AddParam("enable", CLevelParserParamUPtr{new CLevelParserParam(GetEnable())}); line->AddParam("enable", CLevelParserParamUPtr{new CLevelParserParam(GetEnable())});
// TODO: doesn't seem to be used
if ( GetFixed() ) if ( GetFixed() )
line->AddParam("fixed", CLevelParserParamUPtr{new CLevelParserParam(GetFixed())}); line->AddParam("fixed", CLevelParserParamUPtr{new CLevelParserParam(GetFixed())});
@ -1509,11 +1524,6 @@ void COldObject::SetMasterParticle(int part, int parti)
m_objectPart[part].masterParti = parti; m_objectPart[part].masterParti = parti;
} }
int COldObject::GetMasterParticle(int part)
{
return m_objectPart[part].masterParti;
}
// Management of the stack transport. // Management of the stack transport.
@ -1614,21 +1624,6 @@ Math::Matrix* COldObject::GetWorldMatrix(int part)
} }
// Indicates whether the object should be drawn below the interface.
void COldObject::SetDrawWorld(bool bDraw)
{
int i;
for ( i=0 ; i<OBJECTMAXPART ; i++ )
{
if ( m_objectPart[i].bUsed )
{
m_engine->SetObjectDrawWorld(m_objectPart[i].object, bDraw);
}
}
}
// Indicates whether the object should be drawn over the interface. // Indicates whether the object should be drawn over the interface.
void COldObject::SetDrawFront(bool bDraw) void COldObject::SetDrawFront(bool bDraw)
@ -1740,30 +1735,6 @@ bool COldObject::CreateShadowCircle(float radius, float intensity,
return true; return true;
} }
// Reads a program.
bool COldObject::ReadProgram(Program* program, const char* filename)
{
if ( m_brain != nullptr )
{
return m_brain->ReadProgram(program, filename);
}
return false;
}
// Writes a program.
bool COldObject::WriteProgram(Program* program, const char* filename)
{
if ( m_brain != nullptr )
{
return m_brain->WriteProgram(program, filename);
}
return false;
}
// Calculates the matrix for transforming the object. // Calculates the matrix for transforming the object.
// Returns true if the matrix has changed. // Returns true if the matrix has changed.
// The rotations occur in the order Y, Z and X. // The rotations occur in the order Y, Z and X.
@ -2372,11 +2343,6 @@ void COldObject::SetViewFromHere(Math::Vector &eye, float &dirH, float &dirV,
// Management of features. // Management of features.
void COldObject::GetCharacter(Character* character)
{
memcpy(character, &m_character, sizeof(Character));
}
Character* COldObject::GetCharacter() Character* COldObject::GetCharacter()
{ {
return &m_character; return &m_character;
@ -2631,11 +2597,6 @@ bool COldObject::GetVirusMode()
return m_bVirusMode; return m_bVirusMode;
} }
float COldObject::GetVirusTime()
{
return m_virusTime;
}
// Management mode of the camera. // Management mode of the camera.
@ -2906,20 +2867,6 @@ bool COldObject::IsExploding()
return m_bExplo; return m_bExplo;
} }
// Mode management "cargo ship" during movies.
void COldObject::SetSpaceshipCargo(bool bCargo)
{
m_bCargo = bCargo;
}
bool COldObject::IsSpaceshipCargo()
{
return m_bCargo;
}
// Management of the HS mode of an object. // Management of the HS mode of an object.
void COldObject::SetBurn(bool bBurn) void COldObject::SetBurn(bool bBurn)

View File

@ -90,39 +90,35 @@ public:
bool ExplodeObject(ExplosionType type, float force, float decay=1.0f) override; bool ExplodeObject(ExplosionType type, float force, float decay=1.0f) override;
bool EventProcess(const Event& event) override; bool EventProcess(const Event& event) override;
void UpdateMapping() override; void UpdateMapping();
void DeletePart(int part) override; void DeletePart(int part) override;
void SetObjectRank(int part, int objRank) override; void SetObjectRank(int part, int objRank);
int GetObjectRank(int part) override; int GetObjectRank(int part) override;
void SetObjectParent(int part, int parent) override; void SetObjectParent(int part, int parent);
void SetType(ObjectType type) override; void SetType(ObjectType type) override;
const char* GetName() override; const char* GetName();
int GetOption() override; int GetOption() override;
void Write(CLevelParserLine* line) override; void Write(CLevelParserLine* line) override;
void Read(CLevelParserLine* line) override; void Read(CLevelParserLine* line) override;
void SetDrawWorld(bool bDraw) override;
void SetDrawFront(bool bDraw) override; void SetDrawFront(bool bDraw) override;
bool ReadProgram(Program* program, const char* filename) override; int GetShadowLight();
bool WriteProgram(Program* program, const char* filename) override; int GetEffectLight();
int GetShadowLight() override; void SetShieldRadius(float radius);
int GetEffectLight() override;
void SetShieldRadius(float radius) override;
float GetShieldRadius() override; float GetShieldRadius() override;
void SetFloorHeight(float height) override; void SetFloorHeight(float height);
void FloorAdjust() override; void FloorAdjust() override;
void SetLinVibration(Math::Vector dir) override; void SetLinVibration(Math::Vector dir) override;
Math::Vector GetLinVibration() override; Math::Vector GetLinVibration();
void SetCirVibration(Math::Vector dir) override; void SetCirVibration(Math::Vector dir) override;
Math::Vector GetCirVibration() override; Math::Vector GetCirVibration();
void SetTilt(Math::Vector dir) override; void SetTilt(Math::Vector dir);
Math::Vector GetTilt() override; Math::Vector GetTilt() override;
void SetPosition(int part, const Math::Vector &pos) override; void SetPosition(int part, const Math::Vector &pos) override;
@ -148,25 +144,24 @@ public:
void SetTrainer(bool bEnable) override; void SetTrainer(bool bEnable) override;
bool GetTrainer() override; bool GetTrainer() override;
void SetToy(bool bEnable) override; void SetToy(bool bEnable);
bool GetToy() override; bool GetToy();
void SetManual(bool bManual) override; void SetManual(bool bManual);
bool GetManual() override; bool GetManual();
void SetResetCap(ResetCap cap) override; void SetResetCap(ResetCap cap) override;
ResetCap GetResetCap() override; ResetCap GetResetCap() override;
void SetResetBusy(bool bBusy) override; void SetResetBusy(bool bBusy);
bool GetResetBusy() override; bool GetResetBusy();
void SetResetPosition(const Math::Vector &pos) override; void SetResetPosition(const Math::Vector &pos);
Math::Vector GetResetPosition() override; Math::Vector GetResetPosition() override;
void SetResetAngle(const Math::Vector &angle) override; void SetResetAngle(const Math::Vector &angle);
Math::Vector GetResetAngle() override; Math::Vector GetResetAngle() override;
void SetResetRun(Program* run) override; void SetResetRun(Program* run);
Program* GetResetRun() override; Program* GetResetRun() override;
void SetMasterParticle(int part, int parti) override; void SetMasterParticle(int part, int parti) override;
int GetMasterParticle(int part) override;
void SetPower(CObject* power) override; void SetPower(CObject* power) override;
CObject* GetPower() override; CObject* GetPower() override;
@ -176,20 +171,19 @@ public:
CObject* GetTransporter() override; CObject* GetTransporter() override;
void SetTransporterPart(int part) override; void SetTransporterPart(int part) override;
void SetCmdLine(unsigned int rank, float value) override; void SetCmdLine(unsigned int rank, float value);
float GetCmdLine(unsigned int rank) override; float GetCmdLine(unsigned int rank) override;
Math::Matrix* GetRotateMatrix(int part) override; Math::Matrix* GetRotateMatrix(int part);
Math::Matrix* GetWorldMatrix(int part) override; Math::Matrix* GetWorldMatrix(int part) override;
void SetViewFromHere(Math::Vector &eye, float &dirH, float &dirV, void SetViewFromHere(Math::Vector &eye, float &dirH, float &dirV,
Math::Vector &lookat, Math::Vector &upVec, Math::Vector &lookat, Math::Vector &upVec,
Gfx::CameraType type) override; Gfx::CameraType type) override;
void GetCharacter(Character* character) override;
Character* GetCharacter() override; Character* GetCharacter() override;
float GetAbsTime() override; float GetAbsTime();
void SetEnergy(float level) override; void SetEnergy(float level) override;
float GetEnergy() override; float GetEnergy() override;
@ -220,7 +214,6 @@ public:
void SetVirusMode(bool bEnable) override; void SetVirusMode(bool bEnable) override;
bool GetVirusMode() override; bool GetVirusMode() override;
float GetVirusTime() override;
void SetCameraType(Gfx::CameraType type) override; void SetCameraType(Gfx::CameraType type) override;
Gfx::CameraType GetCameraType() override; Gfx::CameraType GetCameraType() override;
@ -234,23 +227,23 @@ public:
void SetSelect(bool bMode, bool bDisplayError=true) override; void SetSelect(bool bMode, bool bDisplayError=true) override;
bool GetSelect(bool bReal=false) override; bool GetSelect(bool bReal=false) override;
void SetSelectable(bool bMode) override; void SetSelectable(bool bMode);
bool GetSelectable() override; bool GetSelectable() override;
void SetActivity(bool bMode) override; void SetActivity(bool bMode) override;
bool GetActivity() override; bool GetActivity() override;
void SetVisible(bool bVisible) override; void SetVisible(bool bVisible);
void SetEnable(bool bEnable) override; void SetEnable(bool bEnable) override;
bool GetEnable() override; bool GetEnable() override;
void SetCheckToken(bool bMode) override; void SetCheckToken(bool bMode);
bool GetCheckToken() override; bool GetCheckToken();
void SetProxyActivate(bool bActivate) override; void SetProxyActivate(bool bActivate) override;
bool GetProxyActivate() override; bool GetProxyActivate() override;
void SetProxyDistance(float distance) override; void SetProxyDistance(float distance);
void SetMagnifyDamage(float factor) override; void SetMagnifyDamage(float factor) override;
float GetMagnifyDamage() override; float GetMagnifyDamage() override;
@ -264,8 +257,6 @@ public:
bool IsExploding() override; bool IsExploding() override;
void SetLock(bool bLock) override; void SetLock(bool bLock) override;
bool GetLock() override; bool GetLock() override;
void SetSpaceshipCargo(bool bCargo) override;
bool IsSpaceshipCargo() override;
void SetBurn(bool bBurn) override; void SetBurn(bool bBurn) override;
bool GetBurn() override; bool GetBurn() override;
void SetDead(bool bDead) override; void SetDead(bool bDead) override;
@ -273,18 +264,18 @@ public:
bool GetRuin() override; bool GetRuin() override;
bool GetActive() override; bool GetActive() override;
void SetGunGoalV(float gunGoal) override; void SetGunGoalV(float gunGoal);
void SetGunGoalH(float gunGoal) override; void SetGunGoalH(float gunGoal);
float GetGunGoalV() override; float GetGunGoalV();
float GetGunGoalH() override; float GetGunGoalH();
bool StartShowLimit() override; bool StartShowLimit() override;
void StopShowLimit() override; void StopShowLimit() override;
bool IsProgram() override; bool IsProgram() override;
void CreateSelectParticle() override; void CreateSelectParticle();
void SetRunScript(CScript* script) override; void SetRunScript(CScript* script);
CScript* GetRunScript() override; CScript* GetRunScript() override;
CBotVar* GetBotVar() override; CBotVar* GetBotVar() override;
CPhysics* GetPhysics() override; CPhysics* GetPhysics() override;
@ -301,13 +292,13 @@ public:
CObject* SubDeselList() override; CObject* SubDeselList() override;
void DeleteDeselList(CObject* pObj) override; void DeleteDeselList(CObject* pObj) override;
bool CreateShadowCircle(float radius, float intensity, Gfx::EngineShadowType type = Gfx::ENG_SHADOW_NORM) override; bool CreateShadowCircle(float radius, float intensity, Gfx::EngineShadowType type = Gfx::ENG_SHADOW_NORM);
bool CreateShadowLight(float height, Gfx::Color color) override; bool CreateShadowLight(float height, Gfx::Color color);
bool CreateEffectLight(float height, Gfx::Color color) override; bool CreateEffectLight(float height, Gfx::Color color);
void FlatParent() override; void FlatParent() override;
void SetInfoReturn(float value) override; void SetInfoReturn(float value);
float GetInfoReturn() override; float GetInfoReturn() override;
Math::Vector GetPosition() const override; Math::Vector GetPosition() const override;

View File

@ -30,97 +30,37 @@ bool COldObjectInterface::ExplodeObject(ExplosionType type, float force, float d
throw std::logic_error("ExplodeObject: not implemented!"); throw std::logic_error("ExplodeObject: not implemented!");
} }
void COldObjectInterface::UpdateMapping()
{
throw std::logic_error("UpdateMapping: not implemented!");
}
void COldObjectInterface::DeletePart(int part) void COldObjectInterface::DeletePart(int part)
{ {
throw std::logic_error("DeletePart: not implemented!"); throw std::logic_error("DeletePart: not implemented!");
} }
void COldObjectInterface::SetObjectRank(int part, int objRank)
{
throw std::logic_error("SetObjectRank: not implemented!");
}
int COldObjectInterface::GetObjectRank(int part) int COldObjectInterface::GetObjectRank(int part)
{ {
throw std::logic_error("GetObjectRank: not implemented!"); throw std::logic_error("GetObjectRank: not implemented!");
} }
void COldObjectInterface::SetObjectParent(int part, int parent)
{
throw std::logic_error("SetObjectParent: not implemented!");
}
void COldObjectInterface::SetType(ObjectType type) void COldObjectInterface::SetType(ObjectType type)
{ {
throw std::logic_error("SetType: not implemented!"); throw std::logic_error("SetType: not implemented!");
} }
const char* COldObjectInterface::GetName()
{
throw std::logic_error("GetName: not implemented!");
}
int COldObjectInterface::GetOption() int COldObjectInterface::GetOption()
{ {
throw std::logic_error("GetOption: not implemented!"); throw std::logic_error("GetOption: not implemented!");
} }
void COldObjectInterface::SetDrawWorld(bool bDraw)
{
throw std::logic_error("SetDrawWorld: not implemented!");
}
void COldObjectInterface::SetDrawFront(bool bDraw) void COldObjectInterface::SetDrawFront(bool bDraw)
{ {
throw std::logic_error("SetDrawFront: not implemented!"); throw std::logic_error("SetDrawFront: not implemented!");
} }
bool COldObjectInterface::ReadProgram(Program* program, const char* filename)
{
throw std::logic_error("ReadProgram: not implemented!");
}
bool COldObjectInterface::WriteProgram(Program* program, const char* filename)
{
throw std::logic_error("WriteProgram: not implemented!");
}
int COldObjectInterface::GetShadowLight()
{
throw std::logic_error("GetShadowLight: not implemented!");
}
int COldObjectInterface::GetEffectLight()
{
throw std::logic_error("GetEffectLight: not implemented!");
}
void COldObjectInterface::SetShieldRadius(float radius)
{
throw std::logic_error("SetShieldRadius: not implemented!");
}
float COldObjectInterface::GetShieldRadius() float COldObjectInterface::GetShieldRadius()
{ {
throw std::logic_error("GetShieldRadius: not implemented!"); throw std::logic_error("GetShieldRadius: not implemented!");
} }
void COldObjectInterface::SetFloorHeight(float height)
{
throw std::logic_error("SetFloorHeight: not implemented!");
}
void COldObjectInterface::FloorAdjust() void COldObjectInterface::FloorAdjust()
{ {
throw std::logic_error("FloorAdjust: not implemented!"); throw std::logic_error("FloorAdjust: not implemented!");
@ -132,32 +72,15 @@ void COldObjectInterface::SetLinVibration(Math::Vector dir)
throw std::logic_error("SetLinVibration: not implemented!"); throw std::logic_error("SetLinVibration: not implemented!");
} }
Math::Vector COldObjectInterface::GetLinVibration()
{
throw std::logic_error("GetLinVibration: not implemented!");
}
void COldObjectInterface::SetCirVibration(Math::Vector dir) void COldObjectInterface::SetCirVibration(Math::Vector dir)
{ {
throw std::logic_error("SetCirVibration: not implemented!"); throw std::logic_error("SetCirVibration: not implemented!");
} }
Math::Vector COldObjectInterface::GetCirVibration()
{
throw std::logic_error("GetCirVibration: not implemented!");
}
void COldObjectInterface::SetTilt(Math::Vector dir)
{
throw std::logic_error("SetTilt: not implemented!");
}
Math::Vector COldObjectInterface::GetTilt() Math::Vector COldObjectInterface::GetTilt()
{ {
throw std::logic_error("GetTilt: not implemented!"); throw std::logic_error("GetTilt: not implemented!");
} }
void COldObjectInterface::SetPosition(int part, const Math::Vector &pos) void COldObjectInterface::SetPosition(int part, const Math::Vector &pos)
{ {
throw std::logic_error("SetPosition: not implemented!"); throw std::logic_error("SetPosition: not implemented!");
@ -264,29 +187,6 @@ bool COldObjectInterface::GetTrainer()
throw std::logic_error("GetTrainer: not implemented!"); throw std::logic_error("GetTrainer: not implemented!");
} }
void COldObjectInterface::SetToy(bool bEnable)
{
throw std::logic_error("SetToy: not implemented!");
}
bool COldObjectInterface::GetToy()
{
throw std::logic_error("GetToy: not implemented!");
}
void COldObjectInterface::SetManual(bool bManual)
{
throw std::logic_error("SetManual: not implemented!");
}
bool COldObjectInterface::GetManual()
{
throw std::logic_error("GetManual: not implemented!");
}
void COldObjectInterface::SetResetCap(ResetCap cap) void COldObjectInterface::SetResetCap(ResetCap cap)
{ {
throw std::logic_error("SetResetCap: not implemented!"); throw std::logic_error("SetResetCap: not implemented!");
@ -297,73 +197,31 @@ ResetCap COldObjectInterface::GetResetCap()
throw std::logic_error("GetResetCap: not implemented!"); throw std::logic_error("GetResetCap: not implemented!");
} }
void COldObjectInterface::SetResetBusy(bool bBusy)
{
throw std::logic_error("SetResetBusy: not implemented!");
}
bool COldObjectInterface::GetResetBusy()
{
throw std::logic_error("GetResetBusy: not implemented!");
}
void COldObjectInterface::SetResetPosition(const Math::Vector &pos)
{
throw std::logic_error("SetResetPosition: not implemented!");
}
Math::Vector COldObjectInterface::GetResetPosition() Math::Vector COldObjectInterface::GetResetPosition()
{ {
throw std::logic_error("GetResetPosition: not implemented!"); throw std::logic_error("GetResetPosition: not implemented!");
} }
void COldObjectInterface::SetResetAngle(const Math::Vector &angle)
{
throw std::logic_error("SetResetAngle: not implemented!");
}
Math::Vector COldObjectInterface::GetResetAngle() Math::Vector COldObjectInterface::GetResetAngle()
{ {
throw std::logic_error("GetResetAngle: not implemented!"); throw std::logic_error("GetResetAngle: not implemented!");
} }
void COldObjectInterface::SetResetRun(Program* run)
{
throw std::logic_error("SetResetRun: not implemented!");
}
Program* COldObjectInterface::GetResetRun() Program* COldObjectInterface::GetResetRun()
{ {
throw std::logic_error("GetResetRun: not implemented!"); throw std::logic_error("GetResetRun: not implemented!");
} }
void COldObjectInterface::SetMasterParticle(int part, int parti) void COldObjectInterface::SetMasterParticle(int part, int parti)
{ {
throw std::logic_error("SetMasterParticle: not implemented!"); throw std::logic_error("SetMasterParticle: not implemented!");
} }
int COldObjectInterface::GetMasterParticle(int part)
{
throw std::logic_error("GetMasterParticle: not implemented!");
}
void COldObjectInterface::SetCmdLine(unsigned int rank, float value)
{
throw std::logic_error("SetCmdLine: not implemented!");
}
float COldObjectInterface::GetCmdLine(unsigned int rank) float COldObjectInterface::GetCmdLine(unsigned int rank)
{ {
throw std::logic_error("GetCmdLine: not implemented!"); throw std::logic_error("GetCmdLine: not implemented!");
} }
Math::Matrix* COldObjectInterface::GetRotateMatrix(int part)
{
throw std::logic_error("GetRotateMatrix: not implemented!");
}
Math::Matrix* COldObjectInterface::GetWorldMatrix(int part) Math::Matrix* COldObjectInterface::GetWorldMatrix(int part)
{ {
throw std::logic_error("GetWorldMatrix: not implemented!"); throw std::logic_error("GetWorldMatrix: not implemented!");
@ -376,23 +234,11 @@ void COldObjectInterface::SetViewFromHere(Math::Vector &eye, float &dirH, float
throw std::logic_error("SetViewFromHere: not implemented!"); throw std::logic_error("SetViewFromHere: not implemented!");
} }
void COldObjectInterface::GetCharacter(Character* character)
{
throw std::logic_error("GetCharacter: not implemented!");
}
Character* COldObjectInterface::GetCharacter() Character* COldObjectInterface::GetCharacter()
{ {
throw std::logic_error("GetCharacter: not implemented!"); throw std::logic_error("GetCharacter: not implemented!");
} }
float COldObjectInterface::GetAbsTime()
{
throw std::logic_error("GetAbsTime: not implemented!");
}
void COldObjectInterface::SetEnergy(float level) void COldObjectInterface::SetEnergy(float level)
{ {
throw std::logic_error("SetEnergy: not implemented!"); throw std::logic_error("SetEnergy: not implemented!");
@ -409,7 +255,6 @@ float COldObjectInterface::GetCapacity()
throw std::logic_error("GetCapacity: not implemented!"); throw std::logic_error("GetCapacity: not implemented!");
} }
void COldObjectInterface::SetShield(float level) void COldObjectInterface::SetShield(float level)
{ {
throw std::logic_error("SetShield: not implemented!"); throw std::logic_error("SetShield: not implemented!");
@ -451,8 +296,6 @@ bool COldObjectInterface::GetClip()
{ {
throw std::logic_error("GetClip: not implemented!"); throw std::logic_error("GetClip: not implemented!");
} }
void COldObjectInterface::SetTeam(int team) void COldObjectInterface::SetTeam(int team)
{ {
throw std::logic_error("SetTeam: not implemented!"); throw std::logic_error("SetTeam: not implemented!");
@ -463,13 +306,11 @@ int COldObjectInterface::GetTeam()
throw std::logic_error("GetTeam: not implemented!"); throw std::logic_error("GetTeam: not implemented!");
} }
void COldObjectInterface::StartDetectEffect(CObject *target, bool bFound) void COldObjectInterface::StartDetectEffect(CObject *target, bool bFound)
{ {
throw std::logic_error("StartDetectEffect: not implemented!"); throw std::logic_error("StartDetectEffect: not implemented!");
} }
void COldObjectInterface::SetVirusMode(bool bEnable) void COldObjectInterface::SetVirusMode(bool bEnable)
{ {
throw std::logic_error("SetVirusMode: not implemented!"); throw std::logic_error("SetVirusMode: not implemented!");
@ -480,12 +321,6 @@ bool COldObjectInterface::GetVirusMode()
throw std::logic_error("GetVirusMode: not implemented!"); throw std::logic_error("GetVirusMode: not implemented!");
} }
float COldObjectInterface::GetVirusTime()
{
throw std::logic_error("GetVirusTime: not implemented!");
}
void COldObjectInterface::SetCameraType(Gfx::CameraType type) void COldObjectInterface::SetCameraType(Gfx::CameraType type)
{ {
throw std::logic_error("SetCameraType: not implemented!"); throw std::logic_error("SetCameraType: not implemented!");
@ -538,18 +373,11 @@ bool COldObjectInterface::GetSelect(bool bReal)
//throw std::logic_error("GetSelect: not implemented!"); //throw std::logic_error("GetSelect: not implemented!");
} }
void COldObjectInterface::SetSelectable(bool bMode)
{
throw std::logic_error("SetSelectable: not implemented!");
}
bool COldObjectInterface::GetSelectable() bool COldObjectInterface::GetSelectable()
{ {
throw std::logic_error("GetSelectable: not implemented!"); throw std::logic_error("GetSelectable: not implemented!");
} }
void COldObjectInterface::SetActivity(bool bMode) void COldObjectInterface::SetActivity(bool bMode)
{ {
throw std::logic_error("SetActivity: not implemented!"); throw std::logic_error("SetActivity: not implemented!");
@ -561,12 +389,6 @@ bool COldObjectInterface::GetActivity()
} }
void COldObjectInterface::SetVisible(bool bVisible)
{
throw std::logic_error("SetVisible: not implemented!");
}
void COldObjectInterface::SetEnable(bool bEnable) void COldObjectInterface::SetEnable(bool bEnable)
{ {
throw std::logic_error("SetEnable: not implemented!"); throw std::logic_error("SetEnable: not implemented!");
@ -580,17 +402,6 @@ bool COldObjectInterface::GetEnable()
} }
void COldObjectInterface::SetCheckToken(bool bMode)
{
throw std::logic_error("SetCheckToken: not implemented!");
}
bool COldObjectInterface::GetCheckToken()
{
throw std::logic_error("GetCheckToken: not implemented!");
}
void COldObjectInterface::SetProxyActivate(bool bActivate) void COldObjectInterface::SetProxyActivate(bool bActivate)
{ {
throw std::logic_error("SetProxyActivate: not implemented!"); throw std::logic_error("SetProxyActivate: not implemented!");
@ -601,11 +412,6 @@ bool COldObjectInterface::GetProxyActivate()
throw std::logic_error("GetProxyActivate: not implemented!"); throw std::logic_error("GetProxyActivate: not implemented!");
} }
void COldObjectInterface::SetProxyDistance(float distance)
{
throw std::logic_error("SetProxyDistance: not implemented!");
}
void COldObjectInterface::SetMagnifyDamage(float factor) void COldObjectInterface::SetMagnifyDamage(float factor)
{ {
@ -627,7 +433,6 @@ float COldObjectInterface::GetParam()
{ {
throw std::logic_error("GetParam: not implemented!"); throw std::logic_error("GetParam: not implemented!");
} }
void COldObjectInterface::SetIgnoreBuildCheck(bool bIgnoreBuildCheck) void COldObjectInterface::SetIgnoreBuildCheck(bool bIgnoreBuildCheck)
{ {
throw std::logic_error("SetIgnoreBuildCheck: not implemented!"); throw std::logic_error("SetIgnoreBuildCheck: not implemented!");
@ -663,20 +468,6 @@ bool COldObjectInterface::GetLock()
//throw std::logic_error("GetLock: not implemented!"); //throw std::logic_error("GetLock: not implemented!");
} }
void COldObjectInterface::SetSpaceshipCargo(bool bCargo)
{
// TODO: temporary hack
return;
//throw std::logic_error("SetSpaceshipCargo: not implemented!");
}
bool COldObjectInterface::IsSpaceshipCargo()
{
// TODO: temporary hack
return false;
//throw std::logic_error("IsSpaceshipCargo: not implemented!");
}
void COldObjectInterface::SetBurn(bool bBurn) void COldObjectInterface::SetBurn(bool bBurn)
{ {
throw std::logic_error("SetBurn: not implemented!"); throw std::logic_error("SetBurn: not implemented!");
@ -715,28 +506,6 @@ bool COldObjectInterface::GetActive()
//throw std::logic_error("GetActive: not implemented!"); //throw std::logic_error("GetActive: not implemented!");
} }
void COldObjectInterface::SetGunGoalV(float gunGoal)
{
throw std::logic_error("SetGunGoalV: not implemented!");
}
void COldObjectInterface::SetGunGoalH(float gunGoal)
{
throw std::logic_error("SetGunGoalH: not implemented!");
}
float COldObjectInterface::GetGunGoalV()
{
throw std::logic_error("GetGunGoalV: not implemented!");
}
float COldObjectInterface::GetGunGoalH()
{
throw std::logic_error("GetGunGoalH: not implemented!");
}
bool COldObjectInterface::StartShowLimit() bool COldObjectInterface::StartShowLimit()
{ {
throw std::logic_error("StartShowLimit: not implemented!"); throw std::logic_error("StartShowLimit: not implemented!");
@ -753,17 +522,6 @@ bool COldObjectInterface::IsProgram()
throw std::logic_error("IsProgram: not implemented!"); throw std::logic_error("IsProgram: not implemented!");
} }
void COldObjectInterface::CreateSelectParticle()
{
throw std::logic_error("CreateSelectParticle: not implemented!");
}
void COldObjectInterface::SetRunScript(CScript* script)
{
throw std::logic_error("SetRunScript: not implemented!");
}
CScript* COldObjectInterface::GetRunScript() CScript* COldObjectInterface::GetRunScript()
{ {
throw std::logic_error("GetRunScript: not implemented!"); throw std::logic_error("GetRunScript: not implemented!");
@ -773,7 +531,6 @@ CBotVar* COldObjectInterface::GetBotVar()
{ {
throw std::logic_error("GetBotVar: not implemented!"); throw std::logic_error("GetBotVar: not implemented!");
} }
CPhysics* COldObjectInterface::GetPhysics() CPhysics* COldObjectInterface::GetPhysics()
{ {
throw std::logic_error("GetPhysics: not implemented!"); throw std::logic_error("GetPhysics: not implemented!");
@ -824,36 +581,12 @@ void COldObjectInterface::DeleteDeselList(CObject* pObj)
//throw std::logic_error("DeleteDeselList: not implemented!"); //throw std::logic_error("DeleteDeselList: not implemented!");
} }
bool COldObjectInterface::CreateShadowCircle(float radius, float intensity, Gfx::EngineShadowType type)
{
throw std::logic_error("CreateShadowCircle: not implemented!");
}
bool COldObjectInterface::CreateShadowLight(float height, Gfx::Color color)
{
throw std::logic_error("CreateShadowLight: not implemented!");
}
bool COldObjectInterface::CreateEffectLight(float height, Gfx::Color color)
{
throw std::logic_error("CreateEffectLight: not implemented!");
}
void COldObjectInterface::FlatParent() void COldObjectInterface::FlatParent()
{ {
throw std::logic_error("FlatParent: not implemented!"); throw std::logic_error("FlatParent: not implemented!");
} }
void COldObjectInterface::SetInfoReturn(float value)
{
throw std::logic_error("SetInfoReturn: not implemented!");
}
float COldObjectInterface::GetInfoReturn() float COldObjectInterface::GetInfoReturn()
{ {
throw std::logic_error("GetInfoReturn: not implemented!"); throw std::logic_error("GetInfoReturn: not implemented!");
} }

View File

@ -78,37 +78,22 @@ public:
virtual void Simplify(); virtual void Simplify();
virtual bool ExplodeObject(ExplosionType type, float force, float decay=1.0f); virtual bool ExplodeObject(ExplosionType type, float force, float decay=1.0f);
virtual void UpdateMapping();
virtual void DeletePart(int part); virtual void DeletePart(int part);
virtual void SetObjectRank(int part, int objRank);
virtual int GetObjectRank(int part);
virtual void SetObjectParent(int part, int parent);
virtual void SetType(ObjectType type); virtual void SetType(ObjectType type);
virtual const char* GetName();
virtual int GetObjectRank(int part);
virtual int GetOption(); virtual int GetOption();
virtual void SetDrawWorld(bool bDraw);
virtual void SetDrawFront(bool bDraw); virtual void SetDrawFront(bool bDraw);
virtual bool ReadProgram(Program* program, const char* filename);
virtual bool WriteProgram(Program* program, const char* filename);
virtual int GetShadowLight();
virtual int GetEffectLight();
virtual void SetShieldRadius(float radius);
virtual float GetShieldRadius(); virtual float GetShieldRadius();
virtual void SetFloorHeight(float height);
virtual void FloorAdjust(); virtual void FloorAdjust();
virtual void SetLinVibration(Math::Vector dir); virtual void SetLinVibration(Math::Vector dir);
virtual Math::Vector GetLinVibration();
virtual void SetCirVibration(Math::Vector dir); virtual void SetCirVibration(Math::Vector dir);
virtual Math::Vector GetCirVibration();
virtual void SetTilt(Math::Vector dir);
virtual Math::Vector GetTilt(); virtual Math::Vector GetTilt();
virtual void SetPosition(int part, const Math::Vector &pos); virtual void SetPosition(int part, const Math::Vector &pos);
@ -134,44 +119,26 @@ public:
virtual void SetTrainer(bool bEnable); virtual void SetTrainer(bool bEnable);
virtual bool GetTrainer(); virtual bool GetTrainer();
virtual void SetToy(bool bEnable);
virtual bool GetToy();
virtual void SetManual(bool bManual);
virtual bool GetManual();
virtual void SetResetCap(ResetCap cap);
virtual ResetCap GetResetCap(); virtual ResetCap GetResetCap();
virtual void SetResetBusy(bool bBusy); virtual void SetResetCap(ResetCap resetCap);
virtual bool GetResetBusy();
virtual void SetResetPosition(const Math::Vector &pos);
virtual Math::Vector GetResetPosition(); virtual Math::Vector GetResetPosition();
virtual void SetResetAngle(const Math::Vector &angle);
virtual Math::Vector GetResetAngle(); virtual Math::Vector GetResetAngle();
virtual void SetResetRun(Program* run);
virtual Program* GetResetRun(); virtual Program* GetResetRun();
virtual void SetMasterParticle(int part, int parti); virtual void SetMasterParticle(int part, int parti);
virtual int GetMasterParticle(int part);
virtual void SetCmdLine(unsigned int rank, float value);
virtual float GetCmdLine(unsigned int rank); virtual float GetCmdLine(unsigned int rank);
virtual Math::Matrix* GetRotateMatrix(int part);
virtual Math::Matrix* GetWorldMatrix(int part); virtual Math::Matrix* GetWorldMatrix(int part);
virtual void SetViewFromHere(Math::Vector &eye, float &dirH, float &dirV, virtual void SetViewFromHere(Math::Vector &eye, float &dirH, float &dirV,
Math::Vector &lookat, Math::Vector &upVec, Math::Vector &lookat, Math::Vector &upVec,
Gfx::CameraType type); Gfx::CameraType type);
virtual void GetCharacter(Character* character);
virtual Character* GetCharacter(); virtual Character* GetCharacter();
virtual float GetAbsTime();
virtual void SetEnergy(float level); virtual void SetEnergy(float level);
virtual float GetEnergy(); virtual float GetEnergy();
virtual float GetCapacity(); virtual float GetCapacity();
virtual void SetShield(float level); virtual void SetShield(float level);
@ -185,7 +152,6 @@ public:
virtual void SetClip(bool bClip); virtual void SetClip(bool bClip);
virtual bool GetClip(); virtual bool GetClip();
virtual void SetTeam(int team); virtual void SetTeam(int team);
virtual int GetTeam(); virtual int GetTeam();
@ -193,7 +159,6 @@ public:
virtual void SetVirusMode(bool bEnable); virtual void SetVirusMode(bool bEnable);
virtual bool GetVirusMode(); virtual bool GetVirusMode();
virtual float GetVirusTime();
virtual void SetCameraType(Gfx::CameraType type); virtual void SetCameraType(Gfx::CameraType type);
virtual Gfx::CameraType GetCameraType(); virtual Gfx::CameraType GetCameraType();
@ -206,24 +171,16 @@ public:
virtual void SetSelect(bool bMode, bool bDisplayError=true); virtual void SetSelect(bool bMode, bool bDisplayError=true);
virtual bool GetSelect(bool bReal=false); virtual bool GetSelect(bool bReal=false);
virtual void SetSelectable(bool bMode);
virtual bool GetSelectable(); virtual bool GetSelectable();
virtual void SetActivity(bool bMode); virtual void SetActivity(bool bMode);
virtual bool GetActivity(); virtual bool GetActivity();
virtual void SetVisible(bool bVisible);
virtual void SetEnable(bool bEnable); virtual void SetEnable(bool bEnable);
virtual bool GetEnable(); virtual bool GetEnable();
virtual void SetCheckToken(bool bMode);
virtual bool GetCheckToken();
virtual void SetProxyActivate(bool bActivate); virtual void SetProxyActivate(bool bActivate);
virtual bool GetProxyActivate(); virtual bool GetProxyActivate();
virtual void SetProxyDistance(float distance);
virtual void SetMagnifyDamage(float factor); virtual void SetMagnifyDamage(float factor);
virtual float GetMagnifyDamage(); virtual float GetMagnifyDamage();
@ -235,29 +192,25 @@ public:
virtual void SetExploding(bool bExplo); virtual void SetExploding(bool bExplo);
virtual bool IsExploding(); virtual bool IsExploding();
virtual void SetLock(bool bLock); virtual void SetLock(bool bLock);
virtual bool GetLock(); virtual bool GetLock();
virtual void SetSpaceshipCargo(bool bCargo);
virtual bool IsSpaceshipCargo();
virtual void SetBurn(bool bBurn); virtual void SetBurn(bool bBurn);
virtual bool GetBurn(); virtual bool GetBurn();
virtual void SetDead(bool bDead); virtual void SetDead(bool bDead);
virtual bool GetDead(); virtual bool GetDead();
virtual bool GetRuin();
virtual bool GetActive();
virtual void SetGunGoalV(float gunGoal); virtual bool GetRuin();
virtual void SetGunGoalH(float gunGoal);
virtual float GetGunGoalV(); virtual bool GetActive();
virtual float GetGunGoalH();
virtual bool StartShowLimit(); virtual bool StartShowLimit();
virtual void StopShowLimit(); virtual void StopShowLimit();
virtual bool IsProgram(); virtual bool IsProgram();
virtual void CreateSelectParticle();
virtual void SetRunScript(CScript* script);
virtual CScript* GetRunScript(); virtual CScript* GetRunScript();
virtual CBotVar* GetBotVar(); virtual CBotVar* GetBotVar();
virtual CPhysics* GetPhysics(); virtual CPhysics* GetPhysics();
@ -273,13 +226,8 @@ public:
virtual CObject* SubDeselList(); virtual CObject* SubDeselList();
virtual void DeleteDeselList(CObject* pObj); virtual void DeleteDeselList(CObject* pObj);
virtual bool CreateShadowCircle(float radius, float intensity, Gfx::EngineShadowType type = Gfx::ENG_SHADOW_NORM);
virtual bool CreateShadowLight(float height, Gfx::Color color);
virtual bool CreateEffectLight(float height, Gfx::Color color);
virtual void FlatParent(); virtual void FlatParent();
virtual void SetInfoReturn(float value);
virtual float GetInfoReturn(); virtual float GetInfoReturn();
}; };

View File

@ -1275,6 +1275,7 @@ void CRobotMain::ExecuteCmd(char *cmd)
} }
object->SetShield(1.0f); object->SetShield(1.0f);
CPhysics* physics = object->GetPhysics(); CPhysics* physics = object->GetPhysics();
if (physics != nullptr) if (physics != nullptr)
physics->SetReactorRange(1.0f); physics->SetReactorRange(1.0f);
@ -3543,33 +3544,35 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
if (obj->Implements(ObjectInterfaceType::Old)) // TODO: temporary hack if (obj->Implements(ObjectInterfaceType::Old)) // TODO: temporary hack
{ {
obj->SetDefRank(rankObj); // TODO: do we really need this? COldObject* oldObj = dynamic_cast<COldObject*>(obj);
oldObj->SetDefRank(rankObj); // TODO: do we really need this?
if (type == OBJECT_BASE) if (type == OBJECT_BASE)
m_base = obj; m_base = oldObj;
if (line->GetParam("select")->AsBool(false)) if (line->GetParam("select")->AsBool(false))
sel = obj; sel = oldObj;
// TODO: everything below should go to CObject::Read() function // TODO: everything below should go to CObject::Read() function
// In fact, we could give CLevelParserLine as parameter to CreateObject() in the first place // In fact, we could give CLevelParserLine as parameter to CreateObject() in the first place
Gfx::CameraType cType = line->GetParam("camera")->AsCameraType(Gfx::CAM_TYPE_NULL); Gfx::CameraType cType = line->GetParam("camera")->AsCameraType(Gfx::CAM_TYPE_NULL);
if (cType != Gfx::CAM_TYPE_NULL) if (cType != Gfx::CAM_TYPE_NULL)
obj->SetCameraType(cType); oldObj->SetCameraType(cType);
obj->SetCameraDist(line->GetParam("cameraDist")->AsFloat(50.0f)); oldObj->SetCameraDist(line->GetParam("cameraDist")->AsFloat(50.0f));
obj->SetCameraLock(line->GetParam("cameraLock")->AsBool(false)); oldObj->SetCameraLock(line->GetParam("cameraLock")->AsBool(false));
Gfx::PyroType pType = line->GetParam("pyro")->AsPyroType(Gfx::PT_NULL); Gfx::PyroType pType = line->GetParam("pyro")->AsPyroType(Gfx::PT_NULL);
if (pType != Gfx::PT_NULL) if (pType != Gfx::PT_NULL)
{ {
m_engine->GetPyroManager()->Create(pType, obj); m_engine->GetPyroManager()->Create(pType, oldObj);
} }
if (type == OBJECT_INFO) if (type == OBJECT_INFO)
{ {
CExchangePost* exchangePost = static_cast<CExchangePost*>(obj); CExchangePost* exchangePost = static_cast<CExchangePost*>(oldObj);
exchangePost->ReadInfo(line.get()); exchangePost->ReadInfo(line.get());
} }
@ -3579,36 +3582,36 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
const auto& cmdline = line->GetParam("cmdline")->AsArray(); const auto& cmdline = line->GetParam("cmdline")->AsArray();
for (unsigned int i = 0; i < cmdline.size(); i++) for (unsigned int i = 0; i < cmdline.size(); i++)
{ {
obj->SetCmdLine(i, cmdline[i]->AsFloat()); oldObj->SetCmdLine(i, cmdline[i]->AsFloat());
} }
} }
bool selectable = line->GetParam("selectable")->AsBool(true); bool selectable = line->GetParam("selectable")->AsBool(true);
obj->SetSelectable(selectable); oldObj->SetSelectable(selectable);
obj->SetIgnoreBuildCheck(line->GetParam("ignoreBuildCheck")->AsBool(false)); oldObj->SetIgnoreBuildCheck(line->GetParam("ignoreBuildCheck")->AsBool(false));
obj->SetEnable(line->GetParam("enable")->AsBool(true)); oldObj->SetEnable(line->GetParam("enable")->AsBool(true));
obj->SetProxyActivate(line->GetParam("proxyActivate")->AsBool(false)); oldObj->SetProxyActivate(line->GetParam("proxyActivate")->AsBool(false));
obj->SetProxyDistance(line->GetParam("proxyDistance")->AsFloat(15.0f)*g_unit); oldObj->SetProxyDistance(line->GetParam("proxyDistance")->AsFloat(15.0f)*g_unit);
obj->SetRange(line->GetParam("range")->AsFloat(30.0f)); oldObj->SetRange(line->GetParam("range")->AsFloat(30.0f));
obj->SetShield(line->GetParam("shield")->AsFloat(1.0f)); oldObj->SetShield(line->GetParam("shield")->AsFloat(1.0f));
obj->SetMagnifyDamage(line->GetParam("magnifyDamage")->AsFloat(1.0f)); oldObj->SetMagnifyDamage(line->GetParam("magnifyDamage")->AsFloat(1.0f));
obj->SetTeam(line->GetParam("team")->AsInt(0)); oldObj->SetTeam(line->GetParam("team")->AsInt(0));
obj->SetClip(line->GetParam("clip")->AsBool(true)); oldObj->SetClip(line->GetParam("clip")->AsBool(true));
obj->SetCheckToken(!line->GetParam("checkToken")->IsDefined() ? trainer || !selectable : line->GetParam("checkToken")->AsBool(true)); oldObj->SetCheckToken(!line->GetParam("checkToken")->IsDefined() ? trainer || !selectable : line->GetParam("checkToken")->AsBool(true));
// SetManual will affect bot speed // SetManual will affect bot speed
if (type == OBJECT_MOBILEdr) if (type == OBJECT_MOBILEdr)
{ {
obj->SetManual(!trainer); oldObj->SetManual(!trainer);
} }
Math::Vector zoom = line->GetParam("zoom")->AsPoint(Math::Vector(0.0f, 0.0f, 0.0f)); Math::Vector zoom = line->GetParam("zoom")->AsPoint(Math::Vector(0.0f, 0.0f, 0.0f));
if (zoom.x != 0.0f || zoom.y != 0.0f || zoom.z != 0.0f) if (zoom.x != 0.0f || zoom.y != 0.0f || zoom.z != 0.0f)
obj->SetZoom(0, zoom); oldObj->SetZoom(0, zoom);
// only used in AlienWorm lines // only used in AlienWorm lines
if (type == OBJECT_WORM) if (type == OBJECT_WORM)
{ {
CMotion* motion = obj->GetMotion(); CMotion* motion = oldObj->GetMotion();
if (motion != nullptr && line->GetParam("param")->IsDefined()) if (motion != nullptr && line->GetParam("param")->IsDefined())
{ {
const auto& p = line->GetParam("param")->AsArray(); const auto& p = line->GetParam("param")->AsArray();
@ -3621,9 +3624,9 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
int run = -1; int run = -1;
std::map<int, Program*> loadedPrograms; std::map<int, Program*> loadedPrograms;
if (obj->Implements(ObjectInterfaceType::Programmable)) if (oldObj->Implements(ObjectInterfaceType::Programmable))
{ {
CBrain* brain = dynamic_cast<CProgrammableObject*>(obj)->GetBrain(); CBrain* brain = dynamic_cast<CProgrammableObject*>(oldObj)->GetBrain();
bool allFilled = true; bool allFilled = true;
for (int i = 0; i < 10 || allFilled; i++) for (int i = 0; i < 10 || allFilled; i++)
@ -3652,7 +3655,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
brain->SetScriptRun(loadedPrograms[run]); brain->SetScriptRun(loadedPrograms[run]);
} }
} }
CAuto* automat = obj->GetAuto(); CAuto* automat = oldObj->GetAuto();
if (automat != nullptr) if (automat != nullptr)
{ {
type = line->GetParam("autoType")->AsObjectType(OBJECT_NULL); type = line->GetParam("autoType")->AsObjectType(OBJECT_NULL);
@ -3673,15 +3676,15 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
} }
} }
if (soluce && obj->Implements(ObjectInterfaceType::Programmable) && line->GetParam("soluce")->IsDefined()) if (soluce && oldObj->Implements(ObjectInterfaceType::Programmable) && line->GetParam("soluce")->IsDefined())
dynamic_cast<CProgrammableObject*>(obj)->GetBrain() dynamic_cast<CProgrammableObject*>(oldObj)->GetBrain()
->SetSoluceName(const_cast<char*>(line->GetParam("soluce")->AsPath("ai").c_str())); ->SetSoluceName(const_cast<char*>(line->GetParam("soluce")->AsPath("ai").c_str()));
obj->SetResetPosition(obj->GetPosition()); oldObj->SetResetPosition(oldObj->GetPosition());
obj->SetResetAngle(obj->GetRotation()); oldObj->SetResetAngle(oldObj->GetRotation());
obj->SetResetRun(loadedPrograms[run]); oldObj->SetResetRun(loadedPrograms[run]);
if (line->GetParam("reset")->AsBool(false)) if (line->GetParam("reset")->AsBool(false))
obj->SetResetCap(RESET_MOVE); oldObj->SetResetCap(RESET_MOVE);
} }
rankObj ++; rankObj ++;

View File

@ -83,7 +83,6 @@ bool CTaskBuild::CreateBuilding(Math::Vector pos, float angle)
{ {
float power = 0.0f; float power = 0.0f;
m_building = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, m_type, power); m_building = CObjectManager::GetInstancePointer()->CreateObject(pos, angle, m_type, power);
m_building->UpdateMapping();
m_building->SetLock(true); // not yet usable m_building->SetLock(true); // not yet usable
m_building->SetTeam(m_object->GetTeam()); m_building->SetTeam(m_object->GetTeam());

View File

@ -808,7 +808,7 @@ void CPhysics::MotorUpdate(float aTime, float rTime)
{ {
power = nullptr; power = nullptr;
if (IsObjectCarryingCargo(m_object)&& // carries something? if (IsObjectCarryingCargo(m_object)&& // carries something?
!m_object->IsSpaceshipCargo() ) !m_bFreeze )
{ {
motorSpeed.x *= 0.7f; // forward more slowly motorSpeed.x *= 0.7f; // forward more slowly
motorSpeed.z *= 0.5f; motorSpeed.z *= 0.5f;

View File

@ -547,6 +547,7 @@ bool CScriptFunctions::rGetObjectById(CBotVar* var, CBotVar* result, int& except
{ {
result->SetPointer(pObj->GetBotVar()); result->SetPointer(pObj->GetBotVar());
} }
return true; return true;
} }
@ -1161,6 +1162,7 @@ bool CScriptFunctions::rSearch(CBotVar* var, CBotVar* result, int& exception, vo
{ {
result->SetPointer(pBest->GetBotVar()); result->SetPointer(pBest->GetBotVar());
} }
return true; return true;
} }