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

Valuating tile list and removing the very tile freezs OpenTTD #3124

Closed
DorpsGek opened this issue Aug 15, 2009 · 3 comments
Closed

Valuating tile list and removing the very tile freezs OpenTTD #3124

DorpsGek opened this issue Aug 15, 2009 · 3 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

LordAzamath opened the ticket and wrote:

When valuating in a tile list and doing area.RemoveTile(tileID) OpenTTD freezes.

function lordyAI::chooseGrowingCity() /* called from Start*/
{
local townList = AITownList();
townList.Valuate(AITown.GetPopulation);
townList.Sort(AIAbstractList.SORT_BY_VALUE,true);
local townID = townList.Begin();
local townLoc = AITown.GetLocation(townID)
local townRoadTiles = AITileList()
/* create rectangle /
local area = AITileList();
area.AddRectangle(townLoc - AIMap.GetTileIndex(5, 5), townLoc + AIMap.GetTileIndex(5, 5));
area.Valuate(getRoads,area)
}
function lordyAI::getRoads(tileID,area)
{
local boolean = AIRoad.IsRoadTile(tileID)
if (!boolean)
{
area.RemoveTile(tileID) /
this part freezes */
}
return boolean;
}

Reported version: 0.7.2
Operating system: All


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

LordAzamath wrote:

Added a testing AI which will nicely freeze your OpenTTD.
However, I tested it with just removing the tile inside the valuator and it didn't freeze..

Currently it freezes as you start it. If you comment out line 52 in main.nut, it won't freeze.

Attachments


This comment was imported from FlySpray: https://bugs.openttd.org/task/3124#comment6494

@DorpsGek
Copy link
Member Author

Rubidium wrote:

The famous... stl doesn't like you removing stuff when it's being iterated.


This comment was imported from FlySpray: https://bugs.openttd.org/task/3124#comment6495

@DorpsGek
Copy link
Member Author

Rubidium closed the ticket.

Reason for closing: Fixed

r17193


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

@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