[+] Reverted back the gray dot showing for UnitActionStill.

[+] Added support for AlwaysFire flag in spawn-missile anim.
[*] More complete changelog.
[-] Fixed unit freeze for UnitActionStandGround.
[-] Fix MaxResources manage.
[-] Fixed clamp assert if left and right ranges are equal.
This commit is contained in:
cybermind 2012-05-03 19:46:26 +06:00
parent 4722ed21c9
commit c59a035066
11 changed files with 41 additions and 18 deletions

View file

@ -2,7 +2,7 @@
<html>
<head>
<!--
---- (c) Copyright 1998-2011 by Lutz Sammer and Pali Rohár
---- (c) Copyright 1998-2012 by Lutz Sammer and Pali Rohár
---- This program is free software; you can redistribute it and/or modify
---- it under the terms of the GNU General Public License as published by
@ -46,8 +46,13 @@
<p/>
<li>trunk</li>
<ul>
<li>Added OnHit Lua callback parameter for UnitType to create some effects if unit is hit (from Cybermind)</li>
<li>Reworked the button's popup system to achieve more flexibility (from Cybermind)</li>
<li>Added Preference.ShowNameDelay and Preference.ShowNameTime to show a popup for unit under cursor (from Cybermind)</li>
<li>Code compile now with Lua 5.2 (from Joris Dauphin).</li>
<li>Fix bug #909454: compile errorson OpenBSD. (from Pali Rohár)</li>
<li>Fix bug #901393: Always "network out of sync" in multiplayer mode (from Cybermind)</li>
<li>Fix bug #710187: OpenGL is slower than without OpenGL (from Cybermind)</li>
<li>Fix bug #909454: compile errors on OpenBSD. (from Pali Rohár)</li>
<li>Fix compilation for maemo. (from Pali Rohár)</li>
<li>Fix bug #910078: worker unable to do anything after building structure. (patch from Neil Tan)</li>
<li>Fix bug #912904: Fix pathfinfing problem with unit near of goal. (patch from Neil Tan)</li>
@ -55,7 +60,7 @@
<li>Fix bug #841133: Fix Action resource and DeassignWorkerFromMine. (from Joris Dauphin)</li>
<li>Fix some regression in pathFinding. (from Joris Dauphin)</li>
<li>Rearchitecturing of COrder and CAnimation. (from Joris Dauphin)</li>
<li>Add DefineDefaultResourceMaxAmounts() to define max value per resource. Add "Storing" in UnitType to increase MaxResourceAmount (from Cybermind)</li>
<li>Add DefineDefaultResourceMaxAmounts() to define max value per resource (like tiberium from C&C). Add "Storing" in UnitType to increase MaxResourceAmount (from Cybermind)</li>
<li>New unitType flag:"Wall" which create "connection" with its neighboors. (from Cybermind)</li>
<li>New unitType flag:"NonSolid" for unit which don't forbid other unit to be in the same place. (from Cybermind)</li>
<li>New missile class "missile-class-treacer" which seek towards its target. (from Cybermind)</li>
@ -1430,7 +1435,7 @@ g the callback. (from Francois Beerten)
</ul>
<hr>
(C) Copyright 1998-2011 by The <a href="https://launchpad.net/stratagus">Stratagus</a> Project
(C) Copyright 1998-2012 by The <a href="https://launchpad.net/stratagus">Stratagus</a> Project
under the <a href="gpl.html">GNU General Public License</a>.<br>
All trademarks and copyrights on this page are owned by their respective owners.<br>
</body>

View file

@ -108,6 +108,8 @@ enum {
{
if (this->Action == UnitActionStandGround) {
Video.FillCircleClip(ColorBlack, lastScreenPos, 2);
} else {
Video.FillCircleClip(ColorGray, lastScreenPos, 2);
}
return lastScreenPos;
}
@ -257,7 +259,7 @@ static CUnit *UnitToRepairInRange(const CUnit &unit, int range)
*/
bool AutoRepair(CUnit &unit)
{
const int repairRange = unit.Variable[AUTOREPAIRRANGE_INDEX].Value;
const int repairRange = unit.Type->DefaultStat.Variables[AUTOREPAIRRANGE_INDEX].Value;
if (unit.AutoRepair == false || repairRange == 0) {
return false;
@ -291,6 +293,7 @@ bool COrder_Still::AutoAttackStand(CUnit &unit)
return false;
}
this->State = SUB_STILL_ATTACK; // Mark attacking.
this->SetGoal(this->AutoTarget);
UnitHeadingFromDeltaXY(unit, this->AutoTarget->tilePos + this->AutoTarget->Type->GetHalfTileSize() - unit.tilePos);
return true;
}

View file

@ -116,7 +116,7 @@ static int TransformUnitIntoType(CUnit &unit, const CUnitType &newtype)
for (int i = 0; i < MaxCosts; ++i) {
if (player.MaxResources[i] != -1) {
player.MaxResources[i] += newtype._Storing[i] - oldtype._Storing[i];
player.SetResource(i, player.Resources[i], true);
player.SetResource(i, player.StoredResources[i], true);
}
}

View file

@ -335,7 +335,8 @@ static void HandleUnitAction(CUnit &unit)
// o Look if we have a new order and old finished.
// o Or the order queue should be flushed.
if (unit.Orders[0]->Finished && unit.Orders.size() > 1) {
if ((unit.Orders[0]->Action == UnitActionStandGround || unit.Orders[0]->Finished)
&& unit.Orders.size() > 1) {
if (unit.Removed) { // FIXME: johns I see this as an error
DebugPrint("Flushing removed unit\n");
// This happens, if building with ALT+SHIFT.

View file

@ -71,7 +71,7 @@ bool returnFalse(int , int) { return false; }
}
/*
** s = "leftOp rigthOp Op gotoLabel"
** s = "leftOp Op rigthOp gotoLabel"
*/
/* virtual */ void CAnimation_IfVar::Init(const char *s)
{

View file

@ -114,10 +114,12 @@ static int ParseAnimFlags(CUnit &unit, const char *parseflag)
start.y = (goal->tilePos.y + starty) * PixelTileSize.y + PixelTileSize.y / 2;
}
if ((flags & ANIM_SM_TOTARGET)) {
const CUnit *target = goal->CurrentOrder()->GetGoal();
Assert(goal->CurrentAction() == UnitActionAttack);
CUnit *target = goal->CurrentOrder()->GetGoal();
if (!target || target->Destroyed || target->Removed) {
return;
Assert(!unit.Type->Missile.Missile->AlwaysFire || unit.Type->Missile.Missile->Range);
if (!target || !unit.Type->Missile.Missile->AlwaysFire) {
return;
}
}
if (flags & ANIM_SM_PIXEL) {
dest.x = target->tilePos.x * PixelTileSize.x + target->IX + destx;

View file

@ -180,7 +180,7 @@ extern long isqrt(long num);
template <typename T>
void clamp(T *value, T minValue, T maxValue)
{
Assert(minValue < maxValue);
Assert(minValue <= maxValue);
if (*value < minValue) {
*value = minValue;

View file

@ -338,7 +338,9 @@ void CPlayer::Load(lua_State *l)
}
// Manage max
for (int i = 0; i < MaxCosts; ++i) {
this->SetResource(i, this->Resources[i]);
if (this->MaxResources[i] != -1) {
this->SetResource(i, this->StoredResources[i]);
}
}
}

View file

@ -821,9 +821,9 @@ void DrawResources()
const int resourceAmount = ThisPlayer->Resources[i];
if (ThisPlayer->MaxResources[i] != -1) {
const int storedAmount = ThisPlayer->StoredResources[i];
const int resAmount = ThisPlayer->StoredResources[i] + ThisPlayer->Resources[i];
char tmp[128];
snprintf(tmp, sizeof(tmp), "%d/%d (%d)", storedAmount, ThisPlayer->MaxResources[i], resourceAmount);
snprintf(tmp, sizeof(tmp), "%d (%d)", resAmount, ThisPlayer->MaxResources[i] - ThisPlayer->StoredResources[i]);
label.SetFont(GetSmallFont());
label.Draw(UI.Resources[i].TextX, UI.Resources[i].TextY + 3, tmp);

View file

@ -970,7 +970,7 @@ void UnitLost(CUnit &unit)
const int newMaxValue = player.MaxResources[i] - type._Storing[i];
player.MaxResources[i] = std::max(0, newMaxValue);
player.SetResource(i, player.Resources[i]);
player.SetResource(i, player.StoredResources[i], true);
}
}
// Handle income improvements, look if a player loses a building

View file

@ -254,8 +254,18 @@ void UpdateStats(int reset)
// Non-solid units can always be entered and they don't block anything
if (type.NonSolid) {
type.MovementMask = 0;
type.FieldFlags = 0;
if (type.Building) {
type.MovementMask = MapFieldLandUnit |
MapFieldSeaUnit |
MapFieldBuilding |
MapFieldCoastAllowed |
MapFieldWaterAllowed |
MapFieldUnpassable;
type.FieldFlags = MapFieldNoBuilding;
} else {
type.MovementMask = 0;
type.FieldFlags = 0;
}
continue;
}