mirror of https://github.com/OpenTTD/OpenTTD
(svn r13733) -Fix (r13731): gcc2.95 compilation
parent
5f280d0e50
commit
f2da045731
|
@ -17,7 +17,7 @@ template<typename T, typename Tid, OldMemoryPool<T> *Tpool> T *PoolItem<T, Tid,
|
||||||
{
|
{
|
||||||
uint last_minus_one = Tpool->GetSize() - 1;
|
uint last_minus_one = Tpool->GetSize() - 1;
|
||||||
|
|
||||||
for (T *t = Tpool->Get(first); t != NULL; t = (t->index < last_minus_one) ? Tpool->Get(t->index + 1U) : NULL) {
|
for (T *t = Tpool->Get(first); t != NULL; t = ((uint)t->index < last_minus_one) ? Tpool->Get(t->index + 1U) : NULL) {
|
||||||
if (!t->IsValid()) {
|
if (!t->IsValid()) {
|
||||||
first = t->index;
|
first = t->index;
|
||||||
Tid index = t->index;
|
Tid index = t->index;
|
||||||
|
@ -44,7 +44,7 @@ template<typename T, typename Tid, OldMemoryPool<T> *Tpool> bool PoolItem<T, Tid
|
||||||
{
|
{
|
||||||
uint last_minus_one = Tpool->GetSize() - 1;
|
uint last_minus_one = Tpool->GetSize() - 1;
|
||||||
|
|
||||||
for (T *t = Tpool->Get(Tpool->first_free_index); t != NULL; t = (t->index < last_minus_one) ? Tpool->Get(t->index + 1U) : NULL) {
|
for (T *t = Tpool->Get(Tpool->first_free_index); t != NULL; t = ((uint)t->index < last_minus_one) ? Tpool->Get(t->index + 1U) : NULL) {
|
||||||
if (!t->IsValid()) return true;
|
if (!t->IsValid()) return true;
|
||||||
Tpool->first_free_index = t->index;
|
Tpool->first_free_index = t->index;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,11 +80,9 @@ struct Player : PoolItem<Player, PlayerByte, &_Player_pool> {
|
||||||
inline bool IsValid() const { return this->name_1 != 0; }
|
inline bool IsValid() const { return this->name_1 != 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool operator < (PlayerID p, uint u) {return (uint)p < u;}
|
|
||||||
|
|
||||||
static inline bool IsValidPlayerID(PlayerID index)
|
static inline bool IsValidPlayerID(PlayerID index)
|
||||||
{
|
{
|
||||||
return index < GetPlayerPoolSize() && GetPlayer(index)->IsValid();
|
return (uint)index < GetPlayerPoolSize() && GetPlayer(index)->IsValid();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FOR_ALL_PLAYERS_FROM(d, start) for (d = GetPlayer(start); d != NULL; d = (d->index + 1U < GetPlayerPoolSize()) ? GetPlayer(d->index + 1U) : NULL) if (d->IsValid())
|
#define FOR_ALL_PLAYERS_FROM(d, start) for (d = GetPlayer(start); d != NULL; d = (d->index + 1U < GetPlayerPoolSize()) ? GetPlayer(d->index + 1U) : NULL) if (d->IsValid())
|
||||||
|
|
Loading…
Reference in New Issue