Skip to content
This repository has been archived by the owner on Apr 17, 2022. It is now read-only.

Shared sensors among allies #636

Closed
wzdev-ci opened this issue Jun 15, 2009 · 11 comments
Closed

Shared sensors among allies #636

wzdev-ci opened this issue Jun 15, 2009 · 11 comments

Comments

@wzdev-ci
Copy link
Contributor

keyword_sensors_teams resolution_fixed type_bug | by Per


This patch adds the ability of allied players to share each others' sensors. For the moment, it only works for structures by structures, but that's just how the sensor code works at the moment and I will try to fix that in a separate patch.

Since iterating over all structures by all players to see if we could use each as a sensor would be rather time consuming, I created a new set of lists (currently with only one member) that sorts objects by function. This way we can very quickly iterate over all sensors, even when there are several hundred buildings on the map. The implementation of this is rather bug prone, since it is not type safe, but it is as good as it gets without a major rewrite or porting to C++, I think.

TODO: New list code needs testing to see if it crashes somewhere in campaign, since that does a lot of funky things to the lists code.


Issue migrated from trac:636 at 2022-04-15 18:54:18 -0700

@wzdev-ci
Copy link
Contributor Author

Per uploaded file sharedsensor.diff (11.9 KiB)

@wzdev-ci
Copy link
Contributor Author

Buginator commented


Will this only be used for locked teams?

Also, if this fails: ASSERT(object != NULL, "Invalid pointer");
We will crash in a release build. Perhaps change that to ASSERT_OR_RETURN?

Oh, and you might want to add a assert check to make sure player is in range?

@wzdev-ci
Copy link
Contributor Author

Per changed status from new to accepted

@wzdev-ci
Copy link
Contributor Author

Per changed owner from `` to Per

@wzdev-ci
Copy link
Contributor Author

Per commented


Why only for locked teams? I'm not sure about changing all asserts to assert_or_return - sometimes the extra conditional is not really worth it, but I'll look into this one.

@wzdev-ci
Copy link
Contributor Author

Per commented


New version of the patch. It fixes a few bugs, and generalizes the code to be utilized also for droids. Currently this support for droids has little effect, however, due to a number of bugs in the action code that I do not want to fix in this patch.

It works the other way, though. You can take a sensor droid for a walk, point at interesting enemy structures, and sit back to watch the archangel missile battery fireworks.

@wzdev-ci
Copy link
Contributor Author

Per uploaded file sharedsensor2b.diff (19.1 KiB)

@wzdev-ci
Copy link
Contributor Author

Per uploaded file sharedsensor2c.diff (19.1 KiB)

Fixed a bug that showed up during mission testing.

@wzdev-ci
Copy link
Contributor Author

Per set resolution to fixed

@wzdev-ci
Copy link
Contributor Author

Per changed status from accepted to closed

@wzdev-ci
Copy link
Contributor Author

Per commented


(In [7765]) Add the ability of allied players to share each others' sensors. Since iterating over all structures
by all players to see if we could use each as a sensor would be rather time consuming, I created a
new set of lists (currently with only one member) that sorts objects by function. This way we can
very quickly iterate over all sensors, even when there are several hundred buildings on the map.
Closes #636.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant