Removed unneeded code.
This commit is contained in:
parent
41b407e611
commit
da7b5f2d08
2 changed files with 4 additions and 6 deletions
|
@ -139,7 +139,6 @@ Game::loop() {
|
||||||
// Respawn player at start position on death.
|
// Respawn player at start position on death.
|
||||||
if (mPlayer->getHealth() <= 0) {
|
if (mPlayer->getHealth() <= 0) {
|
||||||
Vector2f pos = mPlayer->getCrosshairPosition();
|
Vector2f pos = mPlayer->getCrosshairPosition();
|
||||||
mWorld.remove(mPlayer);
|
|
||||||
initPlayer();
|
initPlayer();
|
||||||
mPlayer->setCrosshairPosition(pos);
|
mPlayer->setCrosshairPosition(pos);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
World::insert(std::shared_ptr<Sprite> drawable) {
|
World::insert(std::shared_ptr<Sprite> drawable) {
|
||||||
#ifndef NDEBUG
|
#ifndef RELEASE
|
||||||
Sprite::Category cat = drawable->getCategory();
|
Sprite::Category cat = drawable->getCategory();
|
||||||
auto item = std::find(mDrawables[cat].begin(), mDrawables[cat].end(), drawable);
|
auto item = std::find(mDrawables[cat].begin(), mDrawables[cat].end(), drawable);
|
||||||
assert(item == mDrawables[cat].end());
|
assert(item == mDrawables[cat].end());
|
||||||
|
@ -33,7 +33,7 @@ World::insert(std::shared_ptr<Sprite> drawable) {
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
World::insertCharacter(std::shared_ptr<Character> character) {
|
World::insertCharacter(std::shared_ptr<Character> character) {
|
||||||
#ifndef NDEBUG
|
#ifndef RELEASE
|
||||||
auto item = std::find(mCharacters.begin(), mCharacters.end(), character);
|
auto item = std::find(mCharacters.begin(), mCharacters.end(), character);
|
||||||
assert(item == mCharacters.end());
|
assert(item == mCharacters.end());
|
||||||
#endif
|
#endif
|
||||||
|
@ -52,7 +52,7 @@ World::remove(std::shared_ptr<Sprite> drawable) {
|
||||||
* Returns all characters that are within maxDistance from position.
|
* Returns all characters that are within maxDistance from position.
|
||||||
*/
|
*/
|
||||||
std::vector<std::shared_ptr<Character> >
|
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;
|
std::vector<std::shared_ptr<Character> > visible;
|
||||||
for (const auto& it : mCharacters) {
|
for (const auto& it : mCharacters) {
|
||||||
if (position == it->getPosition())
|
if (position == it->getPosition())
|
||||||
|
@ -123,8 +123,7 @@ World::think(int elapsed) {
|
||||||
for (auto it = mCharacters.begin(); it != mCharacters.end(); ) {
|
for (auto it = mCharacters.begin(); it != mCharacters.end(); ) {
|
||||||
if ((*it)->getDelete()) {
|
if ((*it)->getDelete()) {
|
||||||
mCharacters.erase(it);
|
mCharacters.erase(it);
|
||||||
auto& d = mDrawables[Sprite::CATEGORY_ACTOR];
|
remove(*it);
|
||||||
d.erase(std::find(d.begin(), d.end(), *it));
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
(*it)->onThink(elapsed);
|
(*it)->onThink(elapsed);
|
||||||
|
|
Reference in a new issue