mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Fix ActorPath not archiving path properly
It was mistakenly archiving the first path multiple times instead of the whole path array. This lead to AI strangely moving after loading from save
This commit is contained in:
parent
ad825f5114
commit
48c2d026e6
1 changed files with 16 additions and 18 deletions
|
@ -105,8 +105,8 @@ public:
|
|||
|
||||
inline void ActorPath::Archive(Archiver& arc)
|
||||
{
|
||||
int pos;
|
||||
int startpathpos;
|
||||
int index;
|
||||
int i;
|
||||
|
||||
arc.ArchiveInteger(&m_pathlen);
|
||||
|
||||
|
@ -115,42 +115,40 @@ inline void ActorPath::Archive(Archiver& arc)
|
|||
m_path = new PathInfo[m_pathlen];
|
||||
}
|
||||
|
||||
if (m_pathlen > 0) {
|
||||
for (int i = 0; i < m_pathlen; i++) {
|
||||
m_path->Archive(arc);
|
||||
}
|
||||
for (i = 0; i < m_pathlen; i++) {
|
||||
m_path[i].Archive(arc);
|
||||
}
|
||||
|
||||
if (!arc.Saving()) {
|
||||
arc.ArchiveInteger(&pos);
|
||||
if (pos == -1) {
|
||||
arc.ArchiveInteger(&index);
|
||||
if (index == -1) {
|
||||
m_pathpos = NULL;
|
||||
} else {
|
||||
m_pathpos = &m_path[pos];
|
||||
m_pathpos = &m_path[index];
|
||||
}
|
||||
|
||||
arc.ArchiveInteger(&startpathpos);
|
||||
if (startpathpos == -1) {
|
||||
arc.ArchiveInteger(&index);
|
||||
if (index == -1) {
|
||||
m_startpathpos = NULL;
|
||||
} else {
|
||||
m_startpathpos = &m_path[pos];
|
||||
m_startpathpos = &m_path[index];
|
||||
}
|
||||
} else {
|
||||
if (m_pathpos) {
|
||||
pos = m_pathpos - m_path;
|
||||
index = m_pathpos - m_path;
|
||||
} else {
|
||||
pos = -1;
|
||||
index = -1;
|
||||
}
|
||||
|
||||
arc.ArchiveInteger(&pos);
|
||||
arc.ArchiveInteger(&index);
|
||||
|
||||
if (m_startpathpos) {
|
||||
pos = m_startpathpos - m_path;
|
||||
index = m_startpathpos - m_path;
|
||||
} else {
|
||||
pos = -1;
|
||||
index = -1;
|
||||
}
|
||||
|
||||
arc.ArchiveInteger(&pos);
|
||||
arc.ArchiveInteger(&index);
|
||||
}
|
||||
} else if (arc.Loading()) {
|
||||
m_pathpos = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue