cocos2d/cocos2d-x — pull request #2210 by DarraghCoy (2013-03-19 18:11:08+00:00)
Title: Add ability to get the number of scenes in the CCDirector stack.

Make a change to Cocos2dx to allow us to reliably remove all scenes on the CCDirector stack except for the root scene. Provide an accessor which returns the current number of scenes in the CCDirector scene stack. We need to know whether or not there is only a root scene (1 scene present) in the stack in other to be able to reliably remove all scenes except the root. Performing the popToRootScene() operation while there is only a root scene present will remove the root and cause the CCDirector to be purged- an event which client code probably wants to avoid in most cases. This change is intended to allow switch over reliably to a completely new scene stack (clearing the old) by allowing client code to pop all scenes except the root, and replace the old root with the new root desired.