Skip to content

Commit

Permalink
Merge branch 'master' into refactor_cmake_2
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjamenMeyer committed Oct 12, 2024
2 parents 013ef24 + 332a858 commit ee42e59
Show file tree
Hide file tree
Showing 52 changed files with 1,333 additions and 548 deletions.
54 changes: 40 additions & 14 deletions .github/workflows/gh-actions-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ jobs:
fail-fast: false
matrix:
include:
- FROM: 'ubuntu:mantic'
- FROM: 'ubuntu:noble'
COMPILER: 'gcc'
OpenGL_GL_PREFERENCE: 'LEGACY'
ENABLE_PIE: 'OFF'
allow_failure: true
- FROM: 'ubuntu:mantic'
- FROM: 'ubuntu:noble'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'LEGACY'
ENABLE_PIE: 'OFF'
allow_failure: true
- FROM: 'ubuntu:mantic'
- FROM: 'ubuntu:noble'
COMPILER: 'gcc'
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'OFF'
allow_failure: true
- FROM: 'ubuntu:mantic'
- FROM: 'ubuntu:noble'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'OFF'
Expand All @@ -56,6 +56,21 @@ jobs:
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'OFF'
allow_failure: false
- FROM: 'linuxmintd/mint22-amd64'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'OFF'
allow_failure: true
- FROM: 'linuxmintd/mint21.3-amd64'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'OFF'
allow_failure: true
- FROM: 'linuxmintd/mint21.2-amd64'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'OFF'
allow_failure: true
- FROM: 'linuxmintd/mint21.1-amd64'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'GLVND'
Expand All @@ -81,11 +96,16 @@ jobs:
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'OFF'
allow_failure: false
- FROM: 'debian:buster'
- FROM: 'opensuse/leap:15.6'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'LEGACY'
ENABLE_PIE: 'ON'
allow_failure: true
- FROM: 'opensuse/leap:15.6'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'OFF'
allow_failure: false
ENABLE_PIE: 'ON'
allow_failure: true
- FROM: 'opensuse/leap:15.5'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'LEGACY'
Expand All @@ -101,31 +121,37 @@ jobs:
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'ON'
allow_failure: false
- FROM: 'fedora:38'
- FROM: 'fedora:39'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'LEGACY'
ENABLE_PIE: 'ON'
allow_failure: true
- FROM: 'fedora:38'
- FROM: 'fedora:39'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'ON'
allow_failure: true
- FROM: 'fedora:37'
- FROM: 'fedora:40'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'GLVND'
OpenGL_GL_PREFERENCE: 'LEGACY'
ENABLE_PIE: 'ON'
allow_failure: false
- FROM: 'rockylinux:9.1'
allow_failure: true
- FROM: 'fedora:40'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'ON'
allow_failure: false
- FROM: 'rockylinux:8.7'
- FROM: 'rockylinux_rockylinux:9.4'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'ON'
allow_failure: false
# Disabled until the build can be fixed
#- FROM: 'rockylinux_rockylinux:8.10'
# COMPILER: 'clang'
# OpenGL_GL_PREFERENCE: 'GLVND'
# ENABLE_PIE: 'ON'
# allow_failure: false
#- FROM: 'manjarolinux/base'
# COMPILER: 'clang'
# OpenGL_GL_PREFERENCE: 'LEGACY'
Expand Down
45 changes: 33 additions & 12 deletions .github/workflows/gh-actions-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ jobs:
fail-fast: false
matrix:
include:
- FROM: 'ubuntu:mantic'
- FROM: 'ubuntu:noble'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'LEGACY'
ENABLE_PIE: 'OFF'
ARTIFACT_EXT: 'deb'
- FROM: 'ubuntu:mantic'
- FROM: 'ubuntu:noble'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'OFF'
Expand All @@ -46,6 +46,21 @@ jobs:
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'OFF'
ARTIFACT_EXT: 'tar.[xb]z*'
- FROM: 'linuxmintd/mint22-amd64'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'OFF'
ARTIFACT_EXT: 'deb'
- FROM: 'linuxmintd/mint21.3-amd64'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'OFF'
ARTIFACT_EXT: 'deb'
- FROM: 'linuxmintd/mint21.2-amd64'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'OFF'
ARTIFACT_EXT: 'deb'
- FROM: 'linuxmintd/mint21.1-amd64'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'GLVND'
Expand All @@ -71,11 +86,11 @@ jobs:
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'OFF'
ARTIFACT_EXT: 'deb'
- FROM: 'debian:buster'
- FROM: 'opensuse/leap:15.6'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'OFF'
ARTIFACT_EXT: 'deb'
OpenGL_GL_PREFERENCE: 'LEGACY'
ENABLE_PIE: 'ON'
ARTIFACT_EXT: 'rpm'
- FROM: 'opensuse/leap:15.5'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'LEGACY'
Expand All @@ -91,31 +106,37 @@ jobs:
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'ON'
ARTIFACT_EXT: 'rpm'
- FROM: 'fedora:38'
- FROM: 'fedora:40'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'LEGACY'
ENABLE_PIE: 'ON'
ARTIFACT_EXT: 'rpm'
- FROM: 'fedora:38'
- FROM: 'fedora:40'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'ON'
ARTIFACT_EXT: 'rpm'
- FROM: 'fedora:37'
- FROM: 'fedora:39'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'GLVND'
OpenGL_GL_PREFERENCE: 'LEGACY'
ENABLE_PIE: 'ON'
ARTIFACT_EXT: 'rpm'
- FROM: 'rockylinux:9.1'
- FROM: 'fedora:39'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'ON'
ARTIFACT_EXT: 'rpm'
- FROM: 'rockylinux:8.7'
- FROM: 'rockylinux_rockylinux:9.1'
COMPILER: 'clang'
OpenGL_GL_PREFERENCE: 'GLVND'
ENABLE_PIE: 'ON'
ARTIFACT_EXT: 'rpm'
# Disabled until the build can be fixed
#- FROM: 'rockylinux_rockylinux:8.10'
# COMPILER: 'clang'
# OpenGL_GL_PREFERENCE: 'GLVND'
# ENABLE_PIE: 'ON'
# ARTIFACT_EXT: 'rpm'

steps:
- name: Check out repository
Expand Down
2 changes: 2 additions & 0 deletions engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,8 @@ SET(LIBCOMPONENT
src/components/reactor.cpp

src/components/cloak.cpp
src/components/ftl_drive.cpp
src/components/jump_drive.cpp
)

SET(LIBGUI_SOURCES
Expand Down
14 changes: 7 additions & 7 deletions engine/src/cmd/ai/aggressive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,7 @@ static Unit *ChooseNavPoint(Unit *parent, Unit **otherdest, float *lurk_on_arriv
int whichlist = 1; //friendly
std::string fgname = UnitUtil::getFlightgroupName(parent);

bool insys = (parent->GetJumpStatus().drive == -2) || fgname.find(insysString) != std::string::npos;
bool insys = (!parent->jump_drive.Installed()) || fgname.find(insysString) != std::string::npos;
std::string::size_type whereconvoy = fgname.find(arrowString);
bool convoy = (whereconvoy != std::string::npos);
size_t total_size = stats->navs[0].size() + stats->navs[whichlist].size(); //friendly and neutral
Expand Down Expand Up @@ -1641,9 +1641,9 @@ void AggressiveAI::Execute() {
bool isjumpable = target ? (!target->GetDestinations().empty()) : false;
if (!ProcessCurrentFgDirective(fg)) {
if (isjumpable) {
if (parent->GetJumpStatus().drive < 0) {
if (!parent->jump_drive.IsDestinationSet()) {
parent->ActivateJumpDrive(0);
if (parent->GetJumpStatus().drive == -2) {
if (!parent->jump_drive.Installed()) {
static bool AIjumpCheat =
XMLSupport::parse_bool(vs_config->getVariable("AI",
"always_have_jumpdrive_cheat",
Expand All @@ -1654,15 +1654,15 @@ void AggressiveAI::Execute() {
VS_LOG(warning, "FIXME: warning ship not equipped to jump");
i = 1;
}
parent->jump.drive = -1;
parent->jump_drive.UnsetDestination();
} else {
parent->Target(NULL);
}
} else if (parent->GetJumpStatus().drive < 0) {
} else if (!parent->jump_drive.IsDestinationSet()) {
static bool
AIjumpCheat = XMLSupport::parse_bool(vs_config->getVariable("AI", "jump_cheat", "true"));
if (AIjumpCheat) {
parent->jump.drive = 0;
parent->jump_drive.SetDestination(0);
}
}
}
Expand Down Expand Up @@ -1734,7 +1734,7 @@ void AggressiveAI::Execute() {

isjumpable = target ? (!target->GetDestinations().empty()) : false;
if (!isjumpable) {
if (parent->GetJumpStatus().drive >= 0) {
if (parent->jump_drive.IsDestinationSet()) {
parent->ActivateJumpDrive(-1);
}
}
Expand Down
16 changes: 4 additions & 12 deletions engine/src/cmd/ai/docking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ QVector DockingOps::Movement(Unit *utdw) {
return loc;
}


bool DockingOps::DockToTarget(Unit *utdw) {
if (utdw->DockingPortLocations()[port].IsOccupied()) {
if (keeptrying) {
Expand All @@ -197,19 +198,13 @@ bool DockingOps::DockToTarget(Unit *utdw) {
float rad = utdw->DockingPortLocations()[port].GetRadius() + parent->rSize();
float diss = (parent->Position() - loc).MagnitudeSquared() - .1;
bool isplanet = utdw->isUnit() == Vega_UnitType::planet;
static float MinimumCapacityToRefuelOnLand =
XMLSupport::parse_float(vs_config->getVariable("physics",
"MinimumWarpCapToRefuelDockeesAutomatically",
"0"));

if (diss <= (isplanet ? rad * rad : parent->rSize() * parent->rSize())) {
DockedScript(parent, utdw);
if (physicallyDock) {
return parent->Dock(utdw);
} else {
float maxWillingToRefill = utdw->warpCapData();
if (maxWillingToRefill >= MinimumCapacityToRefuelOnLand) {
parent->refillWarpEnergy();
} //BUCO! This needs its own units.csv column to see how much we refill!
rechargeShip(parent, 0);
return true;
}
} else if (diss <= 1.2 * rad * rad) {
Expand All @@ -219,10 +214,7 @@ bool DockingOps::DockToTarget(Unit *utdw) {
if (physicallyDock) {
return parent->Dock(utdw);
} else {
float maxWillingToRefill = utdw->warpCapData();
if (maxWillingToRefill >= MinimumCapacityToRefuelOnLand) {
parent->refillWarpEnergy();
} //BUCO! This needs its own units.csv column to see how much we refill!
rechargeShip(parent, 0);
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion engine/src/cmd/ai/fire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ bool FireAt::isJumpablePlanet(Unit *targ) {
bool istargetjumpableplanet = targ->isUnit() == Vega_UnitType::planet;
if (istargetjumpableplanet) {
istargetjumpableplanet =
(!((Planet *) targ)->GetDestinations().empty()) && (parent->GetJumpStatus().drive >= 0);
(!((Planet *) targ)->GetDestinations().empty()) && (parent->jump_drive.IsDestinationSet());
}
return istargetjumpableplanet;
}
Expand Down
2 changes: 1 addition & 1 deletion engine/src/cmd/ai/flykeyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ void FlyByKeyboard::Execute(bool resetangvelocity) {
if ((counter - last_jumped) > static_cast<unsigned>(jump_key_delay / SIMULATION_ATOM) || last_jumped == 0) {
last_jumped = counter;
parent->ActivateJumpDrive();
if (parent->GetJumpStatus().drive >= 0) {
if (parent->jump_drive.IsDestinationSet()) {
static soundContainer foobar;
if (foobar.sound == -2) {
static string str = vs_config->getVariable("cockpitaudio", "jump_engaged", "jump");
Expand Down
3 changes: 2 additions & 1 deletion engine/src/cmd/ai/ikarus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ void Ikarus::Execute() {
DecideTarget();
if (!ProcessCurrentFgDirective(fg)) {
Unit *target = parent->Target();
bool isjumpable = target ? ((!target->GetDestinations().empty()) && parent->GetJumpStatus().drive >= 0) : false;
bool isjumpable = target ? ((!target->GetDestinations().empty()) &&
parent->jump_drive.IsDestinationSet()) : false;
if (isjumpable) {
AfterburnTurnTowards(this, parent);
} else {
Expand Down
2 changes: 1 addition & 1 deletion engine/src/cmd/ai/warpto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static void ActuallyWarpTo(Unit *parent, const QVector &tarpos, Vector tarvel, U
XMLSupport::parse_float(vs_config->getVariable("AI", "min_energy_to_enter_warp", ".33"));
static float min_warpfield_to_enter_warp =
XMLSupport::parse_float(vs_config->getVariable("AI", "min_warp_to_try", "1.5"));
if ((parent->warpEnergyData() > min_energy_to_enter_warp)
if ((parent->ftl_energy.Percent() > min_energy_to_enter_warp)
&& (parent->GetMaxWarpFieldStrength(1) > min_warpfield_to_enter_warp)) {
if (parent->graphicOptions.InWarp == 0) {
parent->graphicOptions.InWarp = 1; //don't want the AI thrashing
Expand Down
Loading

0 comments on commit ee42e59

Please sign in to comment.