This commit is contained in:
Joris 2012-11-12 11:05:16 +01:00
parent 2f696d5f71
commit acb4a72739
4 changed files with 12 additions and 12 deletions

View file

@ -100,7 +100,7 @@ public:
explicit IsAnAlliedUnitOf(const CPlayer &_player) : player(&_player) {}
bool operator()(const CUnit *unit) const {
return unit->IsVisibleAsGoal(*player) && (unit->Player->Index == player->Index
|| unit->IsAllied(*player));
|| unit->IsAllied(*player));
}
private:
const CPlayer *player;
@ -318,8 +318,8 @@ VisitResult AiForceRallyPointFinder::Visit(TerrainTraversal &terrainTraversal, c
{
if (AiEnemyUnitsInDistance(*startUnit.Player, NULL, pos, 20) == false
&& Distance(pos, startPos) <= abs(distance - 20)) {
*resultPos = pos;
return VisitResult_Finished;
*resultPos = pos;
return VisitResult_Finished;
}
if (CanMoveToMask(pos, movemask)) { // reachable
return VisitResult_Ok;
@ -930,7 +930,7 @@ void AiForceManager::Update()
std::vector<CUnit *> nearGoal;
const Vec2i offset(15, 15);
Select(force.GoalPos - offset, force.GoalPos + offset, nearGoal,
IsAnAlliedUnitOf(*force.Units[0]->Player));
IsAnAlliedUnitOf(*force.Units[0]->Player));
if (nearGoal.empty()) {
force.ReturnToHome();
} else {

View file

@ -217,8 +217,8 @@ static Target *SelectTargetUnitsOfAutoCast(CUnit &caster, const SpellType &spell
for (size_t i = 0; i < table.size(); ++i) {
if (table[i]->IsVisibleAsGoal(*caster.Player) && caster.IsEnemy(*table[i])
&& CanTarget(*caster.Type, *table[i]->Type)) {
inCombat = true;
break;
inCombat = true;
break;
}
}

View file

@ -397,8 +397,8 @@ static int GetButtonStatus(const ButtonAction &button, int UnderCursor)
int i = 0;
int y_off = y;
unsigned int width = this->MaxWidth
? std::min(this->MaxWidth, popupWidth - 2 * popup->MarginX)
: 0;
? std::min(this->MaxWidth, popupWidth - 2 * popup->MarginX)
: 0;
while ((sub = GetLineFont(++i, draw, width, &font)).length()) {
label.Draw(x, y_off, sub);
y_off += font.Height() + 2;
@ -410,7 +410,7 @@ static int GetButtonStatus(const ButtonAction &button, int UnderCursor)
/* virtual */ int CPopupContentTypeText::GetWidth(const ButtonAction &button, int *) const
{
CFont &font = this->Font ? *this->Font : GetSmallFont();
int width = 0;
std::string sub;
if (this->MaxWidth) {
@ -442,8 +442,8 @@ static int GetButtonStatus(const ButtonAction &button, int UnderCursor)
int i = 0;
int y_off = y;
unsigned int width = this->MaxWidth
? std::min(this->MaxWidth, popupWidth - 2 * popup->MarginX)
: 0;
? std::min(this->MaxWidth, popupWidth - 2 * popup->MarginX)
: 0;
while ((sub = GetLineFont(++i, this->Text, width, &font)).length()) {
label.Draw(x, y_off, sub);
y_off += font.Height() + 2;

View file

@ -144,7 +144,7 @@ void CIcon::DrawGrayscaleIcon(const PixelPos &pos) const
SDL_Color colors[256], backup[256];
SDL_Palette &pal = *this->G->Surface->format->palette;
memcpy(backup, pal.colors, sizeof(SDL_Color) * 256);
for(int i = 0; i < 256; ++i){
for (int i = 0; i < 256; ++i) {
int gray = 0.2 * pal.colors[i].r + 0.4 * pal.colors[i].g + 0.12 * pal.colors[i].b;
colors[i].r = colors[i].g = colors[i].b = gray;
}