Opened 10 years ago
Last modified 3 years ago
#2459 new enhancement
Add a cooperative mode — at Initial Version
Reported by: | Antoine cezar | Owned by: | |
---|---|---|---|
Priority: | Nice to Have | Milestone: | Backlog |
Component: | Simulation | Keywords: | |
Cc: | Patch: |
Description
I've sucessfully made it work with a dirty hack:
Index: source/network/NetServer.cpp =================================================================== --- source/network/NetServer.cpp (révision 14856) +++ source/network/NetServer.cpp (copie de travail) @@ -645,7 +645,7 @@ PlayerAssignment assignment; assignment.m_Enabled = true; assignment.m_Name = name; - assignment.m_PlayerID = playerID; + assignment.m_PlayerID = 1; m_PlayerAssignments[guid] = assignment; // Send the new assignments to all currently active players
It worked with a modified host and an unmodified client, but you must not touch to the human player placement.
Since seemed to be just a mater of playerID I thougth that tweaking the gamesetup.js should do the trick. But whatever attempt I've made ended in "nothing happened" or "coredump".
I've spotted a potential reason in CNetServerWorker::AssignPlayer which "Remove anyone who's already assigned to this player" before assigning the new playerID and introduced my own method which just set on gui playerID to the other:
void CNetServerWorker::SetCooperation(const CStr& firstGuid, const CStr& secondGuid) { if (m_PlayerAssignments.find(firstGuid) != m_PlayerAssignments.end() && m_PlayerAssignments.find(secondGuid) != m_PlayerAssignments.end()) { m_PlayerAssignments[secondGuid].m_PlayerID = m_PlayerAssignments[firstGuid].m_PlayerID; SendPlayerAssignments(); } }
And tweaked gamesetup again, but nothing works for now.