HG版本更新记录
cphj 2010-06-02 12:49:11 parent: 3:cd856cb2612e 添加植物生长功能
tags: tip
修正地图界限设置的边界值
=== Nano/Ecology.cpp ===
@@ -31,7 +31,7 @@
{
plants.resize(right - left + 1, bottom - top + 1);
for (size_t i=1; i<SATURATION_PLANTS_N/2; i++)
- plants.insert(RandRange(left, right), RandRange(top, bottom - 1), Plant());
+ plants.insert(RandRange(left, right), RandRange(top, bottom), Plant());
Animal::PreCreate();
animals.resize(SATURATION_ANIMALS_N / 2);
@@ -132,7 +132,7 @@
double growprob = y * (1 - y);
if (RandRange(0.0, 1.0) < growprob)
{
- plants.insert(RandRange(left, right), RandRange(top, bottom - 1), Plant());
+ plants.insert(RandRange(left, right), RandRange(top, bottom), Plant());
SetPixel(hdc, plants.index2coordx[plants.count()], plants.index2coordy[plants.count()], RGB(0, 128, 0));
}
}
=== Nano/GUI.cpp ===
@@ -25,7 +25,7 @@
case WM_CREATE:
RandSeed();
GetClientRect(hwnd, &rect);
- Ecology::SetBound(rect.left, rect.top, rect.right, DRAW_HEIGHT);
+ Ecology::SetBound(rect.left, rect.top, rect.right - 1, DRAW_HEIGHT - 1);
ecology.Create();
break;