forked from Mirrors/openclonk
Remove most shareware restrictions
One can now start the developer mode and every scenario without a registration, but the game still complains about not being registered. committer: Günther Brammer <gbrammer@gmx.de>
parent
77dabef7c7
commit
9e08426f65
|
@ -315,7 +315,6 @@ class C4Config: protected CStdConfig
|
|||
BOOL Load(BOOL forceWorkingDirectory = TRUE, const char *szConfigFile = NULL);
|
||||
BOOL Init();
|
||||
BOOL Registered();
|
||||
BOOL IsFreeFolder(const char *szFoldername, const char *szMaker);
|
||||
const char *AtExePath(const char *szFilename);
|
||||
const char *AtTempPath(const char *szFilename);
|
||||
const char *AtNetworkPath(const char *szFilename);
|
||||
|
|
|
@ -304,7 +304,6 @@ class C4Game
|
|||
void ExecObjects();
|
||||
void Ticks();
|
||||
const char *FoldersWithLocalsDefs(const char *szPath);
|
||||
BOOL CheckScenarioAccess();
|
||||
BOOL CheckObjectEnumeration();
|
||||
BOOL LocalFileMatch(const char *szFilename, int32_t iCreation);
|
||||
BOOL DefinitionFilenamesFromSaveGame();
|
||||
|
|
|
@ -107,11 +107,10 @@ class C4ScenarioListLoader
|
|||
private:
|
||||
C4Scenario C4S;
|
||||
bool fNoMissionAccess;
|
||||
bool fUnregisteredAccess;
|
||||
int32_t iMinPlrCount;
|
||||
|
||||
public:
|
||||
Scenario(class Folder *pParent) : Entry(pParent), fNoMissionAccess(false), fUnregisteredAccess(false), iMinPlrCount(0) {}
|
||||
Scenario(class Folder *pParent) : Entry(pParent), fNoMissionAccess(false), iMinPlrCount(0) {}
|
||||
virtual ~Scenario() {}
|
||||
|
||||
virtual bool LoadCustom(C4Group &rGrp, bool fNameLoaded, bool fIconLoaded); // do fallbacks for title and icon; check whether scenario is valid
|
||||
|
@ -121,7 +120,6 @@ class C4ScenarioListLoader
|
|||
virtual bool CanOpen(StdStrBuf &sError); // check mission access, player count, etc.
|
||||
virtual bool IsGrayed() { return false; } // additional option for graying out
|
||||
virtual bool HasMissionAccess() const { return !fNoMissionAccess; }; // check mission access only
|
||||
virtual bool HasUnregisteredAccess() const { return fUnregisteredAccess; };
|
||||
virtual StdStrBuf GetOpenText(); // get open button text
|
||||
virtual StdStrBuf GetOpenTooltip();
|
||||
const C4Scenario &GetC4S() const { return C4S; } // get scenario core
|
||||
|
|
|
@ -290,15 +290,6 @@ BOOL C4ConfigShareware::Registered()
|
|||
return RegistrationValid;
|
||||
}
|
||||
|
||||
BOOL C4ConfigShareware::IsFreeFolder(const char *szFoldername, const char *szMaker)
|
||||
{
|
||||
char szFreeFolder[_MAX_FNAME+1];
|
||||
for (int iSeg = 0; SCopySegment(LoadSecStr(IDS_SEC_FREEFOLDERS), iSeg, szFreeFolder); iSeg++)
|
||||
if (SEqualNoCase(GetFilename(szFoldername),szFreeFolder) && SEqual(szMaker, LoadSecStr(IDS_SEC_FREEFOLDERMAKER)))
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool C4ConfigShareware::LoadRegistration()
|
||||
{
|
||||
// Reset error message(s)
|
||||
|
|
|
@ -43,7 +43,6 @@ class C4ConfigShareware: public C4Config
|
|||
public:
|
||||
void ClearRegistrationError();
|
||||
BOOL Registered();
|
||||
BOOL IsFreeFolder(const char *szFoldername, const char *szMaker);
|
||||
bool LoadRegistration();
|
||||
bool LoadRegistration(const char *szFrom);
|
||||
const char* GetRegistrationData(const char* strField);
|
||||
|
|
|
@ -290,9 +290,6 @@ bool C4Application::OpenGame()
|
|||
}
|
||||
else
|
||||
{
|
||||
// Check registration
|
||||
if ( !Config.Registered() )
|
||||
{ LogFatal(LoadResStr("IDS_CNS_REGONLY")); Clear(); return FALSE; }
|
||||
// Execute command line
|
||||
if (Game.ScenarioFilename[0] || Game.DirectJoinAddress[0])
|
||||
return Console.OpenGame(szCmdLine);
|
||||
|
|
|
@ -929,12 +929,6 @@ BOOL C4Config::Registered()
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL C4Config::IsFreeFolder(const char *szFoldername, const char *szMaker)
|
||||
{
|
||||
// Dummy function: to be overloaded in C4Config
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL C4Config::Init()
|
||||
{
|
||||
return TRUE;
|
||||
|
|
|
@ -166,10 +166,6 @@ BOOL C4Game::OpenScenario()
|
|||
if (!C4S.Load(ScenarioFile))
|
||||
{ LogFatal(LoadResStr("IDS_PRC_FILEINVALID")); return FALSE; }
|
||||
|
||||
// Check registration
|
||||
if (!CheckScenarioAccess())
|
||||
{ LogFatal(LoadResStr("IDS_PRC_NOSWSCENARIO")); return FALSE; }
|
||||
|
||||
// Check minimum engine version
|
||||
if (CompareVersion(C4S.Head.C4XVer[0],C4S.Head.C4XVer[1],C4S.Head.C4XVer[2],C4S.Head.C4XVer[3]) > 0)
|
||||
{
|
||||
|
@ -333,15 +329,6 @@ bool C4Game::Init()
|
|||
StartupPlayerCount = SModuleCount(PlayerFilenames);
|
||||
}
|
||||
|
||||
// In console builds, registered join only is forced; this is a limitation to
|
||||
// third-party dedicated servers which we want to keep from providing unlimited
|
||||
// numbers of free games to everybody. Only human hosts can allow non-registered
|
||||
// players to join. Exception: dedicated servers run by RWD may do this.
|
||||
#ifdef USE_CONSOLE
|
||||
if (!SEqual(Config.GetRegistrationData("Cuid"), "10694920"))
|
||||
RegJoinOnly = true;
|
||||
#endif
|
||||
|
||||
// Join a game?
|
||||
if(pJoinReference || *DirectJoinAddress)
|
||||
{
|
||||
|
@ -3681,31 +3668,6 @@ BOOL C4Game::CheckObjectEnumeration()
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL C4Game::CheckScenarioAccess()
|
||||
{
|
||||
|
||||
// Registered: all access
|
||||
if (Config.Registered()) return TRUE;
|
||||
|
||||
// replay OK, too
|
||||
if (C4S.Head.Replay) return TRUE;
|
||||
|
||||
// Scenario in free shareware folder
|
||||
C4Group *pFolder;
|
||||
if (C4S.Head.EnableUnregisteredAccess)
|
||||
if (pFolder = ScenarioFile.GetMother())
|
||||
if (Config.IsFreeFolder(pFolder->GetName(), pFolder->GetMaker()))
|
||||
return TRUE;
|
||||
|
||||
// Network join to any scenario okay (this is the new, great freedom)
|
||||
if (Network.isEnabled() && !Network.isHost())
|
||||
return TRUE;
|
||||
|
||||
// Nope
|
||||
return FALSE;
|
||||
|
||||
}
|
||||
|
||||
const char* C4Game::FoldersWithLocalsDefs(const char *szPath)
|
||||
{
|
||||
static char szDefs[10*_MAX_PATH+1];
|
||||
|
|
|
@ -707,13 +707,6 @@ bool C4ScenarioListLoader::Scenario::LoadCustom(C4Group &rGrp, bool fNameLoaded,
|
|||
// scenario name fallback to core
|
||||
if (!fNameLoaded)
|
||||
sName.Copy(C4S.Head.Title);
|
||||
// unregistered access
|
||||
C4Group *pFolder;
|
||||
fUnregisteredAccess = false;
|
||||
if (C4S.Head.EnableUnregisteredAccess)
|
||||
if (pFolder = rGrp.GetMother())
|
||||
if (Config.IsFreeFolder(pFolder->GetName(), pFolder->GetMaker()))
|
||||
fUnregisteredAccess = true;
|
||||
// difficulty: Set only for regular rounds (not savegame or record) to avoid bogus sorting
|
||||
if (!C4S.Head.SaveGame && !C4S.Head.Replay)
|
||||
iDifficulty = C4S.Head.Difficulty;
|
||||
|
@ -736,12 +729,6 @@ bool C4ScenarioListLoader::Scenario::CanOpen(StdStrBuf &sErrOut)
|
|||
// safety
|
||||
C4StartupScenSelDlg *pDlg = C4StartupScenSelDlg::pInstance;
|
||||
if (!pDlg) return false;
|
||||
// check unregistered access
|
||||
if (!Config.Registered() && !fUnregisteredAccess)
|
||||
{
|
||||
sErrOut.Copy(LoadResStr("IDS_MSG_NOUNREGISTERED"));
|
||||
return false;
|
||||
}
|
||||
// check mission access
|
||||
if (C4S.Head.MissionAccess[0] && !SIsModule(Config.General.MissionAccess, C4S.Head.MissionAccess))
|
||||
{
|
||||
|
@ -944,7 +931,7 @@ StdStrBuf C4ScenarioListLoader::Folder::GetOpenTooltip()
|
|||
|
||||
bool C4ScenarioListLoader::Folder::IsGrayed()
|
||||
{
|
||||
return !(Config.Registered() || Config.IsFreeFolder(sFilename.getData(), sMaker.getData()));
|
||||
return false;
|
||||
}
|
||||
|
||||
bool C4ScenarioListLoader::Folder::LoadCustomPre(C4Group &rGrp)
|
||||
|
|
Loading…
Reference in New Issue