Update to 1.10.0-beta1

This commit is contained in:
dP
2019-10-31 22:24:28 +03:00
parent b84a475e14
commit 599ccf0c2b
1470 changed files with 354219 additions and 16795 deletions
+37 -41
View File
@@ -25,10 +25,10 @@
#include "../safeguards.h"
/* static */ uint Game::frame_counter = 0;
/* static */ GameInfo *Game::info = NULL;
/* static */ GameInstance *Game::instance = NULL;
/* static */ GameScannerInfo *Game::scanner_info = NULL;
/* static */ GameScannerLibrary *Game::scanner_library = NULL;
/* static */ GameInfo *Game::info = nullptr;
/* static */ GameInstance *Game::instance = nullptr;
/* static */ GameScannerInfo *Game::scanner_info = nullptr;
/* static */ GameScannerLibrary *Game::scanner_library = nullptr;
/* static */ void Game::GameLoop()
{
@@ -36,7 +36,7 @@
PerformanceMeasurer::SetInactive(PFE_GAMESCRIPT);
return;
}
if (Game::instance == NULL) {
if (Game::instance == nullptr) {
PerformanceMeasurer::SetInactive(PFE_GAMESCRIPT);
return;
}
@@ -45,7 +45,7 @@
Game::frame_counter++;
Backup<CompanyByte> cur_company(_current_company, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, FILE_LINE);
cur_company.Change(OWNER_DEITY);
Game::instance->GameLoop();
cur_company.Restore();
@@ -58,11 +58,11 @@
/* static */ void Game::Initialize()
{
if (Game::instance != NULL) Game::Uninitialize(true);
if (Game::instance != nullptr) Game::Uninitialize(true);
Game::frame_counter = 0;
if (Game::scanner_info == NULL) {
if (Game::scanner_info == nullptr) {
TarScanner::DoScan(TarScanner::GAME);
Game::scanner_info = new GameScannerInfo();
Game::scanner_info->Initialize();
@@ -73,18 +73,18 @@
/* static */ void Game::StartNew()
{
if (Game::instance != NULL) return;
if (Game::instance != nullptr) return;
/* Clients shouldn't start GameScripts */
if (_networking && !_network_server) return;
GameConfig *config = GameConfig::GetConfig(GameConfig::SSS_FORCE_GAME);
GameInfo *info = config->GetInfo();
if (info == NULL) return;
if (info == nullptr) return;
config->AnchorUnchangeableSettings();
Backup<CompanyByte> cur_company(_current_company, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, FILE_LINE);
cur_company.Change(OWNER_DEITY);
Game::info = info;
@@ -98,11 +98,11 @@
/* static */ void Game::Uninitialize(bool keepConfig)
{
Backup<CompanyByte> cur_company(_current_company, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, FILE_LINE);
delete Game::instance;
Game::instance = NULL;
Game::info = NULL;
Game::instance = nullptr;
Game::info = nullptr;
cur_company.Restore();
@@ -111,33 +111,33 @@
} else {
delete Game::scanner_info;
delete Game::scanner_library;
Game::scanner_info = NULL;
Game::scanner_library = NULL;
Game::scanner_info = nullptr;
Game::scanner_library = nullptr;
if (_settings_game.game_config != NULL) {
if (_settings_game.game_config != nullptr) {
delete _settings_game.game_config;
_settings_game.game_config = NULL;
_settings_game.game_config = nullptr;
}
if (_settings_newgame.game_config != NULL) {
if (_settings_newgame.game_config != nullptr) {
delete _settings_newgame.game_config;
_settings_newgame.game_config = NULL;
_settings_newgame.game_config = nullptr;
}
}
}
/* static */ void Game::Pause()
{
if (Game::instance != NULL) Game::instance->Pause();
if (Game::instance != nullptr) Game::instance->Pause();
}
/* static */ void Game::Unpause()
{
if (Game::instance != NULL) Game::instance->Unpause();
if (Game::instance != nullptr) Game::instance->Unpause();
}
/* static */ bool Game::IsPaused()
{
return Game::instance != NULL? Game::instance->IsPaused() : false;
return Game::instance != nullptr? Game::instance->IsPaused() : false;
}
/* static */ void Game::NewEvent(ScriptEvent *event)
@@ -152,13 +152,13 @@
}
/* Check if Game instance is alive */
if (Game::instance == NULL) {
if (Game::instance == nullptr) {
event->Release();
return;
}
/* Queue the event */
Backup<CompanyByte> cur_company(_current_company, OWNER_DEITY, FILE_LINE);
Backup<CompanyID> cur_company(_current_company, OWNER_DEITY, FILE_LINE);
Game::instance->InsertEvent(event);
cur_company.Restore();
@@ -169,23 +169,23 @@
{
/* Check for both newgame as current game if we can reload the GameInfo inside
* the GameConfig. If not, remove the Game from the list. */
if (_settings_game.game_config != NULL && _settings_game.game_config->HasScript()) {
if (_settings_game.game_config != nullptr && _settings_game.game_config->HasScript()) {
if (!_settings_game.game_config->ResetInfo(true)) {
DEBUG(script, 0, "After a reload, the GameScript by the name '%s' was no longer found, and removed from the list.", _settings_game.game_config->GetName());
_settings_game.game_config->Change(NULL);
if (Game::instance != NULL) {
_settings_game.game_config->Change(nullptr);
if (Game::instance != nullptr) {
delete Game::instance;
Game::instance = NULL;
Game::info = NULL;
Game::instance = nullptr;
Game::info = nullptr;
}
} else if (Game::instance != NULL) {
} else if (Game::instance != nullptr) {
Game::info = _settings_game.game_config->GetInfo();
}
}
if (_settings_newgame.game_config != NULL && _settings_newgame.game_config->HasScript()) {
if (_settings_newgame.game_config != nullptr && _settings_newgame.game_config->HasScript()) {
if (!_settings_newgame.game_config->ResetInfo(false)) {
DEBUG(script, 0, "After a reload, the GameScript by the name '%s' was no longer found, and removed from the list.", _settings_newgame.game_config->GetName());
_settings_newgame.game_config->Change(NULL);
_settings_newgame.game_config->Change(nullptr);
}
}
}
@@ -206,8 +206,8 @@
/* static */ void Game::Save()
{
if (Game::instance != NULL && (!_networking || _network_server)) {
Backup<CompanyByte> cur_company(_current_company, OWNER_DEITY, FILE_LINE);
if (Game::instance != nullptr && (!_networking || _network_server)) {
Backup<CompanyID> cur_company(_current_company, OWNER_DEITY, FILE_LINE);
Game::instance->Save();
cur_company.Restore();
} else {
@@ -217,8 +217,8 @@
/* static */ void Game::Load(int version)
{
if (Game::instance != NULL && (!_networking || _network_server)) {
Backup<CompanyByte> cur_company(_current_company, OWNER_DEITY, FILE_LINE);
if (Game::instance != nullptr && (!_networking || _network_server)) {
Backup<CompanyID> cur_company(_current_company, OWNER_DEITY, FILE_LINE);
Game::instance->Load(version);
cur_company.Restore();
} else {
@@ -257,8 +257,6 @@
return Game::scanner_library->FindLibrary(library, version);
}
#if defined(ENABLE_NETWORK)
/**
* Check whether we have an Game (library) with the exact characteristics as ci.
* @param ci the characteristics to search on (shortname and md5sum)
@@ -275,8 +273,6 @@
return Game::scanner_library->HasScript(ci, md5sum);
}
#endif /* defined(ENABLE_NETWORK) */
/* static */ GameScannerInfo *Game::GetScannerInfo()
{
return Game::scanner_info;