[Freeciv-Dev] (PR#6170) Alternative city square utilizations
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Ok first part of the work.
With this patch you can change the defines in city.h and the game will
run. (that was not so easy i thought first so i send the patch)
Tested with CITY_MAP_RADIUS 3 and really quickly with CITY_MAP_RADIUS 1.
Please review.
Note: you need to set correctly both CITY_MAP_RADIUS && CITY_TILES.
The attached patch make CITY_MAP_RADIUS 3 (but you can backchange it)
Remi
diff -u -r -Xdiff_ignore ../freeciv/client/citydlg_common.c
./client/citydlg_common.c
--- ../freeciv/client/citydlg_common.c 2003-08-06 09:22:44.000000000 +0200
+++ ./client/citydlg_common.c 2003-10-15 20:18:00.000000000 +0200
@@ -33,9 +33,9 @@
int get_citydlg_canvas_width(void)
{
if (is_isometric) {
- return 4 * NORMAL_TILE_WIDTH;
+ return (CITY_MAP_SIZE - 1) * NORMAL_TILE_WIDTH;
} else {
- return 5 * NORMAL_TILE_WIDTH;
+ return CITY_MAP_SIZE * NORMAL_TILE_WIDTH;
}
}
@@ -45,9 +45,9 @@
int get_citydlg_canvas_height(void)
{
if (is_isometric) {
- return 4 * NORMAL_TILE_HEIGHT;
+ return (CITY_MAP_SIZE - 1) * NORMAL_TILE_HEIGHT;
} else {
- return 5 * NORMAL_TILE_HEIGHT;
+ return CITY_MAP_SIZE * NORMAL_TILE_HEIGHT;
}
}
@@ -64,7 +64,7 @@
* subtract off half a tile in each direction. For a more
* rigorous example, see map_pos_to_canvas_pos().
*/
- int iso_x = (city_x - city_y) - (-4);
+ int iso_x = (city_x - city_y) + (2 * CITY_MAP_RADIUS);
int iso_y = (city_x + city_y) - (0);
*canvas_x = (iso_x - 1) * NORMAL_TILE_WIDTH / 2;
@@ -74,10 +74,8 @@
*canvas_y = city_y * NORMAL_TILE_HEIGHT;
}
- if (!is_valid_city_coords(city_x, city_y)) {
- assert(FALSE);
- return FALSE;
- }
+ assert(is_valid_city_coords(city_x, city_y));
+
return TRUE;
}
diff -u -r -Xdiff_ignore ../freeciv/client/packhand.c ./client/packhand.c
--- ../freeciv/client/packhand.c 2003-10-16 17:20:13.000000000 +0200
+++ ./client/packhand.c 2003-10-16 17:19:35.000000000 +0200
@@ -2524,6 +2524,9 @@
game.rgame.granary_food_inc = packet->granary_food_inc;
game.rgame.tech_cost_style = packet->tech_cost_style;
game.rgame.tech_leakage = packet->tech_leakage;
+
+ /* It is not really from the ruleset but later it will be */
+ generate_city_map_indices(CITY_MAP_RADIUS);
}
/**************************************************************************
diff -u -r -Xdiff_ignore ../freeciv/common/aicore/cm.c ./common/aicore/cm.c
--- ../freeciv/common/aicore/cm.c 2003-10-03 15:28:54.000000000 +0200
+++ ./common/aicore/cm.c 2003-10-10 21:01:00.000000000 +0200
@@ -148,7 +148,7 @@
#define DISABLE_CACHE3 FALSE
#define NUM_SPECIALISTS_ROLES 3
-#define MAX_FIELDS_USED (CITY_MAP_SIZE * CITY_MAP_SIZE - 4 - 1)
+#define MAX_FIELDS_USED (CITY_TILES - 1)
#define MAX_COMBINATIONS 150
/* Maps scientists and taxmen to result for a certain combination. */
@@ -1163,11 +1163,14 @@
*/
root_combination.worker = 0;
root_combination.production2[FOOD] =
- base_city_get_food_tile(2, 2, pcity, is_celebrating);
+ base_city_get_food_tile(CITY_MAP_RADIUS, CITY_MAP_RADIUS,
+ pcity, is_celebrating);
root_combination.production2[SHIELD] =
- base_city_get_shields_tile(2, 2, pcity, is_celebrating);
+ base_city_get_shields_tile(CITY_MAP_RADIUS, CITY_MAP_RADIUS,
+ pcity, is_celebrating);
root_combination.production2[TRADE] =
- base_city_get_trade_tile(2, 2, pcity, is_celebrating);
+ base_city_get_trade_tile(CITY_MAP_RADIUS, CITY_MAP_RADIUS,
+ pcity, is_celebrating);
total_tile_trade = root_combination.production2[TRADE];
diff -u -r -Xdiff_ignore ../freeciv/common/city.c ./common/city.c
--- ../freeciv/common/city.c 2003-10-02 15:11:10.000000000 +0200
+++ ./common/city.c 2003-10-15 20:58:25.000000000 +0200
@@ -56,21 +56,24 @@
bool asmiths);
/* Iterate a city map, from the center (the city) outwards */
+int** city_map_iterate_outwards_indices;
-int city_map_iterate_outwards_indices[CITY_TILES][2] =
-{
- { 2, 2 },
-
- { 1, 2 }, { 2, 1 }, { 3, 2 }, { 2, 3 },
- { 1, 3 }, { 1, 1 }, { 3, 1 }, { 3, 3 },
+/* Unused for the moment. Later maybe... */
+int* available_tiles;
- { 0, 2 }, { 2, 0 }, { 4, 2 }, { 2, 4 },
- { 0, 3 }, { 0, 1 },
- { 1, 0 }, { 3, 0 },
- { 4, 1 }, { 4, 3 },
- { 3, 4 }, { 1, 4 }
+/* Chained list Structure and helper function for generate_city_map_indices */
+struct chained_dists {
+ int dist;
+ int x, y;
+ struct chained_dists *prev;
+ struct chained_dists *next;
};
+#define BIG_DIST (1000 * 1000)
+
+struct chained_dists* insert_chained_dists(struct chained_dists *iter,
+ int x, int y, int dist);
+
struct citystyle *city_styles = NULL;
/**************************************************************************
@@ -78,15 +81,22 @@
**************************************************************************/
bool is_valid_city_coords(const int city_x, const int city_y)
{
- if ((city_x == 0 || city_x == CITY_MAP_SIZE-1)
- && (city_y == 0 || city_y == CITY_MAP_SIZE-1))
- return FALSE;
- if (city_x < 0 || city_y < 0
- || city_x >= CITY_MAP_SIZE
- || city_y >= CITY_MAP_SIZE)
+ /* Why +1 here? Small schemas:
+ * Without | With
+ * 3 333
+ * 33233 32223
+ * 32123 3211123
+ * 3210123 3210123
+ * 32123 3211123
+ * 33233 32223
+ * 3 333 */
+ if (CITY_MAP_RADIUS * CITY_MAP_RADIUS + 1>=
+ (city_x - CITY_MAP_RADIUS) * (city_x - CITY_MAP_RADIUS) +
+ (city_y - CITY_MAP_RADIUS) * (city_y - CITY_MAP_RADIUS)) {
+ return TRUE;
+ } else {
return FALSE;
-
- return TRUE;
+ }
}
/**************************************************************************
@@ -94,8 +104,7 @@
**************************************************************************/
bool is_city_center(int city_x, int city_y)
{
- return (city_x == (CITY_MAP_SIZE / 2))
- && (city_y == (CITY_MAP_SIZE / 2));
+ return CITY_MAP_RADIUS == city_x && CITY_MAP_RADIUS == city_y;
}
/**************************************************************************
@@ -108,8 +117,8 @@
{
map_distance_vector(city_map_x, city_map_y,
city_center_x, city_center_y, map_x, map_y);
- *city_map_x += CITY_MAP_SIZE / 2;
- *city_map_y += CITY_MAP_SIZE / 2;
+ *city_map_x += CITY_MAP_RADIUS;
+ *city_map_y += CITY_MAP_RADIUS;
return is_valid_city_coords(*city_map_x, *city_map_y);
}
@@ -134,8 +143,8 @@
int city_map_x, int city_map_y)
{
assert(is_valid_city_coords(city_map_x, city_map_y));
- *map_x = city_center_x + city_map_x - CITY_MAP_SIZE / 2;
- *map_y = city_center_y + city_map_y - CITY_MAP_SIZE / 2;
+ *map_x = city_center_x + city_map_x - CITY_MAP_RADIUS;
+ *map_y = city_center_y + city_map_y - CITY_MAP_RADIUS;
return normalize_map_pos(map_x, map_y);
}
@@ -152,6 +161,115 @@
}
/**************************************************************************
+ Insert a new struct chained_dists in the global list. the new one is placed
+ after the iter parameter. Note that iter and iter->next must not be NULL.
+**************************************************************************/
+struct chained_dists* insert_chained_dists(struct chained_dists *iter,
+ int x, int y, int dist)
+{
+ struct chained_dists *new_struct = fc_malloc(sizeof(struct chained_dists));
+
+ new_struct->next = iter->next;
+ iter->next->prev = new_struct;
+ new_struct->prev = iter;
+ iter->next = new_struct;
+
+ new_struct->dist = dist;
+ new_struct->x = x;
+ new_struct->y = y;
+
+ return new_struct;
+}
+
+/**************************************************************************
+ Fill the iterate_outwards_indices arrays. The int inside the array are
+ signed. iterate_outwards will later add CITY_MAP_RADIUS to each coord.
+***************************************************************************/
+void generate_city_map_indices(int max_radius)
+{
+ struct chained_dists *iter;
+ int x, y, max_dist = max_radius * max_radius + 1;
+ int dist, i = 0;
+
+ assert(max_radius >= 0);
+
+ /* Create the two bounds */
+ iter = fc_malloc(sizeof(struct chained_dists));
+ iter->next = fc_malloc(sizeof(struct chained_dists));
+ iter->prev = NULL;
+ iter->dist = -1;
+
+ iter->next->next = NULL;
+ iter->next->prev = iter;
+ iter->next->dist = BIG_DIST;
+
+ /* Create the chained list, ordered by ascending dist */
+ for (x = -max_radius; x <= max_radius; x++) {
+ for (y = -max_radius; y <= max_radius; y++) {
+ dist = x * x + y * y;
+
+ if (dist <= max_dist) {
+ while (1) {
+ if (dist == iter->dist) {
+ iter = insert_chained_dists(iter, x, y, dist);
+ i++;
+ break;
+ }
+ if (dist < iter->dist) {
+ if (dist >= iter->prev->dist) {
+ iter = insert_chained_dists(iter->prev, x, y, dist);
+ i++;
+ break;
+ } else {
+ iter = iter->prev;
+ }
+ } else {
+ if (dist <= iter->next->dist) {
+ iter = insert_chained_dists(iter, x, y, dist);
+ i++;
+ break;
+ } else {
+ iter = iter->next;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* Makes iter pointing to the the second iter. First is bound. */
+ while (iter->prev->prev) {
+ iter = iter->prev;
+ }
+
+ /* Is the CITY_TILES define correctly set? */
+ assert(CITY_TILES == i);
+
+ /* Alloc the arrays */
+ city_map_iterate_outwards_indices = fc_malloc(sizeof(int*) * i);
+ available_tiles = fc_malloc(sizeof(int) * (max_radius + 1));
+
+ i = 0;
+ dist = 0;
+
+ /* Browse the list and put it into the array */
+ while (iter->next) {
+ if (dist * dist + 1 < iter->dist) {
+ available_tiles[dist] = i;
+ dist++;
+ assert(dist <= max_radius);
+ }
+
+ city_map_iterate_outwards_indices[i] = fc_malloc(2 * sizeof(int));
+ city_map_iterate_outwards_indices[i][0] = iter->x;
+ city_map_iterate_outwards_indices[i][1] = iter->y;
+
+ i++;
+ iter = iter->next;
+ }
+}
+
+/**************************************************************************
Set the worker on the citymap. Also sets the worked field in the map.
**************************************************************************/
void set_worker_city(struct city *pcity, int city_x, int city_y,
@@ -835,7 +953,7 @@
}
/* game.rgame.min_dist_bw_cities minimum is 1, meaning adjacent is okay */
- square_iterate(x, y, game.rgame.min_dist_bw_cities-1, x1, y1) {
+ square_iterate(x, y, game.rgame.min_dist_bw_cities - 1, x1, y1) {
if (map_get_city(x1, y1)) {
return FALSE;
}
diff -u -r -Xdiff_ignore ../freeciv/common/city.h ./common/city.h
--- ../freeciv/common/city.h 2003-10-02 15:11:10.000000000 +0200
+++ ./common/city.h 2003-10-15 19:11:39.000000000 +0200
@@ -58,13 +58,17 @@
/* for new city: default auto-attack options all on, others off: */
#define CITYOPT_DEFAULT (CITYOPT_AUTOATTACK_BITS)
+
+/* radius of workable area */
+#define CITY_MAP_RADIUS 3
+
/* Diameter of the workable city area. Must be an odd number.
Some places in the code hardcodes this number, fx
city_map_iterate_outwards_indices */
-#define CITY_MAP_SIZE 5
+#define CITY_MAP_SIZE (CITY_MAP_RADIUS * 2 + 1)
/* Number of tiles a city can use */
-#define CITY_TILES (CITY_MAP_SIZE * CITY_MAP_SIZE - 4)
+#define CITY_TILES 37
#define INCITE_IMPOSSIBLE_COST (1000 * 1000 * 1000)
@@ -82,38 +86,39 @@
/* Iterate a city map */
-#define city_map_iterate(x, y) \
-{ \
- int x, y; \
- for (y = 0; y < CITY_MAP_SIZE; y++) \
- for (x = 0; x < CITY_MAP_SIZE; x++) \
- if (! ((x == 0 || x == (CITY_MAP_SIZE-1)) && \
- (y == 0 || y == (CITY_MAP_SIZE-1))) )
+#define city_map_iterate(x, y) \
+{ \
+ int x, y; \
+ for (y = 0; y < CITY_MAP_SIZE; y++) \
+ for (x = 0; x < CITY_MAP_SIZE; x++) \
+ if (is_valid_city_coords(x, y))
#define city_map_iterate_end \
}
/* Iterate a city map, from the center (the city) outwards */
-extern int city_map_iterate_outwards_indices[CITY_TILES][2];
+extern int** city_map_iterate_outwards_indices;
/* Iterate a city map, from the center (the city) outwards. x and y
will be elements of [0, CITY_MAP_SIZE). */
-#define city_map_iterate_outwards(x, y) {
\
- int x, y;
\
- int city_map_iterate_outwards_index;
\
- for
\
- (
\
- city_map_iterate_outwards_index = 0;
\
- city_map_iterate_outwards_index < CITY_TILES;
\
- city_map_iterate_outwards_index++
\
- )
\
- {
\
- x = city_map_iterate_outwards_indices[city_map_iterate_outwards_index][0];
\
- y = city_map_iterate_outwards_indices[city_map_iterate_outwards_index][1];
+#define city_map_iterate_outwards(x, y) { \
+ int x, y; \
+ int city_map_iterate_outwards_index; \
+ for \
+ ( \
+ city_map_iterate_outwards_index = 0; \
+ city_map_iterate_outwards_index < CITY_TILES; \
+ city_map_iterate_outwards_index++ \
+ ) \
+ { \
+ x = CITY_MAP_RADIUS + \
+ city_map_iterate_outwards_indices[city_map_iterate_outwards_index][0]; \
+ y = CITY_MAP_RADIUS + \
+ city_map_iterate_outwards_indices[city_map_iterate_outwards_index][1];
-#define city_map_iterate_outwards_end
\
- }
\
+#define city_map_iterate_outwards_end \
+ } \
}
/*
@@ -187,14 +192,14 @@
/* Used for caching when settlers evalueate which tile to improve,
and when we place workers. */
- signed short int detox[5][5];
- signed short int derad[5][5];
- signed short int mine[5][5];
- signed short int irrigate[5][5];
- signed short int road[5][5];
- signed short int railroad[5][5];
- signed short int transform[5][5];
- signed short int tile_value[5][5];
+ signed short int detox[CITY_MAP_SIZE][CITY_MAP_SIZE];
+ signed short int derad[CITY_MAP_SIZE][CITY_MAP_SIZE];
+ signed short int mine[CITY_MAP_SIZE][CITY_MAP_SIZE];
+ signed short int irrigate[CITY_MAP_SIZE][CITY_MAP_SIZE];
+ signed short int road[CITY_MAP_SIZE][CITY_MAP_SIZE];
+ signed short int railroad[CITY_MAP_SIZE][CITY_MAP_SIZE];
+ signed short int transform[CITY_MAP_SIZE][CITY_MAP_SIZE];
+ signed short int tile_value[CITY_MAP_SIZE][CITY_MAP_SIZE];
/* so we can contemplate with warmap fresh and decide later */
int settler_want, founder_want; /* for builder (F_SETTLERS) and founder
(F_CITIES) */
@@ -384,6 +389,7 @@
int city_map_y);
bool city_map_to_map(int *map_x, int *map_y, const struct city *const pcity,
int city_map_x, int city_map_y);
+void generate_city_map_indices(int max_radius);
/* shield on spot */
int city_get_shields_tile(int x, int y, struct city *pcity);
diff -u -r -Xdiff_ignore ../freeciv/common/dataio.c ./common/dataio.c
--- ../freeciv/common/dataio.c 2003-04-04 17:47:49.000000000 +0200
+++ ./common/dataio.c 2003-10-15 20:18:49.000000000 +0200
@@ -43,6 +43,7 @@
#endif
#include "capability.h"
+#include "city.h"
#include "events.h"
#include "log.h"
#include "mem.h"
@@ -52,10 +53,6 @@
#include "dataio.h"
-static const int city_map_index[20] = {
- 1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23
-};
-
/**************************************************************************
...
**************************************************************************/
@@ -406,14 +403,35 @@
**************************************************************************/
void dio_put_city_map(struct data_out *dout, const char *value)
{
- int i;
+ int x, y, current_byte, mult;
+
+ mult = 81;
+ current_byte = 0;
- for (i = 0; i < 20; i += 5) {
- dio_put_uint8(dout, (value[city_map_index[i]] - '0') * 81 +
- (value[city_map_index[i + 1]] - '0') * 27 +
- (value[city_map_index[i + 2]] - '0') * 9 +
- (value[city_map_index[i + 3]] - '0') * 3 +
- (value[city_map_index[i + 4]] - '0') * 1);
+ for (y = 0; y < CITY_MAP_SIZE; y++) {
+ for (x = 0; x < CITY_MAP_SIZE; x++) {
+ if (!is_valid_city_coords(x, y)) {
+ continue;
+ }
+
+ if (is_city_center(x, y)) {
+ continue;
+ }
+
+ current_byte += (value[CITY_MAP_SIZE * y + x] - '0') * mult;
+
+ if (mult == 1) {
+ dio_put_uint8(dout, current_byte);
+ current_byte = 0;
+ mult = 81;
+ } else {
+ mult /= 3;
+ }
+ }
+ }
+
+ if (mult != 81) {
+ dio_put_uint8(dout, current_byte);
}
}
@@ -617,46 +635,58 @@
**************************************************************************/
void dio_get_city_map(struct data_in *din, char *dest, size_t max_dest_size)
{
- int i;
+ int x, y, modulo, current_byte;
if (dest) {
- assert(max_dest_size >= 26);
- dest[0] = '2';
- dest[4] = '2';
- dest[12] = '1';
- dest[20] = '2';
- dest[24] = '2';
- dest[25] = '\0';
+ assert(max_dest_size >= CITY_MAP_SIZE * CITY_MAP_SIZE + 1);
+ dest[CITY_MAP_SIZE * CITY_MAP_SIZE] = '\0';
}
if (!enough_data(din, 4)) {
if (dest) {
- for (i = 0; i < 20;) {
- int j;
-
- for (j = 0; j < 5; j++) {
- dest[city_map_index[i++]] = '0';
+ for (y = 0; y < CITY_MAP_SIZE; y++) {
+ for (x = 0; x < CITY_MAP_SIZE; x++) {
+ if (is_city_center(x, y)) {
+ dest[CITY_MAP_SIZE * y + x] = '1';
+ continue;
+ }
+
+ if (!is_valid_city_coords(x, y)) {
+ dest[CITY_MAP_SIZE * y + x] = '2';
+ } else {
+ dest[CITY_MAP_SIZE * y + x] = '0';
+ }
}
}
}
return;
}
- for (i = 0; i < 20;) {
- int j;
+ modulo = 1;
- dio_get_uint8(din, &j);
+ for (y = 0; y < CITY_MAP_SIZE; y++) {
+ for (x = 0; x < CITY_MAP_SIZE; x++) {
+ if (!is_valid_city_coords(x, y)) {
+ dest[CITY_MAP_SIZE * y + x] = '2';
+ continue;
+ }
+
+ if (is_city_center(x, y)) {
+ dest[CITY_MAP_SIZE * y + x] = '1';
+ continue;
+ }
- if (dest) {
- dest[city_map_index[i++]] = '0' + j / 81;
- j %= 81;
- dest[city_map_index[i++]] = '0' + j / 27;
- j %= 27;
- dest[city_map_index[i++]] = '0' + j / 9;
- j %= 9;
- dest[city_map_index[i++]] = '0' + j / 3;
- j %= 3;
- dest[city_map_index[i++]] = '0' + j;
+ if (modulo == 1) {
+ dio_get_uint8(din, ¤t_byte);
+ modulo = 81;
+ } else {
+ modulo /= 3;
+ }
+
+ if (dest) {
+ dest[CITY_MAP_SIZE * y + x] = '0' + current_byte / modulo;
+ current_byte %= modulo;
+ }
}
}
}
diff -u -r -Xdiff_ignore ../freeciv/common/packets.c ./common/packets.c
--- ../freeciv/common/packets.c 2003-10-09 15:46:01.000000000 +0200
+++ ./common/packets.c 2003-10-15 20:40:47.000000000 +0200
@@ -1380,7 +1380,7 @@
COND_SET_BIT(req->diplomat_investigate, 5) |
COND_SET_BIT(req->changed_from_is_unit, 6)));
- dio_put_city_map(&dout, (char *) req->city_map);
+ dio_put_city_map(&dout, (char *) req->city_map);
dio_put_bit_string(&dout, (char *) req->improvements);
/* only 8 options allowed before need to extend protocol */
diff -u -r -Xdiff_ignore ../freeciv/server/citytools.c ./server/citytools.c
--- ../freeciv/server/citytools.c 2003-10-13 19:38:20.000000000 +0200
+++ ./server/citytools.c 2003-10-13 19:39:46.000000000 +0200
@@ -1580,78 +1580,81 @@
{
int i, x, y;
char *p;
- packet->id=pcity->id;
- packet->owner=pcity->owner;
- packet->x=pcity->x;
- packet->y=pcity->y;
+ packet->id = pcity->id;
+ packet->owner = pcity->owner;
+ packet->x = pcity->x;
+ packet->y = pcity->y;
sz_strlcpy(packet->name, pcity->name);
- packet->size=pcity->size;
- for (i=0;i<5;i++) {
- packet->ppl_happy[i]=pcity->ppl_happy[i];
- packet->ppl_content[i]=pcity->ppl_content[i];
- packet->ppl_unhappy[i]=pcity->ppl_unhappy[i];
- packet->ppl_angry[i]=pcity->ppl_angry[i];
- }
- packet->ppl_elvis=pcity->ppl_elvis;
- packet->ppl_scientist=pcity->ppl_scientist;
- packet->ppl_taxman=pcity->ppl_taxman;
+ packet->size = pcity->size;
+ for (i = 0; i < 5; i++) {
+ packet->ppl_happy[i] = pcity->ppl_happy[i];
+ packet->ppl_content[i] = pcity->ppl_content[i];
+ packet->ppl_unhappy[i] = pcity->ppl_unhappy[i];
+ packet->ppl_angry[i] = pcity->ppl_angry[i];
+ }
+ packet->ppl_elvis = pcity->ppl_elvis;
+ packet->ppl_scientist = pcity->ppl_scientist;
+ packet->ppl_taxman = pcity->ppl_taxman;
for (i = 0; i < NUM_TRADEROUTES; i++) {
- packet->trade[i]=pcity->trade[i];
- packet->trade_value[i]=pcity->trade_value[i];
+ packet->trade[i] = pcity->trade[i];
+ packet->trade_value[i] = pcity->trade_value[i];
}
- packet->food_prod=pcity->food_prod;
- packet->food_surplus=pcity->food_surplus;
- packet->shield_prod=pcity->shield_prod;
- packet->shield_surplus=pcity->shield_surplus;
- packet->trade_prod=pcity->trade_prod;
- packet->tile_trade=pcity->tile_trade;
- packet->corruption=pcity->corruption;
+ packet->food_prod = pcity->food_prod;
+ packet->food_surplus = pcity->food_surplus;
+ packet->shield_prod = pcity->shield_prod;
+ packet->shield_surplus = pcity->shield_surplus;
+ packet->trade_prod = pcity->trade_prod;
+ packet->tile_trade = pcity->tile_trade;
+ packet->corruption = pcity->corruption;
- packet->shield_waste=pcity->shield_waste;
+ packet->shield_waste = pcity->shield_waste;
- packet->luxury_total=pcity->luxury_total;
- packet->tax_total=pcity->tax_total;
- packet->science_total=pcity->science_total;
+ packet->luxury_total = pcity->luxury_total;
+ packet->tax_total = pcity->tax_total;
+ packet->science_total = pcity->science_total;
- packet->food_stock=pcity->food_stock;
- packet->shield_stock=pcity->shield_stock;
- packet->pollution=pcity->pollution;
+ packet->food_stock = pcity->food_stock;
+ packet->shield_stock = pcity->shield_stock;
+ packet->pollution = pcity->pollution;
- packet->city_options=pcity->city_options;
+ packet->city_options = pcity->city_options;
- packet->is_building_unit=pcity->is_building_unit;
- packet->currently_building=pcity->currently_building;
+ packet->is_building_unit = pcity->is_building_unit;
+ packet->currently_building = pcity->currently_building;
- packet->turn_last_built=pcity->turn_last_built;
+ packet->turn_last_built = pcity->turn_last_built;
packet->turn_founded = pcity->turn_founded;
- packet->changed_from_id=pcity->changed_from_id;
- packet->changed_from_is_unit=pcity->changed_from_is_unit;
- packet->before_change_shields=pcity->before_change_shields;
- packet->disbanded_shields=pcity->disbanded_shields;
- packet->caravan_shields=pcity->caravan_shields;
+ packet->changed_from_id = pcity->changed_from_id;
+ packet->changed_from_is_unit = pcity->changed_from_is_unit;
+ packet->before_change_shields = pcity->before_change_shields;
+ packet->disbanded_shields = pcity->disbanded_shields;
+ packet->caravan_shields = pcity->caravan_shields;
copy_worklist(&packet->worklist, &pcity->worklist);
- packet->diplomat_investigate=dipl_invest;
+ packet->diplomat_investigate = dipl_invest;
- packet->airlift=pcity->airlift;
- packet->did_buy=pcity->did_buy;
- packet->did_sell=pcity->did_sell;
- packet->was_happy=pcity->was_happy;
- p=packet->city_map;
- for(y=0; y<CITY_MAP_SIZE; y++)
- for(x=0; x<CITY_MAP_SIZE; x++)
- *p++=get_worker_city(pcity, x, y)+'0';
- *p='\0';
+ packet->airlift = pcity->airlift;
+ packet->did_buy = pcity->did_buy;
+ packet->did_sell = pcity->did_sell;
+ packet->was_happy = pcity->was_happy;
+
+ p = packet->city_map;
+ for(y = 0; y < CITY_MAP_SIZE; y++) {
+ for(x = 0; x < CITY_MAP_SIZE; x++) {
+ *p++ = get_worker_city(pcity, x, y) + '0';
+ }
+ }
+ *p = '\0';
- p=packet->improvements;
+ p = packet->improvements;
impr_type_iterate(i) {
*p++ = (city_got_building(pcity, i)) ? '1' : '0';
} impr_type_iterate_end;
- *p='\0';
+ *p = '\0';
}
/**************************************************************************
diff -u -r -Xdiff_ignore ../freeciv/server/ruleset.c ./server/ruleset.c
--- ../freeciv/server/ruleset.c 2003-10-03 15:28:55.000000000 +0200
+++ ./server/ruleset.c 2003-10-10 16:18:29.000000000 +0200
@@ -2498,6 +2498,9 @@
lookup_tech_list(&file, "options", "global_init_techs",
game.rgame.global_init_techs, filename);
+ /* It is not really from the ruleset, but later it will be so do it here */
+ generate_city_map_indices(CITY_MAP_RADIUS);
+
section_file_check_unused(&file, filename);
section_file_free(&file);
}
- [Freeciv-Dev] (PR#6170) Alternative city square utilizations,
Remi Bonnet <=
[Freeciv-Dev] (PR#6170) Alternative city square utilizations, Remi Bonnet, 2003/10/21
|
|