Skip to content

Commit

Permalink
Remove a few more redundant itype checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevingranade committed May 11, 2014
1 parent b80b77c commit 4fb57fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
9 changes: 3 additions & 6 deletions src/cata_tiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "json.h"
#include "path_info.h"
#include "monstergenerator.h"
#include "item_factory.h"
#include <fstream>

#include "SDL2/SDL_image.h"
Expand Down Expand Up @@ -657,11 +656,9 @@ bool cata_tiles::draw_from_id_string(const std::string &id, TILE_CATEGORY catego
col = t->color;
}
} else if (category == C_ITEM) {
if (item_controller->has_template(id)) {
const itype *i = item_controller->find_template(id);
sym = i->sym;
col = i->color;
}
const itype *i = item_controller->find_template(id);
sym = i->sym;
col = i->color;
}
// Special cases for walls
switch(sym) {
Expand Down
7 changes: 1 addition & 6 deletions src/mondeath.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "item_factory.h"
#include "mondeath.h"
#include "monster.h"
#include "game.h"
Expand Down Expand Up @@ -433,11 +432,7 @@ void mdeath::broken(monster *z) {
}
// make "broken_manhack", or "broken_eyebot", ...
item_id.insert(0, "broken_");
if (item_controller->has_template(item_id)) {
g->m.spawn_item(z->posx(), z->posy(), item_id, 1, 0, calendar::turn);
} else {
debugmsg("Tried to create a broken %s but %s does not exist.", z->type->name.c_str(), item_id.c_str());
}
g->m.spawn_item(z->posx(), z->posy(), item_id, 1, 0, calendar::turn);
}

void mdeath::ratking(monster *z) {
Expand Down

0 comments on commit 4fb57fa

Please sign in to comment.