fix: fraction check in visibility table
misc: bump vistable version, and erase old-version vistables
This commit is contained in:
parent
8e0512c49d
commit
6d24e1bbd7
2 changed files with 13 additions and 2 deletions
|
|
@ -72,7 +72,7 @@ CR_DECLARE_SCOPED_ENUM (StorageOption,
|
||||||
CR_DECLARE_SCOPED_ENUM (StorageVersion,
|
CR_DECLARE_SCOPED_ENUM (StorageVersion,
|
||||||
Graph = 2,
|
Graph = 2,
|
||||||
Practice = 1,
|
Practice = 1,
|
||||||
Vistable = 1,
|
Vistable = 2,
|
||||||
Matrix = 1,
|
Matrix = 1,
|
||||||
Podbot = 7
|
Podbot = 7
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -1762,6 +1762,17 @@ template <typename U> bool BotGraph::loadStorage (StringRef ext, StringRef name,
|
||||||
return raiseLoadingError (isGraph, file, "Damaged %s (filename: '%s'). Version number differs (got: '%d', need: '%d').", name, filename, hdr.version, version);
|
return raiseLoadingError (isGraph, file, "Damaged %s (filename: '%s'). Version number differs (got: '%d', need: '%d').", name, filename, hdr.version, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// temporary solution to kill version 1 vistables, which has a bugs
|
||||||
|
if ((options & StorageOption::Vistable) && hdr.version == 1) {
|
||||||
|
auto vistablePath = strings.format ("%strain/%s.vis", getDataDirectory (), game.getMapName ());
|
||||||
|
|
||||||
|
if (File::exists (vistablePath)) {
|
||||||
|
plat.removeFile (vistablePath);
|
||||||
|
}
|
||||||
|
return raiseLoadingError (isGraph, file, "Bugged vistable %s (filename: '%s'). Version 1 has a bugs, vistable will be recreated.", name, filename);
|
||||||
|
}
|
||||||
|
|
||||||
// save graph version
|
// save graph version
|
||||||
if (isGraph) {
|
if (isGraph) {
|
||||||
memcpy (&m_graphHeader, &hdr, sizeof (StorageHeader));
|
memcpy (&m_graphHeader, &hdr, sizeof (StorageHeader));
|
||||||
|
|
@ -2093,7 +2104,7 @@ void BotGraph::rebuildVisibility () {
|
||||||
game.testLine (sourceStand, dest, TraceIgnore::Monsters, nullptr, &tr);
|
game.testLine (sourceStand, dest, TraceIgnore::Monsters, nullptr, &tr);
|
||||||
|
|
||||||
// check if line of sight to object is not blocked (i.e. visible)
|
// check if line of sight to object is not blocked (i.e. visible)
|
||||||
if (cr::fequal (tr.flFraction, 1.0f) || tr.fStartSolid) {
|
if (!cr::fequal (tr.flFraction, 1.0f) || tr.fStartSolid) {
|
||||||
res |= 1;
|
res |= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue