diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2014-03-30 23:14:12 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2014-03-31 10:18:49 -0700 |
commit | 1a651243bb2c8e18baa9aac30ac52a62185074e7 (patch) | |
tree | dd2c0bfc448faef129fb64edec9f64d2ab12bfe5 /src/map/map.hpp | |
parent | 769e8ac9c17779a15492d7fcfc1931c014670c2d (diff) | |
download | tmwa-1a651243bb2c8e18baa9aac30ac52a62185074e7.tar.gz tmwa-1a651243bb2c8e18baa9aac30ac52a62185074e7.tar.bz2 tmwa-1a651243bb2c8e18baa9aac30ac52a62185074e7.tar.xz tmwa-1a651243bb2c8e18baa9aac30ac52a62185074e7.zip |
Be stricter about most arrays
Diffstat (limited to 'src/map/map.hpp')
-rw-r--r-- | src/map/map.hpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/map/map.hpp b/src/map/map.hpp index 0f9f3d1..cb57c6b 100644 --- a/src/map/map.hpp +++ b/src/map/map.hpp @@ -113,7 +113,7 @@ public: struct walkpath_data { unsigned char path_len, path_pos, path_half; - DIR path[MAX_WALKPATH]; + Array<DIR, MAX_WALKPATH> path; }; struct status_change { @@ -173,7 +173,7 @@ struct map_session_data : block_list, SessionData unsigned char tmw_version; // tmw client version CharKey status_key; CharData status; - struct item_data *inventory_data[MAX_INVENTORY]; + Array<struct item_data *, MAX_INVENTORY> inventory_data; earray<short, EQUIP, EQUIP::COUNT> equip_index; int weight, max_weight; MapName mapname_; @@ -275,8 +275,8 @@ struct map_session_data : block_list, SessionData short sc_count; int trade_partner; - int deal_item_index[10]; - int deal_item_amount[10]; + Array<int, TRADE_MAX> deal_item_index; + Array<int, TRADE_MAX> deal_item_amount; int deal_zeny; short deal_locked; @@ -292,7 +292,7 @@ struct map_session_data : block_list, SessionData int pvp_lastusers; std::list<NpcEvent> eventqueuel; - Timer eventtimer[MAX_EVENTTIMER]; + Array<Timer, MAX_EVENTTIMER> eventtimer; struct { @@ -349,7 +349,7 @@ struct npc_data : block_list short flag; std::list<RString> eventqueuel; - Timer eventtimer[MAX_EVENTTIMER]; + Array<Timer, MAX_EVENTTIMER> eventtimer; short arenaflag; private: @@ -517,13 +517,7 @@ struct map_local : map_abstract MapFlags flag; struct point save; struct point resave; - dumb_ptr<npc_data> npc[MAX_NPC_PER_MAP]; - struct - { - int drop_id; - int drop_type; - int drop_per; - } drop_list[MAX_DROP_PER_MAP]; + Array<dumb_ptr<npc_data>, MAX_NPC_PER_MAP> npc; }; struct map_remote : map_abstract @@ -535,6 +529,8 @@ struct map_remote : map_abstract inline MapCell read_gatp(map_local *m, int x, int y) { + assert (0 <= x && x < m->xs); + assert (0 <= y && y < m->ys); return m->gat[x + y * m->xs]; } |