Skip to content

Commit

Permalink
Make submap privately inherit from maptile_soa
Browse files Browse the repository at this point in the history
There are still two loose ends on proper encapsulation here. Namely, the
non-const get_field() and get_items(). These need to be replaced with
either the necessary setters or by moving necessary code to submap.
  • Loading branch information
ifreund committed Feb 10, 2020
1 parent d93f263 commit a0f97cd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/submap.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct maptile_soa {
void swap_soa_tile( const point &p, maptile_soa<1, 1> &other );
};

class submap : public maptile_soa<SEEX, SEEY> // TODO: Use private inheritance.
class submap : maptile_soa<SEEX, SEEY>
{
public:
submap();
Expand Down Expand Up @@ -154,6 +154,7 @@ class submap : public maptile_soa<SEEX, SEEY> // TODO: Use private inheritanc
}
}

// TODO: Replace this as it essentially makes itm public
cata::colony<item> &get_items( const point &p ) {
return itm[p.x][p.y];
}
Expand All @@ -162,6 +163,7 @@ class submap : public maptile_soa<SEEX, SEEY> // TODO: Use private inheritanc
return itm[p.x][p.y];
}

// TODO: Replace this as it essentially makes fld public
field &get_field( const point &p ) {
return fld[p.x][p.y];
}
Expand Down

0 comments on commit a0f97cd

Please sign in to comment.