MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / SendMessageToAllObjects

Method SendMessageToAllObjects

Source/Main/scenegraph.cpp:1625–1638  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1623}
1624
1625void SceneGraph::SendMessageToAllObjects(OBJECT_MSG::Type type) {
1626 // This is a simple loop instead of an iterator because sometimes this would crash as an iterator after
1627 // passing way past the end. Likely because objects_ is sometimes changed as a result of this call.
1628 // This solution means that most objects get called, some might not if they are first destroyed.
1629 // New objects will also be called assuming they are added last to the list.
1630 for (unsigned int i = 0; i < objects_.size(); i++) {
1631 Object* obj = objects_[i];
1632 if (obj) {
1633 obj->ReceiveObjectMessage(type);
1634 } else {
1635 LOGE << "One of the objects is NULL when trying to SendMessageToAllObjects." << std::endl;
1636 }
1637 }
1638}
1639
1640void SceneGraph::SendScriptMessageToAllObjects(std::string& msg) {
1641 // For consistency, I'm going to also make this a simple loop in case the same iterator problems affect

Callers 5

LiveUpdateFunction · 0.80
LoadLevelMethod · 0.80
DrawMethod · 0.80
UpdateGPUSkinningMethod · 0.80

Calls 2

sizeMethod · 0.45
ReceiveObjectMessageMethod · 0.45

Tested by

no test coverage detected