771 } |
771 } |
772 |
772 |
773 static void UpdateTownRadius(Town *t) |
773 static void UpdateTownRadius(Town *t) |
774 { |
774 { |
775 static const uint16 _town_radius_data[23][5] = { |
775 static const uint16 _town_radius_data[23][5] = { |
776 { 4, 0, 0, 0, 0}, |
776 { 4, 0, 0, 0, 0}, // 0 |
777 {16, 0, 0, 0, 0}, |
777 {16, 0, 0, 0, 0}, |
778 {25, 0, 0, 0, 0}, |
778 {25, 0, 0, 0, 0}, |
779 {36, 0, 0, 0, 0}, |
779 {36, 0, 0, 0, 0}, |
780 {49, 0, 4, 0, 0}, |
780 {49, 0, 4, 0, 0}, |
781 {64, 0, 4, 0, 0}, |
781 {64, 0, 4, 0, 0}, // 20 |
782 {64, 0, 9, 0, 1}, |
782 {64, 0, 9, 0, 1}, |
783 {64, 0, 9, 0, 4}, |
783 {64, 0, 9, 0, 4}, |
784 {64, 0, 16, 0, 4}, |
784 {64, 0, 16, 0, 4}, |
785 {81, 0, 16, 0, 4}, |
785 {81, 0, 16, 0, 4}, |
786 {81, 0, 16, 0, 4}, |
786 {81, 0, 16, 0, 4}, // 40 |
787 {81, 0, 25, 0, 9}, |
787 {81, 0, 25, 0, 9}, |
788 {81, 36, 25, 0, 9}, |
788 {81, 36, 25, 0, 9}, |
789 {81, 36, 25, 16, 9}, |
789 {81, 36, 25, 16, 9}, |
790 {81, 49, 0, 25, 9}, |
790 {81, 49, 0, 25, 9}, |
791 {81, 64, 0, 25, 9}, |
791 {81, 64, 0, 25, 9}, // 60 |
792 {81, 64, 0, 36, 9}, |
792 {81, 64, 0, 36, 9}, |
793 {81, 64, 0, 36, 16}, |
793 {81, 64, 0, 36, 16}, |
794 { 0, 81, 0, 49, 16}, |
794 {100, 81, 0, 49, 16}, |
795 { 0, 81, 0, 49, 25}, |
795 {100, 81, 0, 49, 25}, |
796 { 0,100, 0, 49, 25}, |
796 {121, 81, 0, 49, 25}, // 80 |
797 { 0,100, 0, 64, 25}, |
797 {121, 81, 0, 49, 25}, |
798 { 0,100, 0, 64, 36}, |
798 {121, 81, 0, 49, 36}, // 88 |
799 }; |
799 }; |
800 int i = min(t->num_houses, 88) >> 2; |
800 |
801 memcpy(t->radius, _town_radius_data[i], sizeof(t->radius)); |
801 if (t->num_houses < 92) { |
|
802 memcpy(t->radius, _town_radius_data[t->num_houses / 4], sizeof(t->radius)); |
|
803 } else { |
|
804 int mass = t->num_houses / 8; |
|
805 // At least very roughly extrapolate. Empirical numbers dancing between |
|
806 // overwhelming by cottages and skyscrapers outskirts. |
|
807 t->radius[0] = mass * mass; |
|
808 // Actually we are proportional to sqrt() but that's right because |
|
809 // we are covering an area. |
|
810 t->radius[1] = mass * 7; |
|
811 t->radius[2] = 0; |
|
812 t->radius[3] = mass * 4; |
|
813 t->radius[4] = mass * 3; |
|
814 //debug("%d (->%d): %d %d %d %d\n", t->num_houses, mass, t->radius[0], t->radius[1], t->radius[3], t->radius[4]); |
|
815 } |
802 } |
816 } |
803 |
817 |
804 static void UpdateTownVirtCoord(Town *t) |
818 static void UpdateTownVirtCoord(Town *t) |
805 { |
819 { |
806 Point pt = RemapCoords2(GET_TILE_X(t->xy)*16, GET_TILE_Y(t->xy)*16); |
820 Point pt = RemapCoords2(GET_TILE_X(t->xy)*16, GET_TILE_Y(t->xy)*16); |
1596 } |
1610 } |
1597 |
1611 |
1598 t->flags12 &= ~1; |
1612 t->flags12 &= ~1; |
1599 |
1613 |
1600 if (t->fund_buildings_months != 0) { |
1614 if (t->fund_buildings_months != 0) { |
|
1615 static const byte _grow_count_values[6] = { |
|
1616 60, 60, 60, 50, 40, 30 |
|
1617 }; |
|
1618 m = _grow_count_values[min(n, 5)]; |
1601 t->fund_buildings_months--; |
1619 t->fund_buildings_months--; |
1602 m = 60; |
|
1603 } else if (n == 0) { |
1620 } else if (n == 0) { |
1604 m = 160; |
1621 m = 160; |
1605 if (!CHANCE16(1, 12)) |
1622 if (!CHANCE16(1, 12)) |
1606 return; |
1623 return; |
1607 } else { |
1624 } else { |