JeBuS27
Heretic
- Joined
- Sep 21, 2005
- Messages
- 321
So, let me start off by saying that I've been modifying AssignStartingPlots.lua in an attempt to make things more modular. The amount of changes I've made is ridiculous, so I won't post it here. But that's also the problem, as I've changed so much, I can't narrow down where this bug is occurring. Now the reason for this post.
I have been noticing that Wheat and Deer are appearing on Mountain plots. I haven't noticed any other bonus resources appearing on them, but I may just not have seen it yet.
Now, I know what you're thinking: I must have goofed something up to allow the resources to be placed on Mountains. And I'd agree with you, it's the assumption I've been working under for hours now. Eventually I got sick of looking for the bug, and I started printing out debug info about the terrain that resources were being placed on. Nowhere did Mountain show up.
So, I stuck this bit of code at the end of AssignStartingPlots
laceResourcesAndCityStates
What that does is loop through every plot on the map, and if it has a resource, it prints the resource and the terrain type of the plot.
The problem is, nowhere does TERRAIN_MOUNTAIN show up in that list. And yet, if I explore the map, I'll usually find wheat or deer sitting on a mountain.
I'm out of ideas.
Additional info:
I added x,y coordinates to the printout, and have found that when wheat appears on mountains, they're printed out as plains. When deer appear on mountains, they're printed as tundra. If Lua sees them that way, why do they appear as mountains (and get labeled as such on mouseover)?
I have been noticing that Wheat and Deer are appearing on Mountain plots. I haven't noticed any other bonus resources appearing on them, but I may just not have seen it yet.
Now, I know what you're thinking: I must have goofed something up to allow the resources to be placed on Mountains. And I'd agree with you, it's the assumption I've been working under for hours now. Eventually I got sick of looking for the bug, and I started printing out debug info about the terrain that resources were being placed on. Nowhere did Mountain show up.
So, I stuck this bit of code at the end of AssignStartingPlots

Code:
local iW, iH = Map.GetGridSize();
for y = 0, iH - 1 do
for x = 0, iW - 1 do
local plot = Map.GetPlot(x, y);
local resourceType = plot:GetResourceType();
local terrainType = plot:GetTerrainType();
if resourceType ~= -1 then
print("Placed "..GameInfo.Resources[resourceType].Type.." on "..GameInfo.Terrains[terrainType].Type..".");
end
end
end
The problem is, nowhere does TERRAIN_MOUNTAIN show up in that list. And yet, if I explore the map, I'll usually find wheat or deer sitting on a mountain.
I'm out of ideas.
Additional info:
I added x,y coordinates to the printout, and have found that when wheat appears on mountains, they're printed out as plains. When deer appear on mountains, they're printed as tundra. If Lua sees them that way, why do they appear as mountains (and get labeled as such on mouseover)?