I'm not sure I understand. You want to record tubes that are pre-existing? I'm guessing you tried using the cell type, and found that buildings have tube cell types, which has foiled that plan, so now you want to examine tile indexes?
I believe the tube tiles are consecutive, so if you get the index to the first one, you'll have a range of 16 tiles to check for. I assume you want to limit the search to some smaller region though, so you don't record tubes from an enemy base. You know, attack of the earthworkers and such if they ever lose a tube.
Ok, so... the starting indexes of tubes tiles, by terrain type are:
Rock: 929
Mud: 417
Sand: 1678
Each one is consecutive for 16 tiles.
Ex: [929..(929+16-1)] <- Endpoint inclusive
Ex: [929...(929+16)] <- Endpoint exclusive
In case you need to know the directionality, I'll release a VB project that lets you view the tile groups found at the end of .map files.
Yes, that was my plan: rather than manually record all of the tubes that the AI needs to rebuild, I wanted to automate the process. I did however know that underneath buildings was also considered "tube 0." I thought this would actually be neato as the AI would build tubes where destroyed structures used to be, meaning that even if the structure took awhile to get rebuilt, a tube would be built so things wouldn't disabled for extended periods of time. Of course, the plan didn't quite work as I had hoped, as the AI awkwardly tubed under the entire structure...
Anyways, back to what I'm looking for. In this code, tile IDs are used to determine lava possible tiles:
// SetAllLava:
// light lavarock: 1C7-1D6
// dark lavarock: 1D7-1F8
// edges: 22F-25E (between light & dark lavarock)
void SetAllLava()
{
int x,y,tile;
LOCATION mapsize(1024,1024); // create a point wayoff the map
mapsize.Clip(); // clip it, so we have the mapsize
for (y=0; y<mapsize.y; ++y) // run through all rows
{
for (x=31; x<mapsize.x+32; ++x) // check every tile on each row
{
tile=GameMap::GetTile(LOCATION(x,y)); // get the tile on that position
if ( ((tile>=0x1C7) && (tile<=0x1F8)) // is this one a lavarock...
|| ((tile>=0x22F) && (tile<=0x25E)) ) // ...or an edge ?
{
GameMap::SetLavaPossible(LOCATION(x,y),true); // -> then set it to LavaPossible
}
}
}
}
I want something that does the exact same thing, except instead of finding black rock tiles and setting them lava possible, it finds tube tiles and records them to a build group. All I need from you is a list of tile IDs, and I can do the rest myself.