1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Change many useless std::list into Environment class (m_players), ABMHandler and ActiveBlockList::update

This improve looping performances.
This commit is contained in:
Loic Blot 2015-02-17 16:49:27 +01:00
parent 81b9c023c4
commit 2079462e62
2 changed files with 54 additions and 70 deletions

View file

@ -75,8 +75,8 @@ public:
Player * getPlayer(const char *name);
Player * getRandomConnectedPlayer();
Player * getNearestConnectedPlayer(v3f pos);
std::list<Player*> getPlayers();
std::list<Player*> getPlayers(bool ignore_disconnected);
std::vector<Player*> getPlayers();
std::vector<Player*> getPlayers(bool ignore_disconnected);
u32 getDayNightRatio();
@ -110,7 +110,7 @@ public:
protected:
// peer_ids in here should be unique, except that there may be many 0s
std::list<Player*> m_players;
std::vector<Player*> m_players;
// Time of day in milli-hours (0-23999); determines day and night
u32 m_time_of_day;
// Time of day in 0...1
@ -182,7 +182,7 @@ struct ABMWithState
class ActiveBlockList
{
public:
void update(std::list<v3s16> &active_positions,
void update(std::vector<v3s16> &active_positions,
s16 radius,
std::set<v3s16> &blocks_removed,
std::set<v3s16> &blocks_added);