diff options
36 files changed, 81 insertions, 99 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a22138..3446e3d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,9 +16,9 @@ set(COLOBOT_VERSION_MINOR 1) set(COLOBOT_VERSION_REVISION 0) # Used on official releases -set(COLOBOT_VERSION_RELEASE_CODENAME "-alpha") +#set(COLOBOT_VERSION_RELEASE_CODENAME "-alpha") # Used on unreleased, development builds -#set(COLOBOT_VERSION_UNRELEASED "+alpha") +set(COLOBOT_VERSION_UNRELEASED "+alpha") # Append git characteristics to version if(DEFINED COLOBOT_VERSION_UNRELEASED AND EXISTS "${CMAKE_SOURCE_DIR}/.git") @@ -178,6 +178,9 @@ else() add_definitions(-DTEST_VIRTUAL=) endif() +if(DEV_BUILD) + add_definitions(-DDEV_BUILD) +endif() ## # Additional settings to use when cross-compiling with MXE (http://mxe.cc/) diff --git a/data b/data -Subproject 2d7172438e8db1fa6d73d1c5f314489f8c936c1 +Subproject b2845f58c34fc60e1f3900e5544f6392ca170fa diff --git a/src/app/app.cpp b/src/app/app.cpp index 3bcb09d..04c028d 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -110,6 +110,7 @@ CApplication::CApplication() m_exitCode = 0; m_active = false; m_debugModes = 0; + m_customDataPath = false; m_windowTitle = "COLOBOT"; @@ -346,6 +347,7 @@ ParseArgsStatus CApplication::ParseArguments(int argc, char *argv[]) case OPT_DATADIR: { m_dataPath = optarg; + m_customDataPath = true; GetLogger()->Info("Using custom datadir or running mod: '%s'\n", m_dataPath.c_str()); break; } @@ -406,7 +408,7 @@ bool CApplication::Create() } else { - if (GetProfile().GetLocalProfileString("Resources", "Data", path)) + if (!m_customDataPath && GetProfile().GetLocalProfileString("Resources", "Data", path)) m_dataPath = path; } @@ -442,7 +444,7 @@ bool CApplication::Create() GetProfile().SetLocalProfileString("Resources", "Music", GetDataSubdirPath(DIR_MUSIC)); } - if (GetProfile().GetLocalProfileString("Resources", "Sound", path)) + if (!m_customDataPath && GetProfile().GetLocalProfileString("Resources", "Sound", path)) { m_sound->CacheAll(path); } @@ -451,7 +453,7 @@ bool CApplication::Create() m_sound->CacheAll(GetDataSubdirPath(DIR_SOUND)); } - if (GetProfile().GetLocalProfileString("Resources", "Music", path)) + if (!m_customDataPath && GetProfile().GetLocalProfileString("Resources", "Music", path)) { m_sound->AddMusicFiles(path); } diff --git a/src/app/app.h b/src/app/app.h index 269fa9b..6b02f67 100644 --- a/src/app/app.h +++ b/src/app/app.h @@ -480,6 +480,9 @@ protected: //! Path to directory with data files std::string m_dataPath; + //! True if datadir was passed in command line + bool m_customDataPath; + //! Path to directory with language files std::string m_langPath; diff --git a/src/graphics/engine/pyro.cpp b/src/graphics/engine/pyro.cpp index 7c51829..d3e0405 100644 --- a/src/graphics/engine/pyro.cpp +++ b/src/graphics/engine/pyro.cpp @@ -32,8 +32,6 @@ #include "object/robotmain.h" #include "object/motion/motionhuman.h" -#include "ui/displaytext.h" - // Graphics module namespace namespace Gfx { @@ -49,7 +47,6 @@ CPyro::CPyro() m_camera = m_main->GetCamera(); m_particle = m_engine->GetParticle(); m_lightMan = m_engine->GetLightManager(); - m_displayText = m_main->GetDisplayText(); m_sound = CApplication::GetInstancePointer()->GetSound(); m_object = nullptr; @@ -1301,13 +1298,13 @@ void CPyro::DisplayError(PyroType type, CObject* obj) oType == OBJECT_END ) { err = ERR_DELETEBUILDING; - m_displayText->DisplayError(err, obj->GetPosition(0), 5.0f); + m_main->DisplayError(err, obj->GetPosition(0), 5.0f); return; } if ( err != ERR_OK ) { - m_displayText->DisplayError(err, obj); + m_main->DisplayError(err, obj); } } } @@ -1556,15 +1553,18 @@ void CPyro::ExploStart() for (int i = 0; i < OBJECTMAXPART; i++) { int objRank = m_object->GetObjectRank(i); - if (objRank == -1) continue; + if (objRank == -1) continue; // TODO: refactor later to material change int oldBaseObjRank = m_engine->GetObjectBaseRank(objRank); - int newBaseObjRank = m_engine->CreateBaseObject(); - m_engine->CopyBaseObject(oldBaseObjRank, newBaseObjRank); - m_engine->SetObjectBaseRank(objRank, newBaseObjRank); + if (oldBaseObjRank != -1) + { + int newBaseObjRank = m_engine->CreateBaseObject(); + m_engine->CopyBaseObject(oldBaseObjRank, newBaseObjRank); + m_engine->SetObjectBaseRank(objRank, newBaseObjRank); - m_engine->ChangeSecondTexture(objRank, "dirty04.png"); + m_engine->ChangeSecondTexture(objRank, "dirty04.png"); + } Math::Vector pos = m_object->GetPosition(i); @@ -1628,11 +1628,14 @@ void CPyro::BurnStart() // TODO: refactor later to material change int oldBaseObjRank = m_engine->GetObjectBaseRank(objRank); - int newBaseObjRank = m_engine->CreateBaseObject(); - m_engine->CopyBaseObject(oldBaseObjRank, newBaseObjRank); - m_engine->SetObjectBaseRank(objRank, newBaseObjRank); + if (oldBaseObjRank != -1) + { + int newBaseObjRank = m_engine->CreateBaseObject(); + m_engine->CopyBaseObject(oldBaseObjRank, newBaseObjRank); + m_engine->SetObjectBaseRank(objRank, newBaseObjRank); - m_engine->ChangeSecondTexture(objRank, "dirty04.png"); + m_engine->ChangeSecondTexture(objRank, "dirty04.png"); + } } m_engine->LoadTexture("dirty04.png"); diff --git a/src/graphics/engine/pyro.h b/src/graphics/engine/pyro.h index 98b9a1b..60724b4 100644 --- a/src/graphics/engine/pyro.h +++ b/src/graphics/engine/pyro.h @@ -35,10 +35,6 @@ class CObject; class CRobotMain; class CSoundInterface; -namespace Ui { -class CDisplayText; -} - // Graphics module namespace namespace Gfx { @@ -179,7 +175,6 @@ protected: CParticle* m_particle; CLightManager* m_lightMan; CObject* m_object; - Ui::CDisplayText* m_displayText; CRobotMain* m_main; CSoundInterface* m_sound; diff --git a/src/object/auto/auto.cpp b/src/object/auto/auto.cpp index 8dc1d94..0aeaa0a 100644 --- a/src/object/auto/auto.cpp +++ b/src/object/auto/auto.cpp @@ -52,7 +52,6 @@ CAuto::CAuto(CObject* object) m_lightning = m_engine->GetLightning(); m_camera = m_main->GetCamera(); m_interface = m_main->GetInterface(); - m_displayText = m_main->GetDisplayText(); m_type = m_object->GetType(); m_time = 0.0f; @@ -83,7 +82,6 @@ CAuto::~CAuto() m_lightning = nullptr; m_camera = nullptr; m_interface = nullptr; - m_displayText = nullptr; } diff --git a/src/object/auto/auto.h b/src/object/auto/auto.h index 4a430ce..fd25e70 100644 --- a/src/object/auto/auto.h +++ b/src/object/auto/auto.h @@ -28,7 +28,6 @@ class CRobotMain; class CSoundInterface; namespace Ui { -class CDisplayText; class CInterface; class CWindow; } /* Ui */ @@ -101,7 +100,6 @@ protected: Gfx::CLightning* m_lightning; Gfx::CCamera* m_camera; Ui::CInterface* m_interface; - Ui::CDisplayText* m_displayText; CRobotMain* m_main; CObject* m_object; CSoundInterface* m_sound; diff --git a/src/object/auto/autobase.cpp b/src/object/auto/autobase.cpp index d0bd87b..6d61bc2 100644 --- a/src/object/auto/autobase.cpp +++ b/src/object/auto/autobase.cpp @@ -34,7 +34,6 @@ #include "ui/interface.h" #include "ui/window.h" -#include "ui/displaytext.h" @@ -317,14 +316,14 @@ begin: err = CheckCloseDoor(); if ( err != ERR_OK ) { - m_displayText->DisplayError(err, m_object); + m_main->DisplayError(err, m_object); return false; } err = m_main->CheckEndMission(false); if ( err != ERR_OK ) { - m_displayText->DisplayError(err, m_object); + m_main->DisplayError(err, m_object); return false; } diff --git a/src/object/auto/autoconvert.cpp b/src/object/auto/autoconvert.cpp index 7281ed7..ee1e83b 100644 --- a/src/object/auto/autoconvert.cpp +++ b/src/object/auto/autoconvert.cpp @@ -26,7 +26,6 @@ #include "ui/interface.h" #include "ui/window.h" -#include "ui/displaytext.h" #include <stdio.h> #include <string.h> @@ -515,7 +514,7 @@ void CAutoConvert::CreateMetal() if ( !fret->CreateResource(pos, angle, OBJECT_METAL) ) { delete fret; - m_displayText->DisplayError(ERR_TOOMANY, m_object); + m_main->DisplayError(ERR_TOOMANY, m_object); return; } @@ -524,6 +523,6 @@ void CAutoConvert::CreateMetal() fret->SetResetCap(RESET_DELETE); } - m_displayText->DisplayError(INFO_CONVERT, m_object); + m_main->DisplayError(INFO_CONVERT, m_object); } diff --git a/src/object/auto/autoderrick.cpp b/src/object/auto/autoderrick.cpp index b613406..5b6cea4 100644 --- a/src/object/auto/autoderrick.cpp +++ b/src/object/auto/autoderrick.cpp @@ -28,7 +28,6 @@ #include "ui/interface.h" #include "ui/window.h" -#include "ui/displaytext.h" #include <stdio.h> #include <string.h> @@ -535,7 +534,7 @@ void CAutoDerrick::CreateFret(Math::Vector pos, float angle, ObjectType type, if ( !fret->CreateResource(pos, angle, type) ) { delete fret; - m_displayText->DisplayError(ERR_TOOMANY, m_object); + m_main->DisplayError(ERR_TOOMANY, m_object); return; } fret->SetLock(true); // object not yet usable diff --git a/src/object/auto/autodestroyer.cpp b/src/object/auto/autodestroyer.cpp index fdaebc0..dfe8e78 100644 --- a/src/object/auto/autodestroyer.cpp +++ b/src/object/auto/autodestroyer.cpp @@ -24,7 +24,6 @@ #include "ui/interface.h" #include "ui/window.h" -#include "ui/displaytext.h" #include <stdio.h> #include <string.h> @@ -122,7 +121,7 @@ bool CAutoDestroyer::EventProcess(const Event &event) { Error err = StartAction(0); if ( err != ERR_OK ) - m_displayText->DisplayError(err, m_object); + m_main->DisplayError(err, m_object); return false; } diff --git a/src/object/auto/autoenergy.cpp b/src/object/auto/autoenergy.cpp index 6a8672b..a38caf2 100644 --- a/src/object/auto/autoenergy.cpp +++ b/src/object/auto/autoenergy.cpp @@ -29,7 +29,6 @@ #include "ui/interface.h" #include "ui/gauge.h" #include "ui/window.h" -#include "ui/displaytext.h" #include <stdio.h> #include <string.h> @@ -325,7 +324,7 @@ bool CAutoEnergy::EventProcess(const Event &event) fret->SetPosition(0, Math::Vector(0.0f, 3.0f, 0.0f)); m_object->SetPower(fret); - m_displayText->DisplayError(INFO_ENERGY, m_object); + m_main->DisplayError(INFO_ENERGY, m_object); } SetBusy(false); @@ -468,7 +467,7 @@ void CAutoEnergy::CreatePower() if ( !power->CreateResource(pos, angle, OBJECT_POWER) ) { delete power; - m_displayText->DisplayError(ERR_TOOMANY, m_object); + m_main->DisplayError(ERR_TOOMANY, m_object); return; } power->SetLock(true); // battery not yet usable diff --git a/src/object/auto/autofactory.cpp b/src/object/auto/autofactory.cpp index a648656..49abad4 100644 --- a/src/object/auto/autofactory.cpp +++ b/src/object/auto/autofactory.cpp @@ -32,7 +32,6 @@ #include "ui/interface.h" #include "ui/window.h" -#include "ui/displaytext.h" #include <stdio.h> #include <string.h> @@ -211,7 +210,7 @@ bool CAutoFactory::EventProcess(const Event &event) Error err = StartAction(type); if( err != ERR_OK && err != ERR_GENERIC ) - m_displayText->DisplayError(err, m_object); + m_main->DisplayError(err, m_object); if( err != ERR_GENERIC ) return false; @@ -379,7 +378,7 @@ bool CAutoFactory::EventProcess(const Event &event) } else { - m_displayText->DisplayError(INFO_FACTORY, m_object); + m_main->DisplayError(INFO_FACTORY, m_object); SoundManip(2.0f, 1.0f, 1.2f); fret = SearchFret(); // transform metal? @@ -678,7 +677,7 @@ bool CAutoFactory::CreateVehicle() if ( !vehicle->CreateVehicle(pos, angle, m_type, -1.0f, false, false) ) { delete vehicle; - m_displayText->DisplayError(ERR_TOOMANY, m_object); + m_main->DisplayError(ERR_TOOMANY, m_object); return false; } vehicle->UpdateMapping(); diff --git a/src/object/auto/autolabo.cpp b/src/object/auto/autolabo.cpp index 172a618..07112b7 100644 --- a/src/object/auto/autolabo.cpp +++ b/src/object/auto/autolabo.cpp @@ -29,7 +29,6 @@ #include "ui/interface.h" #include "ui/window.h" -#include "ui/displaytext.h" #include <stdio.h> #include <string.h> @@ -179,7 +178,7 @@ bool CAutoLabo::EventProcess(const Event &event) if ( event.type == EVENT_OBJECT_RiGUN ) err = StartAction(RESEARCH_iGUN); if( err != ERR_OK && err != ERR_GENERIC ) - m_displayText->DisplayError(err, m_object); + m_main->DisplayError(err, m_object); if( err != ERR_GENERIC ) return false; @@ -370,7 +369,7 @@ bool CAutoLabo::EventProcess(const Event &event) delete power; } - m_displayText->DisplayError(INFO_LABO, m_object); + m_main->DisplayError(INFO_LABO, m_object); SoundManip(1.5f, 1.0f, 0.5f); m_phase = ALAP_CLOSE1; diff --git a/src/object/auto/autonuclear.cpp b/src/object/auto/autonuclear.cpp index 224776d..edab5eb 100644 --- a/src/object/auto/autonuclear.cpp +++ b/src/object/auto/autonuclear.cpp @@ -26,7 +26,6 @@ #include "ui/interface.h" #include "ui/window.h" -#include "ui/displaytext.h" #include <stdio.h> #include <string.h> @@ -274,7 +273,7 @@ bool CAutoNuclear::EventProcess(const Event &event) SetBusy(false); UpdateInterface(); - m_displayText->DisplayError(INFO_NUCLEAR, m_object); + m_main->DisplayError(INFO_NUCLEAR, m_object); m_phase = ANUP_WAIT; m_progress = 0.0f; @@ -402,7 +401,7 @@ void CAutoNuclear::CreatePower() if ( !power->CreateResource(pos, angle, OBJECT_ATOMIC) ) { delete power; - m_displayText->DisplayError(ERR_TOOMANY, m_object); + m_main->DisplayError(ERR_TOOMANY, m_object); return; } diff --git a/src/object/auto/autoresearch.cpp b/src/object/auto/autoresearch.cpp index 8308ebe..834a48c 100644 --- a/src/object/auto/autoresearch.cpp +++ b/src/object/auto/autoresearch.cpp @@ -29,7 +29,6 @@ #include "ui/interface.h" #include "ui/gauge.h" #include "ui/window.h" -#include "ui/displaytext.h" #include <stdio.h> #include <string.h> @@ -178,7 +177,7 @@ bool CAutoResearch::EventProcess(const Event &event) if ( event.type == EVENT_OBJECT_RATOMIC ) err = StartAction(RESEARCH_ATOMIC); if( err != ERR_OK && err != ERR_GENERIC ) - m_displayText->DisplayError(err, m_object); + m_main->DisplayError(err, m_object); if( err != ERR_GENERIC ) return false; @@ -257,7 +256,7 @@ bool CAutoResearch::EventProcess(const Event &event) m_eventQueue->AddEvent(newEvent); UpdateInterface(); - m_displayText->DisplayError(INFO_RESEARCH, m_object); + m_main->DisplayError(INFO_RESEARCH, m_object); message = ERR_OK; if ( m_research == RESEARCH_TANK ) message = INFO_RESEARCHTANK; @@ -270,7 +269,7 @@ bool CAutoResearch::EventProcess(const Event &event) if ( m_research == RESEARCH_ATOMIC ) message = INFO_RESEARCHATOMIC; if ( message != ERR_OK ) { - m_displayText->DisplayError(message, m_object); + m_main->DisplayError(message, m_object); } SetBusy(false); diff --git a/src/object/auto/autotower.cpp b/src/object/auto/autotower.cpp index 17a41f4..329cab0 100644 --- a/src/object/auto/autotower.cpp +++ b/src/object/auto/autotower.cpp @@ -27,7 +27,6 @@ #include "script/cmdtoken.h" #include "ui/interface.h" -#include "ui/displaytext.h" #include "ui/window.h" #include "ui/gauge.h" @@ -179,7 +178,7 @@ bool CAutoTower::EventProcess(const Event &event) target = SearchTarget(m_targetPos); if ( energy < ENERGY_FIRE ) { - m_displayText->DisplayError(ERR_TOWER_ENERGY, m_object); + m_main->DisplayError(ERR_TOWER_ENERGY, m_object); } if ( target == 0 || energy < ENERGY_FIRE ) { diff --git a/src/object/brain.cpp b/src/object/brain.cpp index 9e5149e..1b1565a 100644 --- a/src/object/brain.cpp +++ b/src/object/brain.cpp @@ -35,7 +35,6 @@ #include "sound/sound.h" -#include "ui/displaytext.h" #include "ui/interface.h" #include "ui/slider.h" #include "ui/studio.h" @@ -61,7 +60,6 @@ CBrain::CBrain(CObject* object) m_terrain = m_main->GetTerrain(); m_camera = m_main->GetCamera(); m_interface = m_main->GetInterface(); - m_displayText = m_main->GetDisplayText(); m_sound = CApplication::GetInstancePointer()->GetSound(); m_physics = nullptr; m_motion = nullptr; @@ -733,7 +731,7 @@ bool CBrain::EventProcess(const Event &event) if ( err != ERR_OK ) { - m_displayText->DisplayError(err, m_object); + m_main->DisplayError(err, m_object); } return true; @@ -1201,7 +1199,7 @@ void CBrain::GroundFlat() err = ERR_FLAG_FLY; pos = m_object->GetPosition(0); if ( pos.y < m_water->GetLevel() ) err = ERR_FLAG_WATER; - m_displayText->DisplayError(err, m_object); + m_main->DisplayError(err, m_object); return; } diff --git a/src/object/brain.h b/src/object/brain.h index dcf07a4..a1f5da7 100644 --- a/src/object/brain.h +++ b/src/object/brain.h @@ -43,7 +43,6 @@ namespace Ui { class CStudio; class CInterface; class CWindow; -class CDisplayText; } namespace Gfx { @@ -177,7 +176,6 @@ protected: CPhysics* m_physics; CMotion* m_motion; Ui::CInterface* m_interface; - Ui::CDisplayText* m_displayText; CRobotMain* m_main; Ui::CStudio* m_studio; CSoundInterface* m_sound; diff --git a/src/object/object.cpp b/src/object/object.cpp index 4cf0688..5a709e6 100644 --- a/src/object/object.cpp +++ b/src/object/object.cpp @@ -79,8 +79,6 @@ #include "script/cbottoken.h" #include "script/cmdtoken.h" -#include "ui/displaytext.h" - #define ADJUST_ONBOARD false // true -> adjusts the camera ONBOARD @@ -228,7 +226,6 @@ CObject::CObject() m_main = CRobotMain::GetInstancePointer(); m_terrain = m_main->GetTerrain(); m_camera = m_main->GetCamera(); - m_displayText = m_main->GetDisplayText(); m_physics = nullptr; m_brain = nullptr; m_motion = nullptr; @@ -5988,7 +5985,7 @@ bool CObject::EventFrame(const Event &event) m_sound->Play(SOUND_FINDING); pyro = new Gfx::CPyro(); pyro->Create(Gfx::PT_FINDING, this, 0.0f); - m_displayText->DisplayError(INFO_FINDING, this); + m_main->DisplayError(INFO_FINDING, this); } } @@ -6639,7 +6636,7 @@ void CObject::SetSelect(bool bMode, bool bDisplayError) } if ( err != ERR_OK && bDisplayError ) { - m_displayText->DisplayError(err, this); + m_main->DisplayError(err, this); } } diff --git a/src/object/object.h b/src/object/object.h index 25ea708..e8b83d9 100644 --- a/src/object/object.h +++ b/src/object/object.h @@ -38,10 +38,6 @@ class CRobotMain; class CBotVar; class CScript; -namespace Ui { -class CDisplayText; -} - /** * \enum ObjectType @@ -689,7 +685,6 @@ protected: CBrain* m_brain; CMotion* m_motion; CAuto* m_auto; - Ui::CDisplayText* m_displayText; CRobotMain* m_main; CSoundInterface* m_sound; CBotVar* m_botVar; diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index b58e5f8..ddee0ff 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -7520,3 +7520,12 @@ void CRobotMain::RestoreNumericLocale() setlocale(LC_NUMERIC, m_oldLocale.c_str()); } +void CRobotMain::DisplayError(Error err, CObject* pObj, float time) +{ + m_displayText->DisplayError(err, pObj, time); +} + +void CRobotMain::DisplayError(Error err, Math::Vector goal, float height, float dist, float time) +{ + m_displayText->DisplayError(err, goal, height, dist, time); +} diff --git a/src/object/robotmain.h b/src/object/robotmain.h index 525e5df..035698c 100644 --- a/src/object/robotmain.h +++ b/src/object/robotmain.h @@ -379,6 +379,9 @@ public: CObject* GetSelect(); + void DisplayError(Error err, CObject* pObj, float time=10.0f); + void DisplayError(Error err, Math::Vector goal, float height=15.0f, float dist=60.0f, float time=10.0f); + protected: bool EventFrame(const Event &event); bool EventObject(const Event &event); diff --git a/src/object/task/task.cpp b/src/object/task/task.cpp index 5ec6f8a..3624816 100644 --- a/src/object/task/task.cpp +++ b/src/object/task/task.cpp @@ -35,7 +35,6 @@ CTask::CTask(CObject* object) m_main = CRobotMain::GetInstancePointer(); m_terrain = m_main->GetTerrain(); m_camera = m_main->GetCamera(); - m_displayText = m_main->GetDisplayText(); m_object = object; m_physics = m_object->GetPhysics(); diff --git a/src/object/task/task.h b/src/object/task/task.h index 41b3d3b..800b880 100644 --- a/src/object/task/task.h +++ b/src/object/task/task.h @@ -32,9 +32,6 @@ class CObject; class CRobotMain; class CSoundInterface; -namespace Ui { -class CDisplayText; -} /* Ui */ namespace Gfx { class CEngine; @@ -84,7 +81,6 @@ protected: CPhysics* m_physics; CObject* m_object; CRobotMain* m_main; - Ui::CDisplayText* m_displayText; CSoundInterface* m_sound; }; diff --git a/src/object/task/taskbuild.cpp b/src/object/task/taskbuild.cpp index 39479a6..4a62a4a 100644 --- a/src/object/task/taskbuild.cpp +++ b/src/object/task/taskbuild.cpp @@ -33,8 +33,6 @@ #include "physics/physics.h" -#include "ui/displaytext.h" - #include <string.h> // Object's constructor. @@ -264,7 +262,7 @@ bool CTaskBuild::EventProcess(const Event &event) m_camera->FlushEffect(); Abort(); m_bError = true; - m_displayText->DisplayError(ERR_TOOMANY, m_object->GetPosition(0)); + m_main->DisplayError(ERR_TOOMANY, m_object->GetPosition(0)); return false; } CreateLight(); @@ -486,7 +484,7 @@ Error CTaskBuild::IsEnded() m_building->SetCirVibration(Math::Vector(0.0f, 0.0f, 0.0f)); m_building->SetLock(false); // building usable m_main->CreateShortcuts(); - m_displayText->DisplayError(INFO_BUILD, m_buildingPos, 10.0f, 50.0f); + m_main->DisplayError(INFO_BUILD, m_buildingPos, 10.0f, 50.0f); automat = m_building->GetAuto(); if ( automat != 0 ) diff --git a/src/object/task/taskrecover.cpp b/src/object/task/taskrecover.cpp index b86e9a5..af84099 100644 --- a/src/object/task/taskrecover.cpp +++ b/src/object/task/taskrecover.cpp @@ -27,7 +27,7 @@ #include "physics/physics.h" -#include "ui/displaytext.h" +#include "object/robotmain.h" const float ENERGY_RECOVER = 0.25f; // energy consumed by recovery @@ -305,7 +305,7 @@ Error CTaskRecover::IsEnded() m_metal = 0; Abort(); m_bError = true; - m_displayText->DisplayError(ERR_TOOMANY, m_object); + m_main->DisplayError(ERR_TOOMANY, m_object); return ERR_STOP; } m_metal->SetLock(true); // metal not yet usable diff --git a/src/object/task/tasksearch.cpp b/src/object/task/tasksearch.cpp index 974a53d..aa731a0 100644 --- a/src/object/task/tasksearch.cpp +++ b/src/object/task/tasksearch.cpp @@ -26,9 +26,7 @@ #include "physics/physics.h" -#include "ui/displaytext.h" - - +#include "object/robotmain.h" // Object's constructor. @@ -293,11 +291,11 @@ bool CTaskSearch::CreateMark() if ( !fret->CreateResource(pos, 0.0f, type) ) { delete fret; - m_displayText->DisplayError(ERR_TOOMANY, m_object); + m_main->DisplayError(ERR_TOOMANY, m_object); return false; } - m_displayText->DisplayError(info, pos, 5.0f, 50.0f); // displays the message + m_main->DisplayError(info, pos, 5.0f, 50.0f); // displays the message return true; } diff --git a/src/object/task/taskshield.cpp b/src/object/task/taskshield.cpp index fe6eaeb..e9ab157 100644 --- a/src/object/task/taskshield.cpp +++ b/src/object/task/taskshield.cpp @@ -26,6 +26,7 @@ #include "math/geometry.h" #include "object/brain.h" +#include "object/robotmain.h" #include "physics/physics.h" diff --git a/src/object/task/taskterraform.cpp b/src/object/task/taskterraform.cpp index 1f5ef7b..096e5de 100644 --- a/src/object/task/taskterraform.cpp +++ b/src/object/task/taskterraform.cpp @@ -28,6 +28,7 @@ #include "math/geometry.h" #include "object/brain.h" +#include "object/robotmain.h" #include "object/motion/motionant.h" #include "object/motion/motionspider.h" diff --git a/src/object/task/taskturn.cpp b/src/object/task/taskturn.cpp index bf9d593..9c099d2 100644 --- a/src/object/task/taskturn.cpp +++ b/src/object/task/taskturn.cpp @@ -20,7 +20,7 @@ #include "graphics/engine/terrain.h" #include "physics/physics.h" - +#include "object/robotmain.h" // Object's constructor. diff --git a/src/script/script.cpp b/src/script/script.cpp index b03702c..8736f01 100644 --- a/src/script/script.cpp +++ b/src/script/script.cpp @@ -3174,7 +3174,7 @@ bool CScript::rMessage(CBotVar* var, CBotVar* result, int& exception, void* user type = static_cast<Ui::TextType>(var->GetValInt()); } - script->m_displayText->DisplayText(p, script->m_object, 10.0f, type); + script->m_main->GetDisplayText()->DisplayText(p, script->m_object, 10.0f, type); script->m_main->CheckEndMessage(p); return true; @@ -3504,7 +3504,6 @@ CScript::CScript(CObject* object, CTaskManager** secondaryTask) m_secondaryTask = secondaryTask; m_interface = m_main->GetInterface(); - m_displayText = m_main->GetDisplayText(); m_ipf = CBOT_IPF; m_errMode = ERM_STOP; @@ -3899,7 +3898,7 @@ bool CScript::Continue(const Event &event) { char s[100]; GetError(s); - m_displayText->DisplayText(s, m_object, 10.0f, Ui::TT_ERROR); + m_main->GetDisplayText()->DisplayText(s, m_object, 10.0f, Ui::TT_ERROR); } m_engine->SetPause(true); // gives pause return true; @@ -3932,7 +3931,7 @@ bool CScript::Continue(const Event &event) { char s[100]; GetError(s); - m_displayText->DisplayText(s, m_object, 10.0f, Ui::TT_ERROR); + m_main->GetDisplayText()->DisplayText(s, m_object, 10.0f, Ui::TT_ERROR); } return true; } @@ -3974,7 +3973,7 @@ bool CScript::Step(const Event &event) { char s[100]; GetError(s); - m_displayText->DisplayText(s, m_object, 10.0f, Ui::TT_ERROR); + m_main->GetDisplayText()->DisplayText(s, m_object, 10.0f, Ui::TT_ERROR); } return true; } diff --git a/src/script/script.h b/src/script/script.h index 7a5d075..7fd5555 100644 --- a/src/script/script.h +++ b/src/script/script.h @@ -34,7 +34,6 @@ class CTaskManager; class CRobotMain; namespace Ui{ -class CDisplayText; class CEdit; class CInterface; class CList; @@ -210,7 +209,6 @@ private: protected: Gfx::CEngine* m_engine; Ui::CInterface* m_interface; - Ui::CDisplayText* m_displayText; CBotProgram* m_botProg; CRobotMain* m_main; Gfx::CTerrain* m_terrain; diff --git a/test/unit/CMakeLists.txt b/test/unit/CMakeLists.txt index 95cf1b1..d5256ec 100644 --- a/test/unit/CMakeLists.txt +++ b/test/unit/CMakeLists.txt @@ -232,7 +232,7 @@ ${LIBSNDFILE_LIBRARY} add_executable(colobot_ut ${COLOBOT_SOURCES} ${UT_SOURCES} ${OPENAL_SOURCES}) target_link_libraries(colobot_ut ${LIBS}) -add_test(colobot_ut ./colobot_ut) +add_test(colobot_ut ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/colobot_ut) # TODO: change the unit cases to independent automated tests to be included in colobot_ut add_subdirectory(common) diff --git a/test/unit/ui/CMakeLists.txt b/test/unit/ui/CMakeLists.txt index c18af87..a6ab669 100644 --- a/test/unit/ui/CMakeLists.txt +++ b/test/unit/ui/CMakeLists.txt @@ -44,4 +44,4 @@ target_link_libraries(edit_test gtest gmock clipboard ${SDL_LIBRARY} ${SDLTTF_LI -add_test(edit_test ./edit_test) +add_test(edit_test ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/edit_test) |