summaryrefslogtreecommitdiff
path: root/src/story.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/story.cpp')
-rw-r--r--src/story.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/story.cpp b/src/story.cpp
index e60c60a9f..641ed7fbf 100644
--- a/src/story.cpp
+++ b/src/story.cpp
@@ -204,7 +204,7 @@ bool StoryPageButtonData::ValidateVehicleType() const
* @param text Title of the story page. Null is allowed in which case a generic page title is provided by OpenTTD.
* @return the cost of this operation or an error
*/
-CommandCost CmdCreateStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdCreateStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
{
if (!StoryPage::CanAllocateItem()) return CMD_ERROR;
@@ -223,10 +223,10 @@ CommandCost CmdCreateStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, u
s->sort_value = _story_page_next_sort_value;
s->date = _date;
s->company = company;
- if (StrEmpty(text)) {
+ if (text.empty()) {
s->title = nullptr;
} else {
- s->title = stredup(text);
+ s->title = stredup(text.c_str());
}
InvalidateWindowClassesData(WC_STORY_BOOK, -1);
@@ -250,7 +250,7 @@ CommandCost CmdCreateStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, u
* @param text Text content in case it is a text or location page element
* @return the cost of this operation or an error
*/
-CommandCost CmdCreateStoryPageElement(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdCreateStoryPageElement(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
{
if (!StoryPageElement::CanAllocateItem()) return CMD_ERROR;
@@ -266,7 +266,7 @@ CommandCost CmdCreateStoryPageElement(TileIndex tile, DoCommandFlag flags, uint3
if (_current_company != OWNER_DEITY) return CMD_ERROR;
if (!StoryPage::IsValidID(page_id)) return CMD_ERROR;
- if (!VerifyElementContentParameters(page_id, type, tile, p2, text)) return CMD_ERROR;
+ if (!VerifyElementContentParameters(page_id, type, tile, p2, text.c_str())) return CMD_ERROR;
if (flags & DC_EXEC) {
if (_story_page_element_pool.items == 0) {
@@ -278,7 +278,7 @@ CommandCost CmdCreateStoryPageElement(TileIndex tile, DoCommandFlag flags, uint3
pe->sort_value = _story_page_element_next_sort_value;
pe->type = type;
pe->page = page_id;
- UpdateElement(*pe, tile, p2, text);
+ UpdateElement(*pe, tile, p2, text.c_str());
InvalidateWindowClassesData(WC_STORY_BOOK, page_id);
@@ -300,7 +300,7 @@ CommandCost CmdCreateStoryPageElement(TileIndex tile, DoCommandFlag flags, uint3
* @param text Text content in case it is a text or location page element
* @return the cost of this operation or an error
*/
-CommandCost CmdUpdateStoryPageElement(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdUpdateStoryPageElement(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
{
StoryPageElementID page_element_id = (StoryPageElementID)GB(p1, 0, 16);
@@ -311,10 +311,10 @@ CommandCost CmdUpdateStoryPageElement(TileIndex tile, DoCommandFlag flags, uint3
StoryPageID page_id = pe->page;
StoryPageElementType type = pe->type;
- if (!VerifyElementContentParameters(page_id, type, tile, p2, text)) return CMD_ERROR;
+ if (!VerifyElementContentParameters(page_id, type, tile, p2, text.c_str())) return CMD_ERROR;
if (flags & DC_EXEC) {
- UpdateElement(*pe, tile, p2, text);
+ UpdateElement(*pe, tile, p2, text.c_str());
InvalidateWindowClassesData(WC_STORY_BOOK, pe->page);
}
@@ -330,7 +330,7 @@ CommandCost CmdUpdateStoryPageElement(TileIndex tile, DoCommandFlag flags, uint3
* @param text title text of the story page.
* @return the cost of this operation or an error
*/
-CommandCost CmdSetStoryPageTitle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdSetStoryPageTitle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
{
if (_current_company != OWNER_DEITY) return CMD_ERROR;
StoryPageID page_id = (StoryPageID)GB(p1, 0, 16);
@@ -339,10 +339,10 @@ CommandCost CmdSetStoryPageTitle(TileIndex tile, DoCommandFlag flags, uint32 p1,
if (flags & DC_EXEC) {
StoryPage *p = StoryPage::Get(page_id);
free(p->title);
- if (StrEmpty(text)) {
+ if (text.empty()) {
p->title = nullptr;
} else {
- p->title = stredup(text);
+ p->title = stredup(text.c_str());
}
InvalidateWindowClassesData(WC_STORY_BOOK, page_id);
@@ -360,7 +360,7 @@ CommandCost CmdSetStoryPageTitle(TileIndex tile, DoCommandFlag flags, uint32 p1,
* @param text unused
* @return the cost of this operation or an error
*/
-CommandCost CmdSetStoryPageDate(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdSetStoryPageDate(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
{
if (_current_company != OWNER_DEITY) return CMD_ERROR;
StoryPageID page_id = (StoryPageID)GB(p1, 0, 16);
@@ -387,7 +387,7 @@ CommandCost CmdSetStoryPageDate(TileIndex tile, DoCommandFlag flags, uint32 p1,
* @param text unused
* @return the cost of this operation or an error
*/
-CommandCost CmdShowStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdShowStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
{
if (_current_company != OWNER_DEITY) return CMD_ERROR;
StoryPageID page_id = (StoryPageID)GB(p1, 0, 16);
@@ -409,7 +409,7 @@ CommandCost CmdShowStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
* @param text unused.
* @return the cost of this operation or an error
*/
-CommandCost CmdRemoveStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRemoveStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
{
if (_current_company != OWNER_DEITY) return CMD_ERROR;
StoryPageID page_id = (StoryPageID)p1;
@@ -442,7 +442,7 @@ CommandCost CmdRemoveStoryPage(TileIndex tile, DoCommandFlag flags, uint32 p1, u
* @param text unused.
* @return the cost of this operation or an error
*/
-CommandCost CmdRemoveStoryPageElement(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdRemoveStoryPageElement(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
{
if (_current_company != OWNER_DEITY) return CMD_ERROR;
StoryPageElementID page_element_id = (StoryPageElementID)p1;
@@ -469,7 +469,7 @@ CommandCost CmdRemoveStoryPageElement(TileIndex tile, DoCommandFlag flags, uint3
* @param text Unused.
* @return The cost of the operation, or an error.
*/
-CommandCost CmdStoryPageButton(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
+CommandCost CmdStoryPageButton(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const std::string &text)
{
StoryPageElementID page_element_id = (StoryPageElementID)GB(p1, 0, 16);