Fixed Bug #6924: missile cast near map border
This commit is contained in:
parent
ffb6d10fc7
commit
05c8227917
2 changed files with 18 additions and 9 deletions
|
@ -36,10 +36,11 @@
|
|||
<li>Future 2.00 Release<p>
|
||||
<ul>
|
||||
<li>++
|
||||
<li>Fixed Bug #6924: missile cast near map border (from Russell Smith).
|
||||
<li>Rewrote video using SDL_Surface, enable with -DUSE_SDL_SURFACE (from Nehal Mistry).
|
||||
<li>Per UnitType limits (from François Beerten)
|
||||
<li>Record and check sync info in replay (from Ludovic Pollet)
|
||||
<li>Fixed Bug #6670 Support for keyboards other than QWERTY (from Ludovic Pollet)
|
||||
<li>Fixed Bug #6670: Support for keyboards other than QWERTY (from Ludovic Pollet)
|
||||
<li>AI can use automatically transporters (Task #2852) (from Ludovic Pollet)
|
||||
<li>Added a map splitter for fast PlaceReachable. (from Ludovic Pollet)
|
||||
<li>Food, replaced with Supply/Demand. Buildings support demand (from Russell Smith).
|
||||
|
|
|
@ -609,6 +609,7 @@ global void FireMissile(Unit* unit)
|
|||
local void GetMissileMapArea(const Missile* missile, int* sx, int* sy,
|
||||
int* ex, int* ey)
|
||||
{
|
||||
#define Bound(x, y) (x) < 0 ? 0 : ((x) > (y) ? (y) : (x))
|
||||
DebugCheck(missile == NULL);
|
||||
DebugCheck(sx == NULL);
|
||||
DebugCheck(sy == NULL);
|
||||
|
@ -617,10 +618,11 @@ local void GetMissileMapArea(const Missile* missile, int* sx, int* sy,
|
|||
DebugCheck(TileSizeX <= 0);
|
||||
DebugCheck(TileSizeY <= 0);
|
||||
DebugCheck(missile->Type == NULL);
|
||||
*sx = missile->X / TileSizeX;
|
||||
*sy = missile->Y / TileSizeY;
|
||||
*ex = (missile->X + missile->Type->Width) / TileSizeX;
|
||||
*ey = (missile->Y + missile->Type->Height) / TileSizeY;
|
||||
*sx = Bound(missile->X / TileSizeX, TheMap.Width - 1);
|
||||
*sy = Bound(missile->Y / TileSizeY, TheMap.Height - 1);
|
||||
*ex = Bound((missile->X + missile->Type->Width) / TileSizeX, TheMap.Width - 1);
|
||||
*ey = Bound((missile->Y + missile->Type->Height) / TileSizeY, TheMap.Height - 1);
|
||||
#undef Bound
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -637,6 +639,8 @@ local int MissileVisibleInViewport(const Viewport* vp, const Missile* missile)
|
|||
int max_x;
|
||||
int min_y;
|
||||
int max_y;
|
||||
int x;
|
||||
int y;
|
||||
|
||||
DebugCheck(vp == NULL);
|
||||
DebugCheck(missile == NULL);
|
||||
|
@ -646,11 +650,15 @@ local int MissileVisibleInViewport(const Viewport* vp, const Missile* missile)
|
|||
}
|
||||
DebugLevel3Fn("Missile bounding box %d %d %d %d\n" _C_ min_x _C_ max_x _C_
|
||||
min_y _C_ max_y);
|
||||
if (!IsMapFieldVisible(ThisPlayer, (missile->X - TileSizeX / 2) / TileSizeX,
|
||||
(missile->Y - TileSizeY / 2) / TileSizeY) && !ReplayRevealMap) {
|
||||
return 0;
|
||||
|
||||
for (x = min_x; x <= max_x; ++x) {
|
||||
for ( y = min_y; y <= max_y; ++y) {
|
||||
if (ReplayRevealMap || IsMapFieldVisible(ThisPlayer, x, y)) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue