Fix restored bot passengers and add capital Cataclysm portals
This commit is contained in:
1 parent
19075b6c75
commit
bc8f171055
23 files changed
+1184
-24
No files matched your search
@@ -97,9 +97,10 @@ public:
|
||||
float GetSpeed(int)const{return 7;}void StopMoving(){}bool IsSplineEnabled()const{return false;}
|
||||
Motion* GetMotionMaster(){return &motion;}Session* GetSession(){return &session;}
|
||||
};
|
||||
struct Node{} node;
|
||||
struct Graph{Node* FindNode(std::string const&){return &node;}}graph;auto sClientlessTravelGraphMgr=&graph;
|
||||
struct AreaAccess{bool allowed=true;bool Applies(Player*){return true;}bool AllowsNode(Player*,Node const&){return allowed;}}areas;auto sAdventureAreaMgr=&areas;
|
||||
struct Node{std::string Key;} node;
|
||||
struct Graph{unsigned loads=0;bool EnsureLoaded(){++loads;return true;}Node* FindNode(std::string const&key){node.Key=key;return &node;}}graph;auto sClientlessTravelGraphMgr=&graph;
|
||||
struct Core{bool managed=true;bool IsManaged(unsigned){return managed;}}clientless;auto sClientlessPlayerMgr=&clientless;
|
||||
struct AreaAccess{std::string denied;bool allowed=true;bool Applies(Player*){return true;}bool AllowsNode(Player*,Node const&n){return allowed&&n.Key!=denied;}}areas;auto sAdventureAreaMgr=&areas;
|
||||
namespace ClientlessTransportDeckMgr {bool ready=true;int calls=0;void Clear(uint32){} bool Update(Player*,GameObject*,Position const&,bool,uint32){++calls;return ready;}}
|
||||
namespace ClientlessPositioning{bool available=false;bool Nearby(Player*p,Position const&,float,Position&spot,std::vector<Position>&path){if(!available)return false;spot=*p;spot.x+=2;path={*p,spot};return true;}}
|
||||
void TransportBase::CalculatePassengerPosition(float&x,float&y,float&z,float*o)const{CalculatePassengerPosition(x,y,z,o,go->x,go->y,go->z,go->o);}
|
||||
@@ -130,6 +131,7 @@ helpers = '\n'.join(function(source, marker) for marker in [
|
||||
' float Distance(', ' bool SameService(', ' bool LoadNode(', ' Position WorldPoint(', ' float PathLength('
|
||||
])
|
||||
methods = '\n'.join(function(source, marker) for marker in [
|
||||
'bool ClientlessTransportMgr::ResumePassenger(', 'bool ClientlessTransportMgr::SelectResumedDock(',
|
||||
'bool ClientlessTransportMgr::HasConnection(', 'bool ClientlessTransportMgr::AtDock(',
|
||||
'bool ClientlessTransportMgr::Sample(', 'bool ClientlessTransportMgr::Start(',
|
||||
'void ClientlessTransportMgr::SetPhase(', 'void ClientlessTransportMgr::Cancel(',
|
||||
@@ -243,6 +245,41 @@ int main(){
|
||||
ClientlessPositioning::available=false;
|
||||
Player denied;denied.object=&dock;areas.allowed=false;
|
||||
assert(!mgr.Start(&denied,"A","B",error));areas.allowed=true;
|
||||
// Restored attachment without transient CPC state is adopted, never reboarded.
|
||||
ClientlessTransportMgr resumed;resumed._stops["A"]=stop("A",5,0);resumed._stops["B"]=stop("B",100,104);
|
||||
Player orphan;GameObject vessel;vessel.x=50;vessel.state.Stopped=false;orphan.object=&vessel;orphan.x=51;
|
||||
vessel.base.AddPassenger(&orphan);orphan.m_movementInfo.transport.pos.x=1;
|
||||
assert(resumed.ResumePassenger(&orphan));auto& adopted=resumed._rides.at(26);
|
||||
assert(adopted.Resumed&&adopted.Status.Phase==Phase::Riding&&orphan.teleports==0&&graph.loads>0);
|
||||
run(resumed,orphan,adopted);assert(orphan.transport==&vessel.base&&adopted.Status.Phase==Phase::Riding);
|
||||
// B is the first actual permitted stop, even though seed A was selected.
|
||||
vessel.x=100;vessel.state.Stopped=true;orphan.x=101;
|
||||
resumed.UpdateRide(&orphan,adopted,100);assert(adopted.To.Node=="B");
|
||||
assert(resumed.ResumePassenger(&orphan));run(resumed,orphan,adopted);
|
||||
assert(adopted.Status.Phase==Phase::Arrived&&!orphan.transport&&orphan.x==104);
|
||||
assert(!resumed.ResumePassenger(&orphan));
|
||||
// After detachment the remaining land transition still owns the bot until done.
|
||||
adopted.Status.Phase=Phase::Leaving;assert(resumed.ResumePassenger(&orphan));
|
||||
adopted.Status.Phase=Phase::Arrived;assert(!resumed.ResumePassenger(&orphan));
|
||||
// Existing normal rides are never replaced by passenger adoption.
|
||||
vessel.x=5;orphan.x=0;assert(resumed.Start(&orphan,"A","B",error));run(resumed,orphan,resumed._rides.at(26));
|
||||
assert(!resumed.ResumePassenger(&orphan)&&!resumed._rides.at(26).Resumed);
|
||||
// Unknown vehicles, unmanaged players and entirely forbidden services are untouched.
|
||||
resumed._rides.clear();clientless.managed=false;assert(!resumed.ResumePassenger(&orphan));clientless.managed=true;
|
||||
vessel.spawn=99;assert(!resumed.ResumePassenger(&orphan));vessel.spawn=1;
|
||||
areas.allowed=false;assert(!resumed.ResumePassenger(&orphan));areas.allowed=true;
|
||||
// An adopted passenger must not leave at a subsequently forbidden dock.
|
||||
vessel.x=50;orphan.x=51;assert(resumed.ResumePassenger(&orphan));areas.denied="B";
|
||||
vessel.x=100;orphan.x=101;run(resumed,orphan,resumed._rides.at(26));assert(orphan.transport);
|
||||
areas.denied.clear();run(resumed,orphan,resumed._rides.at(26));assert(!orphan.transport&&orphan.x==104);
|
||||
// Native cross-map ship restoration keeps the same service after worldport ACK.
|
||||
resumed._rides.clear();resumed._stops["A"].Map=1;
|
||||
GameObject copy1;copy1.map=1;copy1.x=50;copy1.state.Stopped=false;
|
||||
orphan.map=1;orphan.object=©1;copy1.base.AddPassenger(&orphan);orphan.x=51;
|
||||
assert(resumed.ResumePassenger(&orphan));run(resumed,orphan,resumed._rides.at(26));assert(orphan.transport);
|
||||
copy1.base.RemovePassenger(&orphan);orphan.map=0;orphan.object=&vessel;vessel.x=100;
|
||||
vessel.base.AddPassenger(&orphan);orphan.x=101;orphan.m_movementInfo.transport.pos.x=1;
|
||||
run(resumed,orphan,resumed._rides.at(26));assert(!orphan.transport&&orphan.map==0&&orphan.x==104);
|
||||
std::cout<<"Transport dock, frame, recorder, cross-map copy and ride regressions passed\n";
|
||||
}
|
||||
'''
|
||||
|
||||
Reference in new issue
Block a user