[Client] Add ActorList methods for sending ActorAI packets

Additionally, use consistent capitalization for AI-related methods.
remotes/1728160796594174844/tmp_0.7.0-alpha
David Cernat 7 years ago
parent 0fd8f7660b
commit 6316f1e590

@ -79,6 +79,11 @@ void ActorList::addEquipmentActor(BaseActor baseActor)
equipmentActors.push_back(baseActor); equipmentActors.push_back(baseActor);
} }
void ActorList::addAiActor(BaseActor baseActor)
{
aiActors.push_back(baseActor);
}
void ActorList::addAttackActor(BaseActor baseActor) void ActorList::addAttackActor(BaseActor baseActor)
{ {
attackActors.push_back(baseActor); attackActors.push_back(baseActor);
@ -159,6 +164,16 @@ void ActorList::sendEquipmentActors()
} }
} }
void ActorList::sendAiActors()
{
if (aiActors.size() > 0)
{
baseActors = aiActors;
Main::get().getNetworking()->getActorPacket(ID_ACTOR_AI)->setActorList(this);
Main::get().getNetworking()->getActorPacket(ID_ACTOR_AI)->Send();
}
}
void ActorList::sendAttackActors() void ActorList::sendAttackActors()
{ {
if (attackActors.size() > 0) if (attackActors.size() > 0)

@ -27,6 +27,7 @@ namespace mwmp
void addStatsDynamicActor(BaseActor baseActor); void addStatsDynamicActor(BaseActor baseActor);
void addDeathActor(BaseActor baseActor); void addDeathActor(BaseActor baseActor);
void addEquipmentActor(BaseActor baseActor); void addEquipmentActor(BaseActor baseActor);
void addAiActor(BaseActor baseActor);
void addAttackActor(BaseActor baseActor); void addAttackActor(BaseActor baseActor);
void addCellChangeActor(BaseActor baseActor); void addCellChangeActor(BaseActor baseActor);
@ -37,6 +38,7 @@ namespace mwmp
void sendStatsDynamicActors(); void sendStatsDynamicActors();
void sendDeathActors(); void sendDeathActors();
void sendEquipmentActors(); void sendEquipmentActors();
void sendAiActors();
void sendAttackActors(); void sendAttackActors();
void sendCellChangeActors(); void sendCellChangeActors();
@ -52,6 +54,7 @@ namespace mwmp
std::vector<BaseActor> statsDynamicActors; std::vector<BaseActor> statsDynamicActors;
std::vector<BaseActor> deathActors; std::vector<BaseActor> deathActors;
std::vector<BaseActor> equipmentActors; std::vector<BaseActor> equipmentActors;
std::vector<BaseActor> aiActors;
std::vector<BaseActor> attackActors; std::vector<BaseActor> attackActors;
std::vector<BaseActor> cellChangeActors; std::vector<BaseActor> cellChangeActors;
}; };

@ -245,7 +245,7 @@ void Cell::readSpeech(ActorList& actorList)
} }
} }
void Cell::readAI(ActorList& actorList) void Cell::readAi(ActorList& actorList)
{ {
initializeDedicatedActors(actorList); initializeDedicatedActors(actorList);
@ -263,7 +263,7 @@ void Cell::readAI(ActorList& actorList)
actor->aiCoordinates = baseActor.aiCoordinates; actor->aiCoordinates = baseActor.aiCoordinates;
actor->hasAiTarget = baseActor.hasAiTarget; actor->hasAiTarget = baseActor.hasAiTarget;
actor->aiTarget = baseActor.aiTarget; actor->aiTarget = baseActor.aiTarget;
actor->setAI(); actor->setAi();
} }
} }
} }

@ -24,7 +24,7 @@ namespace mwmp
void readStatsDynamic(ActorList& actorList); void readStatsDynamic(ActorList& actorList);
void readEquipment(ActorList& actorList); void readEquipment(ActorList& actorList);
void readSpeech(ActorList& actorList); void readSpeech(ActorList& actorList);
void readAI(ActorList& actorList); void readAi(ActorList& actorList);
void readAttack(ActorList& actorList); void readAttack(ActorList& actorList);
void readCellChange(ActorList& actorList); void readCellChange(ActorList& actorList);

@ -154,7 +154,7 @@ void CellController::readSpeech(ActorList& actorList)
cellsInitialized[mapIndex]->readSpeech(actorList); cellsInitialized[mapIndex]->readSpeech(actorList);
} }
void CellController::readAI(ActorList& actorList) void CellController::readAi(ActorList& actorList)
{ {
std::string mapIndex = actorList.cell.getDescription(); std::string mapIndex = actorList.cell.getDescription();
@ -162,7 +162,7 @@ void CellController::readAI(ActorList& actorList)
// If this now exists, send it the data // If this now exists, send it the data
if (cellsInitialized.count(mapIndex) > 0) if (cellsInitialized.count(mapIndex) > 0)
cellsInitialized[mapIndex]->readAI(actorList); cellsInitialized[mapIndex]->readAi(actorList);
} }
void CellController::readAttack(ActorList& actorList) void CellController::readAttack(ActorList& actorList)

@ -27,7 +27,7 @@ namespace mwmp
void readStatsDynamic(mwmp::ActorList& actorList); void readStatsDynamic(mwmp::ActorList& actorList);
void readEquipment(mwmp::ActorList& actorList); void readEquipment(mwmp::ActorList& actorList);
void readSpeech(mwmp::ActorList& actorList); void readSpeech(mwmp::ActorList& actorList);
void readAI(mwmp::ActorList& actorList); void readAi(mwmp::ActorList& actorList);
void readAttack(mwmp::ActorList& actorList); void readAttack(mwmp::ActorList& actorList);
void readCellChange(mwmp::ActorList& actorList); void readCellChange(mwmp::ActorList& actorList);

@ -211,7 +211,7 @@ void DedicatedActor::setEquipment()
} }
} }
void DedicatedActor::setAI() void DedicatedActor::setAi()
{ {
MWMechanics::CreatureStats *ptrCreatureStats = &ptr.getClass().getCreatureStats(ptr); MWMechanics::CreatureStats *ptrCreatureStats = &ptr.getClass().getCreatureStats(ptr);
ptrCreatureStats->setAiSetting(MWMechanics::CreatureStats::AI_Fight, 0); ptrCreatureStats->setAiSetting(MWMechanics::CreatureStats::AI_Fight, 0);

@ -22,7 +22,7 @@ namespace mwmp
void setAnimFlags(); void setAnimFlags();
void setStatsDynamic(); void setStatsDynamic();
void setEquipment(); void setEquipment();
void setAI(); void setAi();
void playAnimation(); void playAnimation();
void playSound(); void playSound();

@ -19,7 +19,7 @@ namespace mwmp
{ {
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s about %s", strPacketID.c_str(), actorList.cell.getDescription().c_str()); LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s about %s", strPacketID.c_str(), actorList.cell.getDescription().c_str());
Main::get().getCellController()->readAI(actorList); Main::get().getCellController()->readAi(actorList);
} }
}; };
} }

Loading…
Cancel
Save