Subversion Repositories eoserv

Compare Revisions

Ignore whitespace Rev 424 → Rev 425

/trunk/src/world.cpp
881,6 → 881,9
 
UTIL_FOREACH(c->quests, q)
{
if (!q.second)
continue;
 
backup_t b{q.first, q.second->StateName(), q.second->SerializeProgress()};
it->second.push_back(b);
}
/trunk/src/handlers/Quest.cpp
35,7 → 35,7
 
UTIL_FOREACH(character->quests, quest)
{
if (quest.second->GetQuest()->Disabled())
if (!quest.second || quest.second->GetQuest()->Disabled())
continue;
 
const Dialog* dialog = quest.second->GetDialog(vendor_id);
114,7 → 114,7
continue;
 
auto context = std::make_shared<Quest_Context>(character, quest);
character->quests.insert({it->first, context});
character->quests[it->first] = context;
context->SetState("begin");
}
}
189,7 → 189,7
case QUEST_PAGE_PROGRESS:
UTIL_FOREACH(character->quests, q)
{
if (!q.second->Finished() && !q.second->GetQuest()->Disabled() && q.second->GetQuest()->GetQuest()->info.hidden != EOPlus::Info::Hidden)
if (q.second && !q.second->Finished() && !q.second->GetQuest()->Disabled() && q.second->GetQuest()->GetQuest()->info.hidden != EOPlus::Info::Hidden)
reserve += 9 + q.second->GetQuest()->GetQuest()->info.name.length() + q.second->Desc().length();
}
 
197,7 → 197,7
 
UTIL_FOREACH(character->quests, q)
{
if (q.second->Finished() || q.second->GetQuest()->Disabled() || q.second->GetQuest()->GetQuest()->info.hidden == EOPlus::Info::Hidden)
if (!q.second || q.second->Finished() || q.second->GetQuest()->Disabled() || q.second->GetQuest()->GetQuest()->info.hidden == EOPlus::Info::Hidden)
continue;
 
Quest_Context::ProgressInfo progress = q.second->Progress();
215,7 → 215,7
case QUEST_PAGE_HISTORY:
UTIL_FOREACH(character->quests, q)
{
if (q.second->Finished() && q.second->GetQuest()->GetQuest()->info.hidden == EOPlus::Info::NotHidden)
if (q.second && q.second->Finished() && q.second->GetQuest()->GetQuest()->info.hidden == EOPlus::Info::NotHidden)
reserve += 1 + q.second->GetQuest()->GetQuest()->info.name.length();
}
 
223,7 → 223,7
 
UTIL_FOREACH(character->quests, q)
{
if (q.second->Finished() && q.second->GetQuest()->GetQuest()->info.hidden == EOPlus::Info::NotHidden)
if (q.second && q.second->Finished() && q.second->GetQuest()->GetQuest()->info.hidden == EOPlus::Info::NotHidden)
reply.AddBreakString(q.second->GetQuest()->GetQuest()->info.name);
}
 
/trunk/src/handlers/Book.cpp
85,7 → 85,7
 
UTIL_FOREACH(target->quests, quest)
{
if (quest.second->Finished() && quest.second->GetQuest()->GetQuest()->info.hidden == EOPlus::Info::NotHidden)
if (quest.second && quest.second->Finished() && quest.second->GetQuest()->GetQuest()->info.hidden == EOPlus::Info::NotHidden)
reserve += quest.second->GetQuest()->Name().length() + 1;
}
 
93,7 → 93,7
 
UTIL_FOREACH(target->quests, quest)
{
if (quest.second->Finished() && quest.second->GetQuest()->GetQuest()->info.hidden == EOPlus::Info::NotHidden)
if (quest.second && quest.second->Finished() && quest.second->GetQuest()->GetQuest()->info.hidden == EOPlus::Info::NotHidden)
reply.AddBreakString(quest.second->GetQuest()->Name());
}
 
/trunk/src/handlers/Item.cpp
31,6 → 31,17
reply.AddChar(item.type);
reply.AddShort(id);
 
auto QuestUsedItems = [](Character* character, int id)
{
UTIL_FOREACH(character->quests, q)
{
if (!q.second || q.second->GetQuest()->Disabled())
continue;
 
q.second->UsedItem(id);
}
};
 
switch (item.type)
{
case EIF::Teleport:
67,7 → 78,7
 
character->Send(reply);
 
UTIL_FOREACH(character->quests, q) { q.second->UsedItem(id); }
QuestUsedItems(character, id);
}
break;
 
128,7 → 139,7
 
character->Send(reply);
 
UTIL_FOREACH(character->quests, q) { q.second->UsedItem(id); }
QuestUsedItems(character, id);
}
break;
 
164,7 → 175,7
 
character->Send(reply);
 
UTIL_FOREACH(character->quests, q) { q.second->UsedItem(id); }
QuestUsedItems(character, id);
}
break;
 
179,7 → 190,7
 
character->Send(reply);
 
UTIL_FOREACH(character->quests, q) { q.second->UsedItem(id); }
QuestUsedItems(character, id);
}
break;
 
197,7 → 208,7
 
character->Send(reply);
 
UTIL_FOREACH(character->quests, q) { q.second->UsedItem(id); }
QuestUsedItems(character, id);
}
break;
 
258,7 → 269,7
 
character->Send(reply);
 
UTIL_FOREACH(character->quests, q) { q.second->UsedItem(id); }
QuestUsedItems(character, id);
}
break;
 
318,7 → 329,7
 
character->Send(reply);
 
UTIL_FOREACH(character->quests, q) { q.second->UsedItem(id); }
QuestUsedItems(character, id);
}
break;
 
/trunk/src/eoplus/context.cpp
15,7 → 15,7
namespace EOPlus
{
static int recursive_depth = 0;
static const int max_recursion = 1000;
static const int max_recursion = 100;
 
Context::Context(const Quest* quest)
: quest(quest)
/trunk/src/character.cpp
168,6 → 168,9
 
UTIL_FOREACH(list, quest)
{
if (!quest.second)
continue;
 
serialized.append(util::to_string(quest.second->GetQuest()->ID()));
serialized.append(",");
serialized.append(quest.second->StateName());
473,7 → 476,7
if (!quest->Disabled())
{
auto context = std::make_shared<Quest_Context>(this, quest);
this->quests.insert({it->first, context});
this->quests[it->first] = context;
context->SetState("begin");
}
}
946,7 → 949,13
return;
}
 
UTIL_FOREACH(this->quests, q) { q.second->UsedSpell(spell_id); }
UTIL_FOREACH(this->quests, q)
{
if (!q.second || q.second->GetQuest()->Disabled())
continue;
 
q.second->UsedSpell(spell_id);
}
}
 
bool Character::Unequip(short item, unsigned char subloc)
1411,12 → 1420,12
 
void Character::CheckQuestRules()
{
restart_loop:
 
UTIL_FOREACH(this->quests, q)
{
if (q.second->CheckRules())
goto restart_loop;
if (!q.second || q.second->GetQuest()->Disabled())
continue;
 
q.second->CheckRules();
}
}
 
1713,7 → 1722,7
 
void Character::ResetQuest(short id)
{
this->quests.erase(id);
this->quests[id].reset();
}
 
void Character::Mute(const Command_Source *by)
/trunk/src/map.cpp
1595,7 → 1595,13
{char(PACKET_INTERNAL_WARP), char(PACKET_INTERNAL)}
}.data()), 0.0);
 
UTIL_FOREACH(from->quests, q) { q.second->KilledPlayer(); }
UTIL_FOREACH(from->quests, q)
{
if (!q.second || q.second->GetQuest()->Disabled())
continue;
 
q.second->KilledPlayer();
}
}
 
builder.Reset(4);
1972,7 → 1978,13
{char(PACKET_INTERNAL_WARP), char(PACKET_INTERNAL)}
}.data()), 0.0);
 
UTIL_FOREACH(from->quests, q) { q.second->KilledPlayer(); }
UTIL_FOREACH(from->quests, q)
{
if (!q.second || q.second->GetQuest()->Disabled())
continue;
 
q.second->KilledPlayer();
}
}
 
builder.Reset(4);
/trunk/src/quest.cpp
434,7 → 434,7
// WARNING: holds a non-tracked reference to shared_ptr
Quest* quest = it->second.get();
auto context = std::make_shared<Quest_Context>(this->character, quest);
this->character->quests.insert({it->first, context});
this->character->quests[it->first] = context;
context->SetState(action.expr.args.size() >= 2 ? std::string(action.expr.args[1]) : "begin");
}
}
/trunk/src/commands/debug.cpp
138,7 → 138,7
{
// WARNING: holds a non-tracked reference to shared_ptr
quest = std::make_shared<Quest_Context>(from, it->second.get());
from->quests.insert(std::make_pair(it->first, quest));
from->quests[it->first] = quest;
quest->SetState("begin", true);
}
}
/trunk/src/commands/info.cpp
212,7 → 212,7
 
UTIL_FOREACH(victim->quests, quest)
{
if (quest.second->Finished() && quest.second->GetQuest()->GetQuest()->info.hidden == EOPlus::Info::NotHidden)
if (quest.second && quest.second->Finished() && quest.second->GetQuest()->GetQuest()->info.hidden == EOPlus::Info::NotHidden)
reserve += quest.second->GetQuest()->Name().length() + 1;
}
 
220,7 → 220,7
 
UTIL_FOREACH(victim->quests, quest)
{
if (quest.second->Finished() && quest.second->GetQuest()->GetQuest()->info.hidden == EOPlus::Info::NotHidden)
if (quest.second && quest.second->Finished() && quest.second->GetQuest()->GetQuest()->info.hidden == EOPlus::Info::NotHidden)
reply.AddBreakString(quest.second->GetQuest()->Name());
}
 
/trunk/src/npc.cpp
1032,8 → 1032,14
);
}
 
UTIL_FOREACH(from->quests, q) { q.second->KilledNPC(this->Data().id); }
UTIL_FOREACH(from->quests, q)
{
if (!q.second || q.second->GetQuest()->Disabled())
continue;
 
q.second->KilledNPC(this->Data().id);
}
 
if (this->temporary)
{
delete this;