Use fewer pointers refactor: get rid of visible_world_ in drivenengine. The world is now fully owned by the drivenengine.

This commit is contained in:
2026-02-21 19:27:42 -05:00
parent 48b7bf37da
commit 00ef81bf0d
4 changed files with 47 additions and 63 deletions

View File

@@ -161,10 +161,6 @@ SharedChannel DrivenEngine::new_incoming_channel() {
}
}
void DrivenEngine::set_visible_world_and_actor(World *w, int64_t id) {
visible_world_ = w;
visible_actor_id_ = id;
}
void DrivenEngine::stop_driver() {
stop_driver_ = true;
@@ -176,11 +172,6 @@ void DrivenEngine::stop_driver() {
}
DrivenEngine::DrivenEngine() {
next_unused_chid_ = 1;
rescan_lua_source_ = false;
clock_ = 0.0;
have_prints_ = false;
stop_driver_ = false;
}
DrivenEngine::~DrivenEngine() {}
@@ -377,20 +368,20 @@ bool DrivenEngine::drv_get_stop_driver() const {
}
int64_t DrivenEngine::drv_get_actor_id() const {
return visible_actor_id_;
return actor_id_;
}
void DrivenEngine::drv_get_tangibles_near(int64_t tanid, double rx, double ry, double rz, uint32_t *count, int64_t **ids) {
uint32_t hash1 = eng::memhash();
scan_result_.clear();
if ((visible_world_ != 0) && (tanid != 0)) {
if (world_ && (tanid != 0)) {
PlaneScan scan;
scan.set_near(tanid, true);
scan.set_omit_nowhere(true);
scan.set_sorted(false);
scan.set_radius(util::XYZ(rx, ry, rz));
scan.set_shape(PlaneScan::CYLINDER);
visible_world_->get_near(scan, &scan_result_);
world_->get_near(scan, &scan_result_);
}
*count = scan_result_.size();
if (*count > 0) {
@@ -405,12 +396,12 @@ void DrivenEngine::drv_get_tangibles_near(int64_t tanid, double rx, double ry, d
void DrivenEngine::drv_get_animation_queues(uint32_t count, const int64_t *ids, uint32_t *lengths, const char **strings) {
anim_queues_.resize(count);
if (visible_world_ == nullptr) {
if (!world_) {
for (int i = 0; i < int(count); i++) {
anim_queues_[i] = AnimQueue::get_encoded_blank_queue();
}
} else {
visible_world_->get_encoded_animation_queues(count, ids, anim_queues_);
world_->get_encoded_animation_queues(count, ids, anim_queues_);
}
for (int i = 0; i < int(count); i++) {
lengths[i] = anim_queues_[i]->size();