Codechange: Remove CCountedPtr.

This was originally generic and used by YAPF, but now it is used only by script objects.

CCountedPtr provided much more (untested) functionality than used.

ScriptObjectRef already exists for script objects and does the same thing, so use this instead.
This commit is contained in:
Peter Nelson
2024-10-16 00:16:43 +01:00
committed by Peter Nelson
parent d8029b1d84
commit 8360fab18a
18 changed files with 66 additions and 282 deletions

View File

@@ -26,9 +26,9 @@
/* static */ ScriptLeagueTable::LeagueTableID ScriptLeagueTable::New(Text *title, Text *header, Text *footer)
{
CCountedPtr<Text> title_counter(title);
CCountedPtr<Text> header_counter(header);
CCountedPtr<Text> footer_counter(footer);
ScriptObjectRef title_counter(title);
ScriptObjectRef header_counter(header);
ScriptObjectRef footer_counter(footer);
EnforceDeityMode(LEAGUE_TABLE_INVALID);
EnforcePrecondition(LEAGUE_TABLE_INVALID, title != nullptr);
@@ -51,8 +51,8 @@
/* static */ ScriptLeagueTable::LeagueTableElementID ScriptLeagueTable::NewElement(ScriptLeagueTable::LeagueTableID table, SQInteger rating, ScriptCompany::CompanyID company, Text *text, Text *score, LinkType link_type, SQInteger link_target)
{
CCountedPtr<Text> text_counter(text);
CCountedPtr<Text> score_counter(score);
ScriptObjectRef text_counter(text);
ScriptObjectRef score_counter(score);
EnforceDeityMode(LEAGUE_TABLE_ELEMENT_INVALID);
@@ -80,7 +80,7 @@
/* static */ bool ScriptLeagueTable::UpdateElementData(LeagueTableElementID element, ScriptCompany::CompanyID company, Text *text, LinkType link_type, SQInteger link_target)
{
CCountedPtr<Text> text_counter(text);
ScriptObjectRef text_counter(text);
EnforceDeityMode(false);
EnforcePrecondition(false, IsValidLeagueTableElement(element));
@@ -100,7 +100,7 @@
/* static */ bool ScriptLeagueTable::UpdateElementScore(LeagueTableElementID element, SQInteger rating, Text *score)
{
CCountedPtr<Text> score_counter(score);
ScriptObjectRef score_counter(score);
EnforceDeityMode(false);
EnforcePrecondition(false, IsValidLeagueTableElement(element));