Fix mixed EOL (\n, \r\n)
fix small bugs
This commit is contained in:
parent
f8aff0f96d
commit
0cc04664b6
4 changed files with 17 additions and 14 deletions
src
|
@ -209,7 +209,7 @@ static void MoveToTarget(CUnit &unit)
|
|||
COrderPtr order = unit.CurrentOrder();
|
||||
if (err == 0 && !order->HasGoal()) {
|
||||
// Check if we're in range when attacking a location and we are waiting
|
||||
if (unit.MapDistanceTo(order->goalPos.x, order->goalPos.y) <
|
||||
if (unit.MapDistanceTo(order->goalPos.x, order->goalPos.y) <=
|
||||
unit.Stats->Variables[ATTACKRANGE_INDEX].Max) {
|
||||
err = PF_REACHED;
|
||||
}
|
||||
|
|
|
@ -555,9 +555,7 @@ void HandleActionBuilt(COrder& order, CUnit &unit)
|
|||
// Set to Zero as it's part of a union
|
||||
memset(&unit.CurrentOrder()->Data, 0, sizeof(unit.CurrentOrder()->Data));
|
||||
// Has StartingResources, Use those
|
||||
if (type->StartingResources) {
|
||||
unit.ResourcesHeld = type->StartingResources;
|
||||
}
|
||||
unit.ResourcesHeld = type->StartingResources;
|
||||
}
|
||||
|
||||
unit.Player->Notify(NotifyGreen, unit.tilePos.x, unit.tilePos.y,
|
||||
|
|
|
@ -1073,7 +1073,7 @@ extern CUnit *CanBuildHere(const CUnit *unit, const CUnitType &type, const Vec2i
|
|||
extern bool CanBuildOn(const Vec2i &pos, int mask);
|
||||
/// FIXME: more docu
|
||||
extern CUnit *CanBuildUnitType(const CUnit *unit, const CUnitType &type, const Vec2i &pos, int real);
|
||||
/// Get the suitable animation frame depends of unit's damaged type.
|
||||
/// Get the suitable animation frame depends of unit's damaged type.
|
||||
extern int ExtraDeathIndex(const char *death);
|
||||
|
||||
/// Find resource
|
||||
|
|
|
@ -342,6 +342,9 @@ void CUnit::Init(CUnitType &type)
|
|||
Active = 1;
|
||||
Removed = 1;
|
||||
|
||||
// Has StartingResources, Use those
|
||||
this->ResourcesHeld = type.StartingResources;
|
||||
|
||||
Rs = MyRand() % 100; // used for fancy buildings and others
|
||||
|
||||
Assert(Orders.empty());
|
||||
|
@ -962,14 +965,16 @@ void UnitLost(CUnit &unit)
|
|||
//
|
||||
// Call back to AI, for killed or lost units.
|
||||
//
|
||||
if (player && player->AiEnabled) {
|
||||
AiUnitKilled(unit);
|
||||
} else {
|
||||
//
|
||||
// Remove unit from its groups
|
||||
//
|
||||
if (unit.GroupId) {
|
||||
RemoveUnitFromGroups(unit);
|
||||
if (Editor.Running == EditorNotRunning){
|
||||
if (player && player->AiEnabled) {
|
||||
AiUnitKilled(unit);
|
||||
} else {
|
||||
//
|
||||
// Remove unit from its groups
|
||||
//
|
||||
if (unit.GroupId) {
|
||||
RemoveUnitFromGroups(unit);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2496,7 +2501,7 @@ CUnit *UnitFindResource(const CUnit &unit, const Vec2i &startPos, int range, int
|
|||
// Look if there is a mine
|
||||
//
|
||||
if ((mine = res_finder.Find(Map.Field(pos))) &&
|
||||
mine->Type->CanHarvest &&
|
||||
mine->Type->CanHarvest && mine->ResourcesHeld &&
|
||||
(resinfo.HarvestFromOutside ||
|
||||
mine->Player->Index == PlayerMax - 1 ||
|
||||
mine->Player == unit.Player ||
|
||||
|
|
Loading…
Add table
Reference in a new issue