Skip to content

Commit

Permalink
Misc. fixes from my local:
Browse files Browse the repository at this point in the history
Fix read-past-end in advanced inventory when using pagedown.
Fix iterator misuse in edit_fld().
Change wrong documentation in field.h.
Add comment from local.
  • Loading branch information
bdragon28 committed Apr 21, 2014
1 parent de20145 commit 3bbf877
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/advanced_inv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ void advanced_inventory::display(player *pp)
}

int list_pos = panes[src].index + (panes[src].page * itemsPerPage);
int item_pos = panes[src].size > 0 ? panes[src].items[list_pos].idx : 0;
int item_pos = panes[src].size > list_pos ? panes[src].items[list_pos].idx : 0;

int changex = -1;
int changey = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/editmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1051,10 +1051,10 @@ int editmap::edit_fld()
field *t_field = &g->m.field_at(target_list[t].x, target_list[t].y);
if ( t_field->fieldCount() > 0 ) {
for ( std::map<field_id, field_entry *>::iterator field_list_it = t_field->getFieldStart();
field_list_it != t_field->getFieldEnd(); ++field_list_it
field_list_it != t_field->getFieldEnd(); /* noop */
) {
field_id rmid = field_list_it->first;
t_field->removeField( rmid );
field_list_it = t_field->removeField( rmid );
if ( target_list[t].x == target.x && target_list[t].y == target.y ) {
update_fmenu_entry( &fmenu, t_field, (int)rmid );
}
Expand Down
2 changes: 1 addition & 1 deletion src/field.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class field{
//Density defaults to 1, and age to 0 (permanent) if not specified.
bool addField(const field_id field_to_add,const unsigned char new_density=1, const int new_age=0);

//Removes the field entry with a type equal to the field_id parameter. Returns true if removed, false otherwise.
//Removes the field entry with a type equal to the field_id parameter. Returns the next iterator.
std::map<field_id, field_entry*>::iterator removeField(const field_id field_to_remove);

//Returns the number of fields existing on the current tile.
Expand Down
1 change: 1 addition & 0 deletions src/melee.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ int player::hit_roll()
void player::melee_attack(Creature &t, bool allow_special, matec_id force_technique) {
bool is_u = (this == &(g->u)); // Affects how we'll display messages
if (!t.is_player()) {
// @todo Per-NPC tracking? Right now monster hit by either npc or player will draw aggro...
t.add_effect("hit_by_player", 100); // Flag as attacked by us for AI
}

Expand Down

0 comments on commit 3bbf877

Please sign in to comment.