Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AISign::BuildSign returns 0 after failed sign construction #4886

Closed
DorpsGek opened this issue Dec 14, 2011 · 4 comments
Closed

AISign::BuildSign returns 0 after failed sign construction #4886

DorpsGek opened this issue Dec 14, 2011 · 4 comments
Labels
component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)

Comments

@DorpsGek
Copy link
Member

Kogut opened the ticket and wrote:

r23510
"The SignID of the build sign (use IsValidSign() to check for validity)." suggests that IsValidSign(AISign.BuildSign(foo, bar)) should be false if and only if AISign.BuildSign failed to create sign. Unfortunately sometimes it is untrue. See attached TOWN ai

function TOWN::Start()
{
//Create signs with id 0:
AILog.Info(AISign.BuildSign(AIMap.GetTileIndex(5, 5), "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"))

//Sign 0 is valid:
AILog.Info(AISign.IsValidSign(0));

//This (failed) function will return 0:
AILog.Info(AISign.BuildSign(AIMap.GetTileIndex(1, 1), "xxxxxxxxxxxxxx long name xxxxxxxxxxxxxxxxxxxxx"))

//But sign 0 is still valid:
AILog.Info(AISign.IsValidSign(0));
}

to replicate: start TOWN ai on new map without signs.

Attachments

Reported version: trunk
Operating system: Windows


This issue was imported from FlySpray: https://bugs.openttd.org/task/4886
@DorpsGek
Copy link
Member Author

Kogut wrote:

noai documentation link: http://noai.openttd.org/api/trunk/classAISign.html# 73b5624649d8d921e85815b44f9ec6b7


This comment was imported from FlySpray: https://bugs.openttd.org/task/4886#comment10569

@DorpsGek
Copy link
Member Author

Kogut wrote:

Workaround: use if(AIError.GetLastError()!=AIError.ERR_NONE) to check whatever sign was placed.


This comment was imported from FlySpray: https://bugs.openttd.org/task/4886#comment10570

@DorpsGek
Copy link
Member Author

frosch closed the ticket.

Reason for closing: Fixed

in r23516


This comment was imported from FlySpray: https://bugs.openttd.org/task/4886

@DorpsGek
Copy link
Member Author

frosch wrote:

The problem was actually only triggered when sign construction failed due to a too long text.


This comment was imported from FlySpray: https://bugs.openttd.org/task/4886#comment10572

@DorpsGek DorpsGek added flyspray This issue is imported from FlySpray (https://bugs.openttd.org/) bug component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) labels Apr 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: AI/Game script (squirrel) This issue is related to Squirrel (Scripting language) flyspray This issue is imported from FlySpray (https://bugs.openttd.org/)
Projects
None yet
Development

No branches or pull requests

1 participant