diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2015-01-03 21:07:56 -0800 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2015-01-03 21:58:26 -0800 |
commit | 00da6b5977574a0564169172227d8aab45be188f (patch) | |
tree | dd52eee506a98e1eb9fcdea52e7db25079a7ad28 /src/map/clif.cpp | |
parent | 4c91abd6a020ee030114ae3f22d8f6066e7528be (diff) | |
download | tmwa-00da6b5977574a0564169172227d8aab45be188f.tar.gz tmwa-00da6b5977574a0564169172227d8aab45be188f.tar.bz2 tmwa-00da6b5977574a0564169172227d8aab45be188f.tar.xz tmwa-00da6b5977574a0564169172227d8aab45be188f.zip |
Switch MATCH to separate begin/end macros
The for loop trick turned out to be very prone to infinite loops
at runtime. It's better to force compiler errors even if it's ugly.
Diffstat (limited to 'src/map/clif.cpp')
-rw-r--r-- | src/map/clif.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/map/clif.cpp b/src/map/clif.cpp index 61fa8c5..5329eff 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -401,7 +401,7 @@ int clif_send(const Buffer& buf, dumb_ptr<block_list> bl, SendWho type) p_ = party_search(sd->status.party_id); } } - if OPTION_IS_SOME_NOLOOP(p, p_) + OMATCH_BEGIN_SOME (p, p_) { for (int i = 0; i < MAX_PARTY; i++) { @@ -440,6 +440,7 @@ int clif_send(const Buffer& buf, dumb_ptr<block_list> bl, SendWho type) } } } + OMATCH_END (); } break; case SendWho::SELF: @@ -1231,19 +1232,18 @@ int clif_selllist(dumb_ptr<map_session_data> sd) { if (!sd->status.inventory[i].nameid) continue; - if OPTION_IS_SOME_NOLOOP(sdidi, sd->inventory_data[i]) + OMATCH_BEGIN_SOME (sdidi, sd->inventory_data[i]) { int val = sdidi->value_sell; if (val < 0) - goto continue_outer; + continue; Packet_Repeat<0x00c7> info; info.ioff2 = i.shift(); info.base_price = val; info.actual_price = val; repeat_c7.push_back(info); } - continue_outer: - ; + OMATCH_END (); } send_packet_repeatonly<0x00c7, 4, 10>(s, repeat_c7); @@ -3555,11 +3555,12 @@ RecvResult clif_parse_GetCharNameRequest(Session *s, dumb_ptr<map_session_data> { Option<PartyPair> p_ = party_search(ssd->status.party_id); - if OPTION_IS_SOME_NOLOOP(p, p_) + OMATCH_BEGIN_SOME (p, p_) { party_name = p->name; send = 1; } + OMATCH_END (); } if (send) @@ -4088,7 +4089,7 @@ RecvResult clif_parse_EquipItem(Session *s, dumb_ptr<map_session_data> sd) if (sd->npc_id) return rv; - if OPTION_IS_SOME_NOLOOP(sdidi, sd->inventory_data[index]) + OMATCH_BEGIN_SOME (sdidi, sd->inventory_data[index]) { EPOS epos = fixed.epos_ignored; if (sdidi->type == ItemType::ARROW) @@ -4097,6 +4098,7 @@ RecvResult clif_parse_EquipItem(Session *s, dumb_ptr<map_session_data> sd) // Note: the EPOS argument to pc_equipitem is actually ignored pc_equipitem(sd, index, epos); } + OMATCH_END (); return rv; } |