More work on debug_string
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
// equal to the version number in the master model, then the two animqueues are
|
||||
// guaranteed to be equal. Here's how we achieve that invariant:
|
||||
//
|
||||
// * In the master model, the version number starts at 1 and is incremented
|
||||
// * In the master model, the version number starts at 1 and is auto-incremented
|
||||
// every time the animation queue is mutated.
|
||||
//
|
||||
// * In the synchronous model, the version number is set to zero every time the
|
||||
@@ -38,7 +38,7 @@
|
||||
// * The routine 'update_version' should be called after difference
|
||||
// transmission. This copies the version number from the master to the
|
||||
// synchronous model. This is guaranteed to be safe because we just finished
|
||||
// difference transmission, therefore, the animatio queues should match.
|
||||
// difference transmission, therefore, the queues should match.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -67,22 +67,8 @@ public:
|
||||
HAS_GRAPHIC = 16,
|
||||
HAS_PLANE = 32,
|
||||
HAS_EVERYTHING = 63,
|
||||
};
|
||||
};
|
||||
|
||||
private:
|
||||
int64_t id_;
|
||||
int16_t bits_;
|
||||
std::string action_;
|
||||
|
||||
float facing_;
|
||||
util::XYZ xyz_;
|
||||
std::string graphic_;
|
||||
std::string plane_;
|
||||
|
||||
void from_lua_store_string(lua_State *L, int idx, std::string *target, int16_t bits, const char *name);
|
||||
void from_lua_store_number(lua_State *L, int idx, float *target, float offset, int16_t bits, const char *name);
|
||||
|
||||
public:
|
||||
AnimStep();
|
||||
~AnimStep();
|
||||
|
||||
@@ -162,22 +148,27 @@ public:
|
||||
|
||||
// Convert a string to an animstep (for testing only).
|
||||
bool from_string(const std::string &s);
|
||||
|
||||
private:
|
||||
int64_t id_;
|
||||
int16_t bits_;
|
||||
std::string action_;
|
||||
|
||||
float facing_;
|
||||
util::XYZ xyz_;
|
||||
std::string graphic_;
|
||||
std::string plane_;
|
||||
|
||||
void from_lua_store_string(lua_State *L, int idx, std::string *target, int16_t bits, const char *name);
|
||||
void from_lua_store_number(lua_State *L, int idx, float *target, float offset, int16_t bits, const char *name);
|
||||
};
|
||||
|
||||
|
||||
class AnimQueue {
|
||||
private:
|
||||
util::WorldType world_type_;
|
||||
int32_t size_limit_;
|
||||
std::deque<AnimStep> steps_;
|
||||
int64_t version_number_;
|
||||
|
||||
// Called whenever the animation queue is mutated.
|
||||
// serialization and deserialization
|
||||
void mutated();
|
||||
public:
|
||||
public:
|
||||
// World type determines whether versions increment or autozero
|
||||
AnimQueue(util::WorldType wt);
|
||||
|
||||
|
||||
// Simple getters.
|
||||
const AnimStep &nth(int n) const { return steps_[n]; }
|
||||
size_t size() const { return steps_.size(); }
|
||||
@@ -187,11 +178,6 @@ public:
|
||||
// Return true if the size limit and steps are identical.
|
||||
bool size_and_steps_equal(const AnimQueue &aq) const;
|
||||
|
||||
// Clear the steps. Doesn't affect size_limit.
|
||||
// The resulting steps aren't empty. There will be one
|
||||
// step in the queue, which will be on the plane "", at (0,0,0).
|
||||
void clear_steps();
|
||||
|
||||
// Mutator to create a new step.
|
||||
void add(int64_t id, const AnimStep &step);
|
||||
|
||||
@@ -216,6 +202,16 @@ public:
|
||||
|
||||
// Convert to a string for debugging purposes.
|
||||
std::string debug_string() const;
|
||||
|
||||
private:
|
||||
bool version_autoinc_;
|
||||
int32_t size_limit_;
|
||||
std::deque<AnimStep> steps_;
|
||||
int64_t version_number_;
|
||||
|
||||
// Called whenever the animation queue is mutated.
|
||||
// serialization and deserialization
|
||||
void mutated();
|
||||
};
|
||||
|
||||
#endif // ANIMQUEUE_HPP
|
||||
|
||||
Reference in New Issue
Block a user