166
XPiratez / Re: Bugs & Crash Reports
« on: July 06, 2016, 04:25:50 pm »
Clicking 'use left hand item' of the parrot causes the game to freeze. (The 'item' is just a blank space.)
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Would it make sense/not be too much work to create a second set of checks for arcing shots? I understand the idea that not shooting a bow at a target would make sense if the soldier can't see it, but this wouldn't this also have repercussions for other arcing weapons like mortars, grenade launchers, flamers, etc. where not having direct line-of-sight isn't as much as a problem?Firstly, just to clarify - I didn't intend for the change to prevent arcing shots when line of sight is blocked; and even with the change they still will fire (and hit) if you hold ctrl when issuing the order. I do think it kind of makes sense for it to be like that, but that's not the kind of change that I'd advocate (except possibly as part of a ruleset, as you suggest).
Maybe this could be a thing exposed to rulesets - does this arcing shot weapon require line of sight?
diff --git a/src/Battlescape/ProjectileFlyBState.cpp b/src/Battlescape/ProjectileFlyBState.cpp
index 0d84d1e..ceb5edf 100644
--- a/src/Battlescape/ProjectileFlyBState.cpp
+++ b/src/Battlescape/ProjectileFlyBState.cpp
@@ -223,7 +223,17 @@ void ProjectileFlyBState::init()
}
else
{
- _parent->getTileEngine()->canTargetUnit(&originVoxel, targetTile, &_targetVoxel, _unit);
+ if (_parent->getTileEngine()->canTargetUnit(&originVoxel, targetTile, &_targetVoxel, _unit) == false)
+ {
+ https:// if this action requires direct line-of-sight, we should abort.
+ if ((_action.type == BA_SNAPSHOT || _action.type == BA_AUTOSHOT || _action.type == BA_AIMEDSHOT) &&
+ !_action.weapon->getRules()->getArcingShot())
+ {
+ _action.result = "STR_NO_LINE_OF_FIRE";
+ _parent->popState();
+ return;
+ }
+ }
}
}
else if (targetTile->getMapData(O_OBJECT) != 0)
diff --git a/src/Battlescape/TileEngine.cpp b/src/Battlescape/TileEngine.cpp
index 3510149..f7038a2 100644
--- a/src/Battlescape/TileEngine.cpp
+++ b/src/Battlescape/TileEngine.cpp
@@ -820,6 +820,9 @@ bool TileEngine::canTargetUnit(Position *originVoxel, Tile *tile, Position *scan
}
}
}
+ https:// Couldn't find a line of fire; so just set the scanVoxel to be at the centre of the target.
+ https:// (Not all callers pay attention to the return value of this function.)
+ *scanVoxel = Position((tile->getPosition().x * 16) + 7, (tile->getPosition().y * 16) + 8, targetCenterHeight);
return false;
}
--- a/src/Battlescape/ProjectileFlyBState.cpp
+++ b/src/Battlescape/ProjectileFlyBState.cpp
@@ -223,7 +223,12 @@ void ProjectileFlyBState::init()
}
else
{
- _parent->getTileEngine()->canTargetUnit(&originVoxel, targetTile, &_targetVoxel, _unit);
+ if (_parent->getTileEngine()->canTargetUnit(&originVoxel, targetTile, &_targetVoxel, _unit) == false)
+ {
+ _action.result = "STR_NO_LINE_OF_FIRE";
+ _parent->popState();
+ return;
+ }
}
}
else if (targetTile->getMapData(O_OBJECT) != 0)
diff --git a/src/Battlescape/TileEngine.cpp b/src/Battlescape/TileEngine.cpp
index 3510149..9265e20 100644
--- a/src/Battlescape/TileEngine.cpp
+++ b/src/Battlescape/TileEngine.cpp
@@ -820,6 +820,9 @@ bool TileEngine::canTargetUnit(Position *originVoxel, Tile *tile, Position *scan
}
}
}
+ https:// Couldn't find a line of fire; so just set the scanVoxel to be at the centre of the target.
+ https:// (Not all callers pay attention to the return value of this function.)
+ *scanVoxel = Position((tile->getPosition().x * 16) + 7, (tile->getPosition().y * 16) + 8, targetCenterHeight);
return false;
}
diff --git a/src/Battlescape/TileEngine.cpp b/src/Battlescape/TileEngine.cpp
index 35214de..8d7fb9f 100644
--- a/src/Battlescape/TileEngine.cpp
+++ b/src/Battlescape/TileEngine.cpp
@@ -2755,29 +2754,31 @@ int TileEngine::calculateParabola(const Position& origin, const Position& target
x = (int)((double)origin.x + (double)i * cos(te) * sin(fi));
y = (int)((double)origin.y + (double)i * sin(te) * sin(fi));
z = (int)((double)origin.z + (double)i * cos(fi) - zK * ((double)i - ro / 2.0) * ((double)i - ro / 2.0) + zA);
- if (storeTrajectory && trajectory)
- {
- trajectory->push_back(Position(x, y, z));
- }
https://passes through this point?
Position nextPosition = Position(x,y,z);
- int result = calculateLine(lastPosition, nextPosition, false, 0, excludeUnit);
+ std::vector<Position> contactPoint;
+ int result = calculateLine(lastPosition, nextPosition, false, &contactPoint, excludeUnit);
if (result != V_EMPTY)
{
if (lastPosition.z < nextPosition.z)
{
result = V_OUTOFBOUNDS;
}
- if (!storeTrajectory && trajectory != 0)
+ if (trajectory != nullptr)
{ https:// store the position of impact
- trajectory->push_back(nextPosition);
+ assert(contactPoint.size() > 0);
+ trajectory->push_back(contactPoint[0]);
}
return result;
}
+ if (storeTrajectory && trajectory != nullptr)
+ {
+ trajectory->push_back(nextPosition);
+ }
lastPosition = Position(x,y,z);
++i;
}
- if (!storeTrajectory && trajectory != 0)
+ if (!storeTrajectory && trajectory != nullptr)
{ https:// store the position of impact
trajectory->push_back(Position(x, y, z));
}
diff --git a/src/Battlescape/TileEngine.cpp b/src/Battlescape/TileEngine.cpp
index 35214de..8d7fb9f 100644
--- a/src/Battlescape/TileEngine.cpp
+++ b/src/Battlescape/TileEngine.cpp
@@ -2755,29 +2754,31 @@ int TileEngine::calculateParabola(const Position& origin, const Position& target
x = (int)((double)origin.x + (double)i * cos(te) * sin(fi));
y = (int)((double)origin.y + (double)i * sin(te) * sin(fi));
z = (int)((double)origin.z + (double)i * cos(fi) - zK * ((double)i - ro / 2.0) * ((double)i - ro / 2.0) + zA);
- if (storeTrajectory && trajectory)
- {
- trajectory->push_back(Position(x, y, z));
- }
https://passes through this point?
Position nextPosition = Position(x,y,z);
- int result = calculateLine(lastPosition, nextPosition, false, 0, excludeUnit);
+ std::vector<Position> contactPoint;
+ int result = calculateLine(lastPosition, nextPosition, false, &contactPoint, excludeUnit);
if (result != V_EMPTY)
{
if (lastPosition.z < nextPosition.z)
{
- result = V_OUTOFBOUNDS;
+ result = V_OUTOFBOUNDS; https:// why??
}
- if (!storeTrajectory && trajectory != 0)
+ if (trajectory != nullptr)
{ https:// store the position of impact
- trajectory->push_back(nextPosition);
+ assert(contactPoint.size() > 0);
+ trajectory->push_back(contactPoint[0]);
}
return result;
}
+ if (storeTrajectory && trajectory != nullptr)
+ {
+ trajectory->push_back(nextPosition);
+ }
lastPosition = Position(x,y,z);
++i;
}
- if (!storeTrajectory && trajectory != 0)
+ if (!storeTrajectory && trajectory != nullptr)
{ https:// store the position of impact
trajectory->push_back(Position(x, y, z));
}
diff --git a/src/Savegame/CraftWeapon.cpp b/src/Savegame/CraftWeapon.cpp
index 2b952c4..b2e51c0 100644
--- a/src/Savegame/CraftWeapon.cpp
+++ b/src/Savegame/CraftWeapon.cpp
@@ -17,6 +17,7 @@
* along with OpenXcom. If not, see <https://www.gnu.org/licenses/>.
*/
#include <algorithm>
+#include <cmath>
#include "CraftWeapon.h"
#include "../Mod/RuleCraftWeapon.h"
#include "../Mod/Mod.h"
@@ -168,12 +169,12 @@ CraftWeaponProjectile* CraftWeapon::fire() const
*/
int CraftWeapon::getClipsLoaded(Mod *mod)
{
- int retVal = (int)floor((double)_ammo / _rules->getRearmRate());
+ int retVal = (int)std::floor((double)_ammo / _rules->getRearmRate());
RuleItem *clip = mod->getItem(_rules->getClipItem());
if (clip && clip->getClipSize() > 0)
{
- retVal = (int)floor((double)_ammo / clip->getClipSize());
+ retVal = (int)std::floor((double)_ammo / clip->getClipSize());
}
return retVal;
https:// Never mind. I've discovered a minor mistake in this change, and rather than taking the time to fix it and repost it I think it's better to just keep the current code.
diff --git a/src/Battlescape/ProjectileFlyBState.cpp b/src/Battlescape/ProjectileFlyBState.cpp
index 7101e35..0d84d1e 100644
--- a/src/Battlescape/ProjectileFlyBState.cpp
+++ b/src/Battlescape/ProjectileFlyBState.cpp
@@ -564,7 +564,7 @@ void ProjectileFlyBState::think()
}
}
- if (_projectileImpact == 4)
+ if (_projectileImpact == V_UNIT)
{
BattleUnit *victim = _parent->getSave()->getTile(_parent->getMap()->getProjectile()->getPosition(offset) / Position(16,16,24))->getUnit();
if (victim && !victim->isOut() && victim->getFaction() == FACTION_HOSTILE)
It would be great if this was fixed, Karadoc. X-Com tactical engine is ingenious, but it has a few bugs like this.Ok. I've started looking into it now. I haven't spotted anything that's obviously wrong. The algorithms make sense, it looks like it should probably work. But there are a couple of things that I think are a bit strange. For example, it seems to forbid projectiles from hitting their target on the way up. They can only hit on the way down. I don't know why they'd make a rule like that - but I don't think its the source of our problem.
*** No rule to make target 'C:/tools/MinGW/lib/libSDL_mixer.dll.a -lwinmm'It seems to think that libSDL_mixer.dll.a -lwinmm is a single thing, whereas to me that's meant to be two separate libraries. (And the SDL stuff does exist in that path.) I then manually edited the makefiles to fix it so that SDL_mixer and winmm were treated separately. That got it a bit further along, but then there were a bunch of undefined symbols in the final linking. So that's where I'm currently at. I'll try wrestling with it again another time.
set ( SDLMIXER_LIBRARY "${SDLMIXER_LIBRARY} -lwinmm" )
Presumably that's wrong. I don't see how that could ever work correctly. That's what makes "make" think there is a dependency with a weird two-part name which it doesn't know how to build. So I got rid of that line.#(original) target_link_libraries ( openxcom ${system_libs} ${SDLIMAGE_LIBRARY} ${SDLMIXER_LIBRARY} ${SDLGFX_LIBRARY} ${SDL_LIBRARY} ${OPENGL_gl_LIBRARY} debug ${YAMLCPP_LIBRARY_DEBUG} optimized ${YAMLCPP_LIBRARY} )
target_link_libraries ( openxcom ${system_libs} ${SDLIMAGE_LIBRARY} ${SDLMIXER_LIBRARY} -lwinmm ${SDLGFX_LIBRARY} ${SDL_LIBRARY} ${OPENGL_gl_LIBRARY} debug ${YAMLCPP_LIBRARY_DEBUG} optimized ${YAMLCPP_LIBRARY} -lz -lpng -lvorbisfile -lvorbis -logg -limagehlp -lDbghelp )
The air combat is anything but balanced, but at least it offers several alternatives, several challenges and some payoff (I hope). Fighters armed with dual Lancers used to dominate the game, as it's the longest-range weapon. Then the idea of 'tank' appeared, which is quite natural concept for jrpg-like model of air combat (a skewed one, I'd say, since 1 ship can protect 3 others).(I'm playing on the second hardest difficulty.)
However, if you comment on the air combat, always clarify what diff level are you using. At highest diff enemy ships, especially the military ones, can dish out at least thrice as much punishment as on the easiest diff (re-fire rate for Battleship and many of its ilk is 23-46 sec on easiest diff, and - if my calcs are correct - 7-14 sec on the highest diff, if OXC is faithful to the original in that matter).