diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2014-11-19 17:44:13 -0800 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2014-11-19 18:19:45 -0800 |
commit | 711680d652a8db17c1b91428b6d6835f30dfb4fd (patch) | |
tree | 0d64c8314f8531e2a09c7dc5e242333ddec6582b /src/map | |
parent | 078028058d2e9fbcde2147eb4154830e08652066 (diff) | |
download | tmwa-711680d652a8db17c1b91428b6d6835f30dfb4fd.tar.gz tmwa-711680d652a8db17c1b91428b6d6835f30dfb4fd.tar.bz2 tmwa-711680d652a8db17c1b91428b6d6835f30dfb4fd.tar.xz tmwa-711680d652a8db17c1b91428b6d6835f30dfb4fd.zip |
Magically allow "break" within WITH_VAR
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.cpp | 10 | ||||
-rw-r--r-- | src/map/battle.cpp | 4 | ||||
-rw-r--r-- | src/map/chrif.cpp | 2 | ||||
-rw-r--r-- | src/map/clif.cpp | 12 | ||||
-rw-r--r-- | src/map/itemdb.cpp | 2 | ||||
-rw-r--r-- | src/map/map.cpp | 2 | ||||
-rw-r--r-- | src/map/mob.cpp | 2 | ||||
-rw-r--r-- | src/map/party.cpp | 4 | ||||
-rw-r--r-- | src/map/pc.cpp | 20 | ||||
-rw-r--r-- | src/map/script-call.cpp | 2 | ||||
-rw-r--r-- | src/map/script-fun.cpp | 24 | ||||
-rw-r--r-- | src/map/script-parse.cpp | 2 | ||||
-rw-r--r-- | src/map/trade.cpp | 4 |
13 files changed, 46 insertions, 44 deletions
diff --git a/src/map/atcommand.cpp b/src/map/atcommand.cpp index 0b23ddd..bd1690d 100644 --- a/src/map/atcommand.cpp +++ b/src/map/atcommand.cpp @@ -375,7 +375,7 @@ bool atcommand_config_read(ZString cfgName) continue; } Option<P<AtCommandInfo>> p_ = get_atcommandinfo_byname(w1); - if OPTION_IS_SOME(p, p_) + if OPTION_IS_SOME_NOLOOP(p, p_) { p->level = GmLevel::from(static_cast<uint32_t>(atoi(w2.c_str()))); } @@ -3406,7 +3406,7 @@ ATCE atcommand_partyrecall(Session *s, dumb_ptr<map_session_data> sd, Option<PartyPair> p_ = party_searchname(party_name); if (p_.is_none()) p_ = party_search(wrap<PartyId>(static_cast<uint32_t>(atoi(message.c_str())))); - if OPTION_IS_SOME(p, p_) + if OPTION_IS_SOME_NOLOOP(p, p_) { count = 0; for (io::FD i : iter_fds()) @@ -3588,7 +3588,7 @@ ATCE atcommand_partyspy(Session *s, dumb_ptr<map_session_data> sd, Option<PartyPair> p_ = party_searchname(party_name); if (p_.is_none()) p_ = party_search(wrap<PartyId>(static_cast<uint32_t>(atoi(message.c_str())))); - if OPTION_IS_SOME(p, p_) + if OPTION_IS_SOME_NOLOOP(p, p_) { if (sd->partyspy == p.party_id) { @@ -3962,7 +3962,7 @@ ATCE atcommand_character_storage_list(Session *s, dumb_ptr<map_session_data> sd, { // you can look items only lower or same level Option<P<Storage>> stor_ = account2storage2(pl_sd->status_key.account_id); - if OPTION_IS_SOME(stor, stor_) + if OPTION_IS_SOME_NOLOOP(stor, stor_) { counter = 0; count = 0; @@ -4426,7 +4426,7 @@ ATCE atcommand_adjcmdlvl(Session *s, dumb_ptr<map_session_data>, Option<P<AtCommandInfo>> it_ = atcommand_info.search(cmd); { - if OPTION_IS_SOME(it, it_) + if OPTION_IS_SOME_NOLOOP(it, it_) { it->level = newlev; clif_displaymessage(s, "@command level changed."_s); diff --git a/src/map/battle.cpp b/src/map/battle.cpp index f852265..28c9d5f 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -1411,7 +1411,7 @@ struct Damage battle_calc_pc_weapon_attack(dumb_ptr<block_list> src, if (widx.ok()) { - if OPTION_IS_SOME(sdidw, sd->inventory_data[widx]) + if OPTION_IS_SOME_NOLOOP(sdidw, sd->inventory_data[widx]) atkmin = atkmin * (80 + sdidw->wlv * 20) / 100; } if (sd->status.weapon == ItemLook::BOW) @@ -1932,7 +1932,7 @@ ATK battle_weapon_attack(dumb_ptr<block_list> src, dumb_ptr<block_list> target, ItemNameId weapon; if (weapon_index.ok()) { - if OPTION_IS_SOME(sdidw, sd->inventory_data[weapon_index]) + if OPTION_IS_SOME_NOLOOP(sdidw, sd->inventory_data[weapon_index]) { if (bool(sd->status.inventory[weapon_index].equip & EPOS::WEAPON)) { diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp index dbdd401..7119ee8 100644 --- a/src/map/chrif.cpp +++ b/src/map/chrif.cpp @@ -967,7 +967,7 @@ void ladmin_itemfrob_c2(dumb_ptr<block_list> bl, ItemNameId source_id, ItemNameI IFIX(pc->status.head_bottom); Option<P<Storage>> stor_ = account2storage2(pc->status_key.account_id); - if OPTION_IS_SOME(stor, stor_) + if OPTION_IS_SOME_NOLOOP(stor, stor_) { for (SOff0 j : SOff0::iter()) FIX(stor->storage_[j]); diff --git a/src/map/clif.cpp b/src/map/clif.cpp index 430d928..3a84e03 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(p, p_) + if OPTION_IS_SOME_NOLOOP(p, p_) { for (int i = 0; i < MAX_PARTY; i++) { @@ -1262,17 +1262,19 @@ int clif_selllist(dumb_ptr<map_session_data> sd) { if (!sd->status.inventory[i].nameid) continue; - if OPTION_IS_SOME(sdidi, sd->inventory_data[i]) + if OPTION_IS_SOME_NOLOOP(sdidi, sd->inventory_data[i]) { int val = sdidi->value_sell; if (val < 0) - continue; + goto continue_outer; Packet_Repeat<0x00c7> info; info.ioff2 = i.shift(); info.base_price = val; info.actual_price = val; repeat_c7.push_back(info); } + continue_outer: + ; } send_packet_repeatonly<0x00c7, 4, 10>(s, repeat_c7); @@ -3636,7 +3638,7 @@ RecvResult clif_parse_GetCharNameRequest(Session *s, dumb_ptr<map_session_data> { Option<PartyPair> p_ = party_search(ssd->status.party_id); - if OPTION_IS_SOME(p, p_) + if OPTION_IS_SOME_NOLOOP(p, p_) { party_name = p->name; send = 1; @@ -4188,7 +4190,7 @@ RecvResult clif_parse_EquipItem(Session *s, dumb_ptr<map_session_data> sd) if (sd->npc_id) return rv; - if OPTION_IS_SOME(sdidi, sd->inventory_data[index]) + if OPTION_IS_SOME_NOLOOP(sdidi, sd->inventory_data[index]) { EPOS epos = fixed.epos_ignored; if (sdidi->type == ItemType::ARROW) diff --git a/src/map/itemdb.cpp b/src/map/itemdb.cpp index 2f7ed30..dbe2dd6 100644 --- a/src/map/itemdb.cpp +++ b/src/map/itemdb.cpp @@ -92,7 +92,7 @@ Option<Borrowed<struct item_data>> itemdb_exists(ItemNameId nameid) Borrowed<struct item_data> itemdb_search(ItemNameId nameid) { Option<P<struct item_data>> id_ = item_db.search(nameid); - if OPTION_IS_SOME(id, id_) + if OPTION_IS_SOME_NOLOOP(id, id_) return id; P<struct item_data> id = item_db.init(nameid); diff --git a/src/map/map.cpp b/src/map/map.cpp index b5f08ea..784319f 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -1247,7 +1247,7 @@ void map_setcell(Borrowed<map_local> m, int x, int y, MapCell t) int map_setipport(MapName name, IP4Address ip, int port) { Option<P<map_abstract>> md_ = maps_db.get(name); - if OPTION_IS_SOME(md, md_) + if OPTION_IS_SOME_NOLOOP(md, md_) { if (md->gat) { diff --git a/src/map/mob.cpp b/src/map/mob.cpp index 044d0b6..63db442 100644 --- a/src/map/mob.cpp +++ b/src/map/mob.cpp @@ -2591,7 +2591,7 @@ int mob_damage(dumb_ptr<block_list> src, dumb_ptr<mob_data> md, int damage, if (it == ptv.end()) { Option<PartyPair> p_ = party_search(pid); - if OPTION_IS_SOME(p, p_) + if OPTION_IS_SOME_NOLOOP(p, p_) { if (p->exp != 0) { diff --git a/src/map/party.cpp b/src/map/party.cpp index 8150743..0a9d2c5 100644 --- a/src/map/party.cpp +++ b/src/map/party.cpp @@ -213,7 +213,7 @@ static PartyPair handle_info(const PartyPair sp) { Option<PartyPair> p_ = party_search(sp.party_id); - if OPTION_IS_SOME(p, p_) + if OPTION_IS_SOME_NOLOOP(p, p_) { *p.party_most = *sp.party_most; return p; @@ -459,7 +459,7 @@ int party_member_leaved(PartyId party_id, AccountId account_id, CharName name) { dumb_ptr<map_session_data> sd = map_id2sd(account_to_block(account_id)); Option<PartyPair> p_ = party_search(party_id); - if OPTION_IS_SOME(p, p_) + if OPTION_IS_SOME_NOLOOP(p, p_) { int i; for (i = 0; i < MAX_PARTY; i++) diff --git a/src/map/pc.cpp b/src/map/pc.cpp index 95bdb8d..55e430a 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -555,14 +555,14 @@ int pc_setequipindex(dumb_ptr<map_session_data> sd) sd->equip_index_maybe[j] = i; if (bool(sd->status.inventory[i].equip & EPOS::WEAPON)) { - if OPTION_IS_SOME(sdidi, sd->inventory_data[i]) + if OPTION_IS_SOME_NOLOOP(sdidi, sd->inventory_data[i]) sd->weapontype1 = sdidi->look; else sd->weapontype1 = ItemLook::NONE; } if (bool(sd->status.inventory[i].equip & EPOS::SHIELD)) { - if OPTION_IS_SOME(sdidi, sd->inventory_data[i]) + if OPTION_IS_SOME_NOLOOP(sdidi, sd->inventory_data[i]) { if (sdidi->type == ItemType::WEAPON) { @@ -1007,7 +1007,7 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) || sd->equip_index_maybe[EQUIP::LEGS] == index)) continue; - if OPTION_IS_SOME(sdidi, sd->inventory_data[index]) + if OPTION_IS_SOME_NOLOOP(sdidi, sd->inventory_data[index]) { sd->spellpower_bonus_target += sdidi->magic_bonus; @@ -1042,7 +1042,7 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) && (sd->equip_index_maybe[EQUIP::TORSO] == index || sd->equip_index_maybe[EQUIP::LEGS] == index)) continue; - if OPTION_IS_SOME(sdidi, sd->inventory_data[index]) + if OPTION_IS_SOME_NOLOOP(sdidi, sd->inventory_data[index]) { sd->def += sdidi->def; if (sdidi->type == ItemType::WEAPON) @@ -1093,7 +1093,7 @@ int pc_calcstatus(dumb_ptr<map_session_data> sd, int first) if (aidx.ok()) { IOff0 index = aidx; - if OPTION_IS_SOME(sdidi, sd->inventory_data[index]) + if OPTION_IS_SOME_NOLOOP(sdidi, sd->inventory_data[index]) { //まだ属性が入っていない argrec_t arg[2] = { @@ -2120,7 +2120,7 @@ int pc_useitem(dumb_ptr<map_session_data> sd, IOff0 n) if (!n.ok()) return 0; - if OPTION_IS_SOME(sdidn, sd->inventory_data[n]) + if OPTION_IS_SOME_NOLOOP(sdidn, sd->inventory_data[n]) { amount = sd->status.inventory[n].amount; if (!sd->status.inventory[n].nameid @@ -3335,7 +3335,7 @@ int pc_damage(dumb_ptr<block_list> src, dumb_ptr<map_session_data> sd, if (sd->status.party_id) { // on-the-fly party hp updates [Valaris] Option<PartyPair> p_ = party_search(sd->status.party_id); - if OPTION_IS_SOME(p, p_) + if OPTION_IS_SOME_NOLOOP(p, p_) clif_party_hp(p, sd); } // end addition [Valaris] @@ -3703,7 +3703,7 @@ int pc_heal(dumb_ptr<map_session_data> sd, int hp, int sp) if (sd->status.party_id) { // on-the-fly party hp updates [Valaris] Option<PartyPair> p_ = party_search(sd->status.party_id); - if OPTION_IS_SOME(p, p_) + if OPTION_IS_SOME_NOLOOP(p, p_) clif_party_hp(p, sd); } // end addition [Valaris] @@ -4369,7 +4369,7 @@ int pc_equipitem(dumb_ptr<map_session_data> sd, IOff0 n, EPOS) ItemNameId view_i; ItemLook view_l = ItemLook::NONE; // TODO: This is ugly. - if OPTION_IS_SOME(sdidn, sd->inventory_data[n]) + if OPTION_IS_SOME_NOLOOP(sdidn, sd->inventory_data[n]) { bool look_not_weapon = sdidn->look == ItemLook::NONE; bool equip_is_weapon = bool(sd->status.inventory[n].equip & EPOS::WEAPON); @@ -4389,7 +4389,7 @@ int pc_equipitem(dumb_ptr<map_session_data> sd, IOff0 n, EPOS) } if (bool(sd->status.inventory[n].equip & EPOS::SHIELD)) { - if OPTION_IS_SOME(sdidn, sd->inventory_data[n]) + if OPTION_IS_SOME_NOLOOP(sdidn, sd->inventory_data[n]) { if (sdidn->type == ItemType::WEAPON) { diff --git a/src/map/script-call.cpp b/src/map/script-call.cpp index 212e0e3..abab24d 100644 --- a/src/map/script-call.cpp +++ b/src/map/script-call.cpp @@ -108,7 +108,7 @@ void get_val(dumb_ptr<map_session_data> sd, struct script_data *data) else if (prefix == '$') { Option<P<RString>> s_ = mapregstr_db.search(u.reg); - if OPTION_IS_SOME(s, s_) + if OPTION_IS_SOME_NOLOOP(s, s_) str = *s; } else diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp index c38f498..a291a11 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -122,7 +122,7 @@ void builtin_callfunc(ScriptState *st) RString str = conv_str(st, &AARG(0)); Option<P<const ScriptBuffer>> scr_ = userfunc_db.get(str); - if OPTION_IS_SOME(scr, scr_) + if OPTION_IS_SOME_NOLOOP(scr, scr_) { int j = 0; assert (st->start + 3 == st->end); @@ -720,7 +720,7 @@ void builtin_countitem(ScriptState *st) { ZString name = ZString(conv_str(st, data)); Option<P<struct item_data>> item_data_ = itemdb_searchname(name); - if OPTION_IS_SOME(item_data, item_data_) + if OPTION_IS_SOME_NOLOOP(item_data, item_data_) nameid = item_data->nameid; } else @@ -763,7 +763,7 @@ void builtin_checkweight(ScriptState *st) { ZString name = ZString(conv_str(st, data)); Option<P<struct item_data>> item_data_ = itemdb_searchname(name); - if OPTION_IS_SOME(item_data, item_data_) + if OPTION_IS_SOME_NOLOOP(item_data, item_data_) nameid = item_data->nameid; } else @@ -808,7 +808,7 @@ void builtin_getitem(ScriptState *st) { ZString name = ZString(conv_str(st, data)); Option<P<struct item_data>> item_data_ = itemdb_searchname(name); - if OPTION_IS_SOME(item_data, item_data_) + if OPTION_IS_SOME_NOLOOP(item_data, item_data_) nameid = item_data->nameid; } else @@ -861,7 +861,7 @@ void builtin_makeitem(ScriptState *st) { ZString name = ZString(conv_str(st, data)); Option<P<struct item_data>> item_data_ = itemdb_searchname(name); - if OPTION_IS_SOME(item_data, item_data_) + if OPTION_IS_SOME_NOLOOP(item_data, item_data_) nameid = item_data->nameid; } else @@ -905,7 +905,7 @@ void builtin_delitem(ScriptState *st) { ZString name = ZString(conv_str(st, data)); Option<P<struct item_data>> item_data_ = itemdb_searchname(name); - if OPTION_IS_SOME(item_data, item_data_) + if OPTION_IS_SOME_NOLOOP(item_data, item_data_) nameid = item_data->nameid; } else @@ -1080,7 +1080,7 @@ void builtin_getequipid(ScriptState *st) if (i.ok()) { Option<P<struct item_data>> item_ = sd->inventory_data[i]; - if OPTION_IS_SOME(item, item_) + if OPTION_IS_SOME_NOLOOP(item, item_) push_int<ScriptDataInt>(st->stack, unwrap<ItemNameId>(item->nameid)); else push_int<ScriptDataInt>(st->stack, 0); @@ -1109,7 +1109,7 @@ void builtin_getequipname(ScriptState *st) if (i.ok()) { Option<P<struct item_data>> item_ = sd->inventory_data[i]; - if OPTION_IS_SOME(item, item_) + if OPTION_IS_SOME_NOLOOP(item, item_) buf = STRPRINTF("%s-[%s]"_fmt, pos_str[num - 1], item->jname); else buf = STRPRINTF("%s-[%s]"_fmt, pos_str[num - 1], pos_str[10]); @@ -1832,7 +1832,7 @@ void builtin_getareadropitem(ScriptState *st) { ZString name = ZString(conv_str(st, data)); Option<P<struct item_data>> item_data_ = itemdb_searchname(name); - if OPTION_IS_SOME(item_data, item_data_) + if OPTION_IS_SOME_NOLOOP(item_data, item_data_) item = item_data->nameid; } else @@ -2013,7 +2013,7 @@ void builtin_setmapflag(ScriptState *st) int i = conv_num(st, &AARG(1)); MapFlag mf = map_flag_from_int(i); Option<P<map_local>> m_ = map_mapname2mapid(str); - if OPTION_IS_SOME(m, m_) + if OPTION_IS_SOME_NOLOOP(m, m_) { m->flag.set(mf, 1); } @@ -2026,7 +2026,7 @@ void builtin_removemapflag(ScriptState *st) int i = conv_num(st, &AARG(1)); MapFlag mf = map_flag_from_int(i); Option<P<map_local>> m_ = map_mapname2mapid(str); - if OPTION_IS_SOME(m, m_) + if OPTION_IS_SOME_NOLOOP(m, m_) { m->flag.set(mf, 0); } @@ -2041,7 +2041,7 @@ void builtin_getmapflag(ScriptState *st) int i = conv_num(st, &AARG(1)); MapFlag mf = map_flag_from_int(i); Option<P<map_local>> m_ = map_mapname2mapid(str); - if OPTION_IS_SOME(m, m_) + if OPTION_IS_SOME_NOLOOP(m, m_) { r = m->flag.get(mf); } diff --git a/src/map/script-parse.cpp b/src/map/script-parse.cpp index 878397f..47e0def 100644 --- a/src/map/script-parse.cpp +++ b/src/map/script-parse.cpp @@ -134,7 +134,7 @@ Option<Borrowed<str_data_t>> search_strp(XString p) Borrowed<str_data_t> add_strp(XString p) { Option<P<str_data_t>> rv_ = search_strp(p); - if OPTION_IS_SOME(rv, rv_) + if OPTION_IS_SOME_NOLOOP(rv, rv_) return rv; RString p2 = p; diff --git a/src/map/trade.cpp b/src/map/trade.cpp index b5e19be..5ec63c9 100644 --- a/src/map/trade.cpp +++ b/src/map/trade.cpp @@ -174,7 +174,7 @@ void trade_tradeadditem(dumb_ptr<map_session_data> sd, IOff2 index, int amount) sd->status.inventory[index.unshift()].nameid) continue; - if OPTION_IS_SOME(id, target_sd->inventory_data[i]) + if OPTION_IS_SOME_INLOOP(id, target_sd->inventory_data[i]) { if (id->type != ItemType::WEAPON && id->type != ItemType::ARMOR @@ -231,7 +231,7 @@ void trade_tradeadditem(dumb_ptr<map_session_data> sd, IOff2 index, int amount) sd->status. inventory[sd->deal_item_index[trade_i].unshift()].nameid) continue; - if OPTION_IS_SOME(id, target_sd->inventory_data[i]) + if OPTION_IS_SOME_INLOOP(id, target_sd->inventory_data[i]) { if (id->type != ItemType::WEAPON && id->type != ItemType::ARMOR |