Removed unneeded code.

This commit is contained in:
Felix Ableitner 2013-09-18 16:26:31 +02:00
parent 41b407e611
commit da7b5f2d08
2 changed files with 4 additions and 6 deletions

View file

@ -139,7 +139,6 @@ Game::loop() {
// Respawn player at start position on death.
if (mPlayer->getHealth() <= 0) {
Vector2f pos = mPlayer->getCrosshairPosition();
mWorld.remove(mPlayer);
initPlayer();
mPlayer->setCrosshairPosition(pos);
}

View file

@ -19,7 +19,7 @@
*/
void
World::insert(std::shared_ptr<Sprite> drawable) {
#ifndef NDEBUG
#ifndef RELEASE
Sprite::Category cat = drawable->getCategory();
auto item = std::find(mDrawables[cat].begin(), mDrawables[cat].end(), drawable);
assert(item == mDrawables[cat].end());
@ -33,7 +33,7 @@ World::insert(std::shared_ptr<Sprite> drawable) {
*/
void
World::insertCharacter(std::shared_ptr<Character> character) {
#ifndef NDEBUG
#ifndef RELEASE
auto item = std::find(mCharacters.begin(), mCharacters.end(), character);
assert(item == mCharacters.end());
#endif
@ -52,7 +52,7 @@ World::remove(std::shared_ptr<Sprite> drawable) {
* Returns all characters that are within maxDistance from position.
*/
std::vector<std::shared_ptr<Character> >
World::getCharacters(const Vector2f& position, float maxDistance) const {
World::getCharacters(const Vector2f& position, float maxDistance) const {
std::vector<std::shared_ptr<Character> > visible;
for (const auto& it : mCharacters) {
if (position == it->getPosition())
@ -123,8 +123,7 @@ World::think(int elapsed) {
for (auto it = mCharacters.begin(); it != mCharacters.end(); ) {
if ((*it)->getDelete()) {
mCharacters.erase(it);
auto& d = mDrawables[Sprite::CATEGORY_ACTOR];
d.erase(std::find(d.begin(), d.end(), *it));
remove(*it);
}
else {
(*it)->onThink(elapsed);