This commit is contained in:
Joris 2012-08-20 13:13:11 +02:00
parent 5710008df0
commit 5266501f04
19 changed files with 56 additions and 49 deletions

View file

@ -254,7 +254,8 @@ bool AiForce::IsBelongsTo(const CUnitType *type)
return flag;
}
void AiForce::Insert(CUnit &unit) {
void AiForce::Insert(CUnit &unit)
{
Units.Insert(&unit);
unit.RefsIncrease();
}

View file

@ -812,7 +812,7 @@ static void DrawEditorPanel_StartIcon()
Assert(icon);
const PixelPos pos(x + START_ICON_X, y + START_ICON_Y);
int flag = (ButtonUnderCursor == StartButton ? IconActive : 0)
| (Editor.State == EditorSetStartLocation ? IconSelected : 0);
| (Editor.State == EditorSetStartLocation ? IconSelected : 0);
icon->DrawUnitIcon(*UI.SingleSelectedButton->Style, flag, pos, "");
} else {

View file

@ -113,7 +113,7 @@ public:
int printf(const char *format, ...) PRINTF_VAARG_ATTRIBUTE(2, 3); // Don't forget to count this
private:
CFile(const CFile &rhs); // No implementation
const CFile& operator = (const CFile &rhs); // No implementation
const CFile &operator = (const CFile &rhs); // No implementation
private:
class PImpl;
PImpl *pimpl;

View file

@ -191,7 +191,8 @@ void SelectFixed(const Vec2i &ltPos, const Vec2i &rbPos, std::vector<CUnit *> &u
void SelectAroundUnit(const CUnit &unit, int range, std::vector<CUnit *> &around);
template <typename Pred>
void SelectFixed(const Vec2i &ltPos, const Vec2i &rbPos, std::vector<CUnit *> &units, Pred pred) {
void SelectFixed(const Vec2i &ltPos, const Vec2i &rbPos, std::vector<CUnit *> &units, Pred pred)
{
Assert(Map.Info.IsPointOnMap(ltPos));
Assert(Map.Info.IsPointOnMap(rbPos));
Assert(units.empty());
@ -217,7 +218,8 @@ void SelectFixed(const Vec2i &ltPos, const Vec2i &rbPos, std::vector<CUnit *> &u
}
template <typename Pred>
void SelectAroundUnit(const CUnit &unit, int range, std::vector<CUnit *> &around, Pred pred) {
void SelectAroundUnit(const CUnit &unit, int range, std::vector<CUnit *> &around, Pred pred)
{
const Vec2i offset(range, range);
const Vec2i typeSize(unit.Type->TileWidth - 1, unit.Type->TileHeight - 1);
@ -227,7 +229,8 @@ void SelectAroundUnit(const CUnit &unit, int range, std::vector<CUnit *> &around
}
template <typename Pred>
void Select(const Vec2i &ltPos, const Vec2i &rbPos, std::vector<CUnit *> &units, Pred pred) {
void Select(const Vec2i &ltPos, const Vec2i &rbPos, std::vector<CUnit *> &units, Pred pred)
{
Vec2i minPos = ltPos;
Vec2i maxPos = rbPos;
@ -236,7 +239,8 @@ void Select(const Vec2i &ltPos, const Vec2i &rbPos, std::vector<CUnit *> &units,
}
template <typename Pred>
CUnit *FindUnit_IfFixed(const Vec2i &ltPos, const Vec2i &rbPos, Pred pred) {
CUnit *FindUnit_IfFixed(const Vec2i &ltPos, const Vec2i &rbPos, Pred pred)
{
Assert(Map.Info.IsPointOnMap(ltPos));
Assert(Map.Info.IsPointOnMap(rbPos));
@ -255,7 +259,8 @@ CUnit *FindUnit_IfFixed(const Vec2i &ltPos, const Vec2i &rbPos, Pred pred) {
}
template <typename Pred>
CUnit *FindUnit_If(const Vec2i &ltPos, const Vec2i &rbPos, Pred pred) {
CUnit *FindUnit_If(const Vec2i &ltPos, const Vec2i &rbPos, Pred pred)
{
Vec2i minPos = ltPos;
Vec2i maxPos = rbPos;

View file

@ -32,11 +32,11 @@
//@{
#ifndef __unix
#undef NOUSER
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif
#ifndef __unix
#undef NOUSER
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif
#endif
/*----------------------------------------------------------------------------

View file

@ -642,7 +642,7 @@ void MissileHandlePierce(Missile &missile, const Vec2i &pos)
CUnit *unit = UnitOnMapTile(pos, -1);
if (unit && unit->IsAliveOnMap()
&& (missile.Type->FriendlyFire || unit->IsEnemy(*missile.SourceUnit->Player))) {
missile.MissileHit(unit);
missile.MissileHit(unit);
}
}
@ -753,11 +753,11 @@ void Missile::MissileHit(CUnit *unit)
if (mtype.Pierce && mtype.PierceOnce) {
for (std::vector<CUnit *>::iterator it = this->PiercedUnits.begin();
it != this->PiercedUnits.end(); ++it) {
CUnit &punit = **it;
if (UnitNumber(*unit) == UnitNumber(punit)) {
return;
}
it != this->PiercedUnits.end(); ++it) {
CUnit &punit = **it;
if (UnitNumber(*unit) == UnitNumber(punit)) {
return;
}
}
PiercedUnits.insert(this->PiercedUnits.begin(), unit);
}
@ -1170,7 +1170,8 @@ void InitMissiles()
/**
** Missile destructior.
*/
Missile::~Missile() {
Missile::~Missile()
{
PiercedUnits.clear();
}

View file

@ -288,7 +288,7 @@ int NetSocketAddr(const Socket sock)
char *cplim = buf + ifc.ifc_len; // skip over if's with big ifr_addr's
for (char *cp = buf; cp < cplim;
cp += sizeof(ifr->ifr_name) + sizeof(ifr->ifr_ifru)) {
cp += sizeof(ifr->ifr_name) + sizeof(ifr->ifr_ifru)) {
ifr = (struct ifreq *)cp;
struct ifreq ifreq = *ifr;
if (ioctl(sock, SIOCGIFFLAGS, (char *)&ifreq) < 0) {

View file

@ -154,5 +154,5 @@
return 1;
}
//@}
//@}

View file

@ -144,5 +144,5 @@
}
return 0;
}
//@}
//@}

View file

@ -58,7 +58,7 @@
}
}
}
/**
** Cast Area Adjust Vital on all valid units in range.
**
@ -104,5 +104,5 @@
}
return 0;
}
//@}
//@}

View file

@ -135,5 +135,5 @@
}
return 1;
}
//@}
//@}

View file

@ -120,5 +120,5 @@
UnitClearOrders(*target);
return 0;
}
//@}
//@}

View file

@ -118,5 +118,5 @@
}
//@}
//@}

View file

@ -132,5 +132,5 @@
target->Release();
return 1;
}
//@}
//@}

View file

@ -205,5 +205,5 @@ static void EvaluateMissileLocation(const SpellActionMissileLocation &location,
return 1;
}
//@}
//@}

View file

@ -91,5 +91,5 @@
}
//@}
//@}

View file

@ -142,5 +142,5 @@ public:
}
return 0;
}
//@}
//@}

View file

@ -69,8 +69,8 @@ public:
int write(const void *buf, size_t len);
private:
PImpl(const PImpl&rhs); // No implementation
const PImpl& operator = (const PImpl &rhs); // No implementation
PImpl(const PImpl &rhs); // No implementation
const PImpl &operator = (const PImpl &rhs); // No implementation
private:
int cl_type; /// type of CFile

View file

@ -730,8 +730,8 @@ static void DrawUnitInfo(CUnit &unit)
const COrder_UpgradeTo &order = *static_cast<COrder_UpgradeTo *>(unit.CurrentOrder());
CIcon &icon = *order.GetUnitType().Icon.Icon;
unsigned int flag = (ButtonAreaUnderCursor == ButtonAreaUpgrading
&& ButtonUnderCursor == 0) ?
(IconActive | (MouseButtons & LeftButton)) : 0;
&& ButtonUnderCursor == 0) ?
(IconActive | (MouseButtons & LeftButton)) : 0;
const PixelPos pos(UI.UpgradingButton->X, UI.UpgradingButton->Y);
icon.DrawUnitIcon(*UI.UpgradingButton->Style, flag, pos, "");
}
@ -742,8 +742,8 @@ static void DrawUnitInfo(CUnit &unit)
COrder_Research &order = *static_cast<COrder_Research *>(unit.CurrentOrder());
CIcon &icon = *order.GetUpgrade().Icon;
int flag = (ButtonAreaUnderCursor == ButtonAreaResearching
&& ButtonUnderCursor == 0) ?
(IconActive | (MouseButtons & LeftButton)) : 0;
&& ButtonUnderCursor == 0) ?
(IconActive | (MouseButtons & LeftButton)) : 0;
PixelPos pos(UI.ResearchingButton->X, UI.ResearchingButton->Y);
icon.DrawUnitIcon(*UI.ResearchingButton->Style, flag, pos, "");
}
@ -765,7 +765,7 @@ static void DrawUnitInfo(CUnit &unit)
if (uins->Boarded && j < UI.TransportingButtons.size()) {
CIcon &icon = *uins->Type->Icon.Icon;
int flag = (ButtonAreaUnderCursor == ButtonAreaTransporting && static_cast<size_t>(ButtonUnderCursor) == j) ?
(IconActive | (MouseButtons & LeftButton)) : 0;
(IconActive | (MouseButtons & LeftButton)) : 0;
const PixelPos pos(UI.TransportingButtons[j].X, UI.TransportingButtons[j].Y);
icon.DrawUnitIcon(*UI.TransportingButtons[j].Style, flag, pos, "");
UiDrawLifeBar(*uins, pos.x, pos.y);