Skip to content

Commit 69fe1db

Browse files
committed
G++ error and warning fix.
1 parent 78ff265 commit 69fe1db

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

EntityFu.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
///
66

77
#include "EntityFu.h"
8+
#include <algorithm>
89
using namespace std;
910

1011
/// Turn this on to have a faster yet riskier ECS.
@@ -136,7 +137,7 @@ void Entity::addComponent(Cid cid, Eid eid, Component* c)
136137
}
137138
if (verbosity > 0)
138139
{
139-
Log("");
140+
Log(" ");
140141
Entity::log(cid);
141142
Log("Adding component cid %u eid %u (%x)", cid, eid, (int)(long)c);
142143
}
@@ -171,7 +172,7 @@ void Entity::removeComponent(Cid cid, Eid eid)
171172

172173
if (verbosity > 1)
173174
{
174-
Log("");
175+
Log(" ");
175176
Entity::log(cid);
176177
Log("Removing component cid %u eid %u (%x)", cid, eid, (int)(long)ptr);
177178
}
@@ -217,7 +218,7 @@ const vector<Eid>& Entity::getAll(Cid cid)
217218
unsigned Entity::count()
218219
{
219220
int ret = 0;
220-
if(entities != nullptr)
221+
if (entities != nullptr)
221222
{
222223
for (Eid eid = 1; eid < kMaxEntities; ++eid)
223224
if (entities[eid])
@@ -226,14 +227,14 @@ unsigned Entity::count()
226227
return ret;
227228
}
228229

229-
bool Entity::exists(Eid eid)
230+
unsigned Entity::count(Cid cid)
230231
{
231-
return entities != nullptr && entities[eid];
232+
return (unsigned)Entity::getAll(cid).size();
232233
}
233234

234-
unsigned Entity::count(Cid cid)
235+
bool Entity::exists(Eid eid)
235236
{
236-
return (unsigned)Entity::getAll(cid).size();
237+
return entities != nullptr && entities[eid];
237238
}
238239

239240
void Entity::log(Cid cid)

EntityFu.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ class Entity
3232

3333
/// Return a count of all entities.
3434
static unsigned count();
35-
36-
/// Check if the entity was already created
35+
36+
/// Return true if the entity has been created.
3737
static bool exists(Eid eid);
3838

3939
/// Destroy an entity and all its components right now.

0 commit comments

Comments
 (0)