Fix constness in certain operations

This commit is contained in:
2021-07-26 13:12:44 -04:00
parent 4052503093
commit 49484cf2f0
7 changed files with 95 additions and 54 deletions

View File

@@ -68,7 +68,7 @@ public:
// Get the ID
//
int64_t id() { return plane_item_.id(); }
int64_t id() const { return plane_item_.id(); }
void update_plane_item();
bool is_an_actor() { return (id_player_pool_.get_fifo_capacity() > 0); }
@@ -78,7 +78,7 @@ public:
class World {
public:
using IdVector = util::IdVector;
using TangibleVector = std::vector<Tangible*>;
using TanVector = std::vector<const Tangible*>;
using Redirects = std::map<int64_t, int64_t>;
// Constructor.
@@ -107,7 +107,7 @@ public:
// Get a list of the tangibles that are near the player. If 'exclude_nowhere' is
// true, exclude any tangibles on the nowhere plane.
//
IdVector get_near(int64_t player_id, float radius, bool exclude_nowhere);
IdVector get_near(int64_t player_id, float radius, bool exclude_nowhere) const;
// Make a tangible.
//
@@ -120,10 +120,7 @@ public:
// Get a pointer to the specified tangible.
//
Tangible *tangible_get(int64_t id);
// Get pointers to many tangibles.
//
TangibleVector tangible_get_all(const IdVector &ids);
const Tangible *tangible_get(int64_t id) const;
// Get a pointer to the specified tangible.
//
@@ -131,6 +128,10 @@ public:
// a lua error is generated.
//
Tangible *tangible_get(lua_State *L, int idx);
// Get pointers to many tangibles.
//
TanVector tangible_get_all(const IdVector &ids) const;
// Delete the specified tangible.
//
@@ -182,7 +183,7 @@ public:
// so that they can be sent to the client. It also applies the diffs
// to this model.
//
void difference_transmit(int64_t actor, World *master, StreamBuffer *sb);
void difference_transmit(int64_t actor, const World *master, StreamBuffer *sb);
// Apply differences.
//
@@ -213,7 +214,7 @@ private:
// Before we do anything else, we need to get the actor in the right place.
// We also update the actor's ID allocation pipeline.
//
void diff_actor_essentials(int64_t actor_id, World *master, StreamBuffer *sb);
static void diff_actor_essentials(const Tangible *mactor, const Tangible *sactor, StreamBuffer *sb);
void patch_actor_essentials(StreamBuffer *sb);
// Pass 2 of difference transmission: visible animations.
@@ -221,7 +222,7 @@ private:
// Synchronizes the animation status of every tangible inside the visibility
// radius of either model. Creates missing tangibles and deletes excess tangibles.
//
void diff_visible_animations(int64_t actor_id, World *master, StreamBuffer *sb);
static void diff_visible_animations(const TanVector &mvis, const TanVector &svis, StreamBuffer *sb);
void patch_visible_animations(StreamBuffer *sb);
private: