@@ -62,9 +62,15 @@ public static Bitmap DrawFoodStorage(City city)
62
62
graphics . DrawImage ( Images . CitymapFoodLargeBigger , starting_x + wheat_spacing * col , 27 + wheatH * row ) ;
63
63
count ++ ;
64
64
65
- if ( count >= city . FoodInStorage ) break ;
65
+ if ( count >= city . FoodInStorage )
66
+ {
67
+ break ;
68
+ }
69
+ }
70
+ if ( count >= city . FoodInStorage )
71
+ {
72
+ break ;
66
73
}
67
- if ( count >= city . FoodInStorage ) break ;
68
74
}
69
75
70
76
//3rd horizontal line (shorter)
@@ -118,7 +124,10 @@ public static Bitmap Citizens(City city, int zoom)
118
124
for ( int i = 0 ; i < city . Size ; i ++ )
119
125
{
120
126
drawIndex = ( int ) peoples [ i ] ;
121
- if ( i % 2 == 1 && ( drawIndex == 0 || drawIndex == 2 || drawIndex == 4 || drawIndex == 6 ) ) drawIndex ++ ; // Change men/woman appearance
127
+ if ( i % 2 == 1 && ( drawIndex == 0 || drawIndex == 2 || drawIndex == 4 || drawIndex == 6 ) )
128
+ {
129
+ drawIndex ++ ; // Change men/woman appearance
130
+ }
122
131
//graphics.DrawImage(Images.PeopleL[drawIndex, 0], i * spacing + 1, 1); // Shadow
123
132
graphics . DrawImage ( ModifyImage . ResizeImage ( Images . PeopleLshadow [ drawIndex , 0 ] , zoom ) , i * spacing + 1 , 1 ) ; // Shadow
124
133
graphics . DrawImage ( ModifyImage . ResizeImage ( Images . PeopleL [ drawIndex , 0 ] , zoom ) , i * spacing , 0 ) ;
@@ -163,65 +172,74 @@ public static Bitmap DrawCityProduction(City city)
163
172
return icons ;
164
173
}
165
174
166
- public static Bitmap DrawCityResourcesMap ( City city ) //Draw terrain in city form
175
+ // Draw resource map
176
+ public static Bitmap CityResourcesMap ( City city , int zoom )
167
177
{
168
- Bitmap map = new Bitmap ( 4 * 64 , 4 * 32 ) ;
178
+ var _map = new Bitmap ( 4 * 8 * ( 8 + zoom ) , 4 * 4 * ( 8 + zoom ) ) ;
169
179
170
- //Bitmap image;
171
- //using (Graphics graphics = Graphics.FromImage(map))
172
- //{
173
- // //First draw squares around city
174
- // for (int x_ = -3; x_ <= 3; x_++)
175
- // for (int y_ = -3; y_ <= 3; y_++)
176
- // if ((x_ == -1 & y_ == -3) || (x_ == 1 & y_ == -3) || (x_ == -2 & y_ == -2) || (x_ == 0 & y_ == -2) || (x_ == 2 & y_ == -2) || (x_ == -3 & y_ == -1) || (x_ == -1 & y_ == -1) || (x_ == 1 & y_ == -1) || (x_ == 3 & y_ == -1) || (x_ == -2 & y_ == 0) || (x_ == 0 & y_ == 0) || (x_ == 2 & y_ == 0) || (x_ == -3 & y_ == 1) || (x_ == -1 & y_ == 1) || (x_ == 1 & y_ == 1) || (x_ == 3 & y_ == 1) || (x_ == -2 & y_ == 2) || (x_ == 0 & y_ == 2) || (x_ == 2 & y_ == 2) || (x_ == -1 & y_ == 3) || (x_ == 1 & y_ == 3))
177
- // {
178
- // int newX = city.X + x_;
179
- // int newY = city.Y + y_;
180
- // //TODO: correct this
181
- // //if (newX >= 0 && newX < 2 * Data.MapXdim && newY >= 0 && newY < Data.MapYdim) image = TerrainBitmap((newX - (newY % 2)) / 2, newY);
182
- // //else image = Blank;
183
- // image = Blank;
184
- // graphics.DrawImage(image, 32 * (x_ + 3), 16 * (y_ + 3));
185
- // }
186
-
187
- // //Then draw city
188
- // graphics.DrawImage(CreateCityBitmap(city, false, 8), 64 * 1 + 32 * (3 % 2) + 1, 16 * 2 + 1);
189
-
190
- // //Then draw food/shield/trade icons around the city (21 squares around city)
191
- // int[,] offsets = new int[21, 2] { { 0, 0 }, { -1, -3 }, { -3, -1 }, { -3, 1 }, { -1, 3 }, { 1, 3 }, { 3, 1 }, { 3, -1 }, { 1, -3 }, { -2, -2 }, { -2, 2 }, { 2, 2 },
192
- // { 2, -2 }, { 0, -2 }, { -1, -1 }, { -2, 0 }, { -1, 1 }, { 0, 2 }, { 1, 1 }, { 2, 0 }, { 1, -1 } }; //offset of squares from city square (0,0)
193
- // int[] cityFood = city.FoodDistribution;
194
- // int[] cityShld = city.ShieldDistribution;
195
- // int[] cityTrad = city.TradeDistribution;
196
- // for (int i = 0; i < 21; i++)
197
- // if (city.DistributionWorkers[i] == 1)
198
- // {
199
- // //First count all icons on this square to determine the spacing between icons (10 = no spacing, 15 = no spacing @ 50% scaled)
200
- // int spacing;
201
- // switch (cityFood[i] + cityShld[i] + cityTrad[i])
202
- // {
203
- // case 1:
204
- // case 2: spacing = 17; break; //50 % larger (orignal = 11, 1 pixel gap)
205
- // case 3: spacing = 15; break; //50 % larger (orignal = 10, no gap)
206
- // case 4: spacing = 11; break; //50 % larger (orignal = 7)
207
- // case 5: spacing = 8; break; //50 % larger (orignal = 5)
208
- // case 6: spacing = 6; break; //50 % larger (orignal = 4)
209
- // case 7:
210
- // case 8: spacing = 5; break; //50 % larger (orignal = 3)
211
- // case 9: spacing = 3; break; //50 % larger (orignal = 2)
212
- // case 10: spacing = 2; break; //50 % larger (orignal = 1)
213
- // default: spacing = 2; break; //50 % larger (orignal = 1)
214
- // }
215
-
216
- // //First draw food, then shields, then trade icons
217
- // int x_offset = 32 - ((cityFood[i] + cityShld[i] + cityTrad[i] - 1) * spacing + 15) / 2;
218
- // int y_offset = 9;
219
- // for (int j = 0; j < cityFood[i]; j++) graphics.DrawImage(CitymapFoodSmallBigger, x_offset + (3 + offsets[i, 0]) * 32 + j * spacing, y_offset + (3 + offsets[i, 1]) * 16);
220
- // for (int j = 0; j < cityShld[i]; j++) graphics.DrawImage(CitymapShieldSmallBigger, x_offset + (3 + offsets[i, 0]) * 32 + (cityFood[i] + j) * spacing, y_offset + (3 + offsets[i, 1]) * 16);
221
- // for (int j = 0; j < cityTrad[i]; j++) graphics.DrawImage(CitymapTradeSmallBigger, x_offset + (3 + offsets[i, 0]) * 32 + (cityFood[i] + cityShld[i] + j) * spacing, y_offset + (3 + offsets[i, 1]) * 16);
222
- // }
223
- //}
224
- return map ;
180
+ Bitmap _image ;
181
+ using ( Graphics graphics = Graphics . FromImage ( _map ) )
182
+ {
183
+ // First draw squares around city
184
+ for ( int x_ = - 3 ; x_ <= 3 ; x_ ++ )
185
+ {
186
+ for ( int y_ = - 3 ; y_ <= 3 ; y_ ++ )
187
+ {
188
+ if ( ( x_ == - 1 && y_ == - 3 ) || ( x_ == 1 && y_ == - 3 ) || ( x_ == - 2 && y_ == - 2 ) || ( x_ == 0 && y_ == - 2 ) || ( x_ == 2 && y_ == - 2 ) || ( x_ == - 3 && y_ == - 1 )
189
+ || ( x_ == - 1 && y_ == - 1 ) || ( x_ == 1 && y_ == - 1 ) || ( x_ == 3 && y_ == - 1 ) || ( x_ == - 2 && y_ == 0 ) || ( x_ == 0 && y_ == 0 ) || ( x_ == 2 && y_ == 0 )
190
+ || ( x_ == - 3 && y_ == 1 ) || ( x_ == - 1 && y_ == 1 ) || ( x_ == 1 && y_ == 1 ) || ( x_ == 3 && y_ == 1 ) || ( x_ == - 2 && y_ == 2 ) || ( x_ == 0 && y_ == 2 )
191
+ || ( x_ == 2 && y_ == 2 ) || ( x_ == - 1 && y_ == 3 ) || ( x_ == 1 && y_ == 3 ) )
192
+ {
193
+ int newX = city . X + x_ ;
194
+ int newY = city . Y + y_ ;
195
+ //TODO: correct this
196
+ //if (newX >= 0 && newX < 2 * Data.MapXdim && newY >= 0 && newY < Data.MapYdim) image = TerrainBitmap((newX - (newY % 2)) / 2, newY);
197
+ //else image = Blank;
198
+ //image = Blank;
199
+ //graphics.DrawImage(image, 32 * (x_ + 3), 16 * (y_ + 3));
200
+ graphics . DrawImage ( ModifyImage . ResizeImage ( Images . Blank , zoom ) , 4 * ( 8 + zoom ) * ( x_ + 3 ) , 2 * ( 8 + zoom ) * ( y_ + 3 ) ) ;
201
+ }
202
+ }
203
+ }
204
+
205
+ // //Then draw city
206
+ // graphics.DrawImage(CreateCityBitmap(city, false, 8), 64 * 1 + 32 * (3 % 2) + 1, 16 * 2 + 1);
207
+
208
+ // //Then draw food/shield/trade icons around the city (21 squares around city)
209
+ // int[,] offsets = new int[21, 2] { { 0, 0 }, { -1, -3 }, { -3, -1 }, { -3, 1 }, { -1, 3 }, { 1, 3 }, { 3, 1 }, { 3, -1 }, { 1, -3 }, { -2, -2 }, { -2, 2 }, { 2, 2 },
210
+ // { 2, -2 }, { 0, -2 }, { -1, -1 }, { -2, 0 }, { -1, 1 }, { 0, 2 }, { 1, 1 }, { 2, 0 }, { 1, -1 } }; //offset of squares from city square (0,0)
211
+ // int[] cityFood = city.FoodDistribution;
212
+ // int[] cityShld = city.ShieldDistribution;
213
+ // int[] cityTrad = city.TradeDistribution;
214
+ // for (int i = 0; i < 21; i++)
215
+ // if (city.DistributionWorkers[i] == 1)
216
+ // {
217
+ // //First count all icons on this square to determine the spacing between icons (10 = no spacing, 15 = no spacing @ 50% scaled)
218
+ // int spacing;
219
+ // switch (cityFood[i] + cityShld[i] + cityTrad[i])
220
+ // {
221
+ // case 1:
222
+ // case 2: spacing = 17; break; //50 % larger (orignal = 11, 1 pixel gap)
223
+ // case 3: spacing = 15; break; //50 % larger (orignal = 10, no gap)
224
+ // case 4: spacing = 11; break; //50 % larger (orignal = 7)
225
+ // case 5: spacing = 8; break; //50 % larger (orignal = 5)
226
+ // case 6: spacing = 6; break; //50 % larger (orignal = 4)
227
+ // case 7:
228
+ // case 8: spacing = 5; break; //50 % larger (orignal = 3)
229
+ // case 9: spacing = 3; break; //50 % larger (orignal = 2)
230
+ // case 10: spacing = 2; break; //50 % larger (orignal = 1)
231
+ // default: spacing = 2; break; //50 % larger (orignal = 1)
232
+ // }
233
+
234
+ // //First draw food, then shields, then trade icons
235
+ // int x_offset = 32 - ((cityFood[i] + cityShld[i] + cityTrad[i] - 1) * spacing + 15) / 2;
236
+ // int y_offset = 9;
237
+ // for (int j = 0; j < cityFood[i]; j++) graphics.DrawImage(CitymapFoodSmallBigger, x_offset + (3 + offsets[i, 0]) * 32 + j * spacing, y_offset + (3 + offsets[i, 1]) * 16);
238
+ // for (int j = 0; j < cityShld[i]; j++) graphics.DrawImage(CitymapShieldSmallBigger, x_offset + (3 + offsets[i, 0]) * 32 + (cityFood[i] + j) * spacing, y_offset + (3 + offsets[i, 1]) * 16);
239
+ // for (int j = 0; j < cityTrad[i]; j++) graphics.DrawImage(CitymapTradeSmallBigger, x_offset + (3 + offsets[i, 0]) * 32 + (cityFood[i] + cityShld[i] + j) * spacing, y_offset + (3 + offsets[i, 1]) * 16);
240
+ // }
241
+ }
242
+ return _map ;
225
243
}
226
244
}
227
245
}
0 commit comments