Empty-string anim queues are now allowed

This commit is contained in:
2026-02-25 02:54:54 -05:00
parent 4b81a0768a
commit 95cd378dc0
6 changed files with 34 additions and 51 deletions

View File

@@ -12,13 +12,6 @@
#include <cstdlib>
util::SharedStdString AnimQueue::blankqueue_;
void AnimQueue::initialize_module() {
AnimQueue queue;
blankqueue_ = queue.get_encoded_queue();
}
static int64_t hash_encstep(int64_t prev, std::string_view s) {
// We drop the most significant bit to ensure that the value
// can be represented as a nonnegative int64.

View File

@@ -364,17 +364,6 @@ public:
//
util::SharedStdString get_encoded_queue() const { return encqueue_; }
// Get a serialized representation of a blank queue.
//
// Since an animqueue must have at least one step, the blank queue
// contains a single default step.
//
static util::SharedStdString get_encoded_blank_queue() { return blankqueue_; }
// Initialize the animqueue module.
//
static void initialize_module();
private:
struct QueueRange {
int size;
@@ -425,9 +414,6 @@ private:
//
util::SharedStdString encqueue_;
// The blank animation queue.
//
static util::SharedStdString blankqueue_;
};

View File

@@ -852,10 +852,9 @@ static void default_get_tangibles_near(EngineWrapper *, uint64_t, double, double
}
static void default_get_animation_queues(EngineWrapper *, uint32_t count, const int64_t *, uint32_t *lengths, const char **strings) {
util::SharedStdString blank = AnimQueue::get_encoded_blank_queue();
for (int i = 0; i < int(count); i++) {
lengths[i] = blank->size();
strings[i] = blank->c_str();
lengths[i] = 0;
strings[i] = "";
}
}

View File

@@ -1264,7 +1264,6 @@ void World::rollback() {
//
void engine_initialization() {
SourceDB::register_lua_builtins();
AnimQueue::initialize_module();
}
static DrivenEngineInitializerReg eireg(engine_initialization);
@@ -1280,12 +1279,14 @@ void World::get_animation_queues(uint32_t count, const int64_t *ids, uint32_t *l
for (int i = 0; i < int(count); i++) {
Tangible *tan = tangible_get(ids[i]);
if (tan == nullptr) {
wrapper_anim_queues_[i] = AnimQueue::get_encoded_blank_queue();
wrapper_anim_queues_[i] = nullptr;
lengths[i] = 0;
strings[i] = "";
} else {
wrapper_anim_queues_[i] = tan->anim_queue_.get_encoded_queue();
lengths[i] = wrapper_anim_queues_[i]->size();
strings[i] = wrapper_anim_queues_[i]->c_str();
}
lengths[i] = wrapper_anim_queues_[i]->size();
strings[i] = wrapper_anim_queues_[i]->c_str();
}
}