[Freeciv-Dev] (PR#2497) compile fixes + GUITheme/City Icons load by Spec
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients:; |
Subject: |
[Freeciv-Dev] (PR#2497) compile fixes + GUITheme/City Icons load by Specfiles |
From: |
"Rafa³ Bursig via RT" <rt@xxxxxxxxxxxxxx> |
Date: |
Thu, 5 Dec 2002 15:50:22 -0800 |
Reply-to: |
rt@xxxxxxxxxxxxxx |
This patch add :
- GUITheme/City Icons load by Specfiles.
- add some Jason compile fixes.
- remove ALLOCA macro.
- some cleanup.
this code depend on (PR#2494 , PR#2495 , PR2496 ).
NOTE: intro3.png, logo.png , city.png still outside of this becouse
they are too big gfx that could be pernamently loaded in memory.
Rafal
----------------------------------------------------------------------
Portal INTERIA.PL zaprasza... >>> http://link.interia.pl/f167c
diff -u -r fc2/client/gui-sdl/Makefile.am fc/client/gui-sdl/Makefile.am
--- fc2/client/gui-sdl/Makefile.am Mon Dec 2 09:47:01 2002
+++ fc/client/gui-sdl/Makefile.am Wed Dec 4 16:32:01 2002
@@ -86,7 +86,9 @@
gui_zoom.h \
gui_id.h \
gui_dither.c \
- gui_dither.h
+ gui_dither.h \
+ gui_tilespec.c \
+ gui_tilespec.h
diff -u -r fc2/client/gui-sdl/chatline.c fc/client/gui-sdl/chatline.c
--- fc2/client/gui-sdl/chatline.c Mon Dec 2 09:47:01 2002
+++ fc/client/gui-sdl/chatline.c Thu Dec 5 17:35:40 2002
@@ -48,6 +48,7 @@
#include "gui_stuff.h"
#include "gui_zoom.h"
#include "gui_main.h"
+#include "gui_tilespec.h"
#include "chatline.h"
diff -u -r fc2/client/gui-sdl/citydlg.c fc/client/gui-sdl/citydlg.c
--- fc2/client/gui-sdl/citydlg.c Mon Dec 2 09:47:01 2002
+++ fc/client/gui-sdl/citydlg.c Thu Dec 5 19:36:21 2002
@@ -67,6 +67,7 @@
#include "repodlgs.h"
#include "tilespec.h"
#include "wldlg.h"
+#include "gui_tilespec.h"
#include "optiondlg.h"
#include "menu.h"
@@ -75,7 +76,7 @@
#include "citydlg.h"
-
+#if 0
/* get 'struct dialog_list' and related functions: */
struct city_dialog;
@@ -91,7 +92,6 @@
TYPED_LIST_ITERATE(struct city_dialog, dialoglist, pdialog)
#define dialog_list_iterate_end LIST_ITERATE_END
-#if 0
static int NUM_UNITS_SHOWN;
static int MAX_UNIT_ROWS;
static int MINI_NUM_UNITS;
@@ -104,63 +104,6 @@
extern char *pDataPath;
-static struct City_Icon {
- SDL_Surface *pBIG_Food_Corr;
- SDL_Surface *pBIG_Shield_Corr;
- SDL_Surface *pBIG_Trade_Corr;
- SDL_Surface *pBIG_Food;
- SDL_Surface *pBIG_Shield;
- SDL_Surface *pBIG_Trade;
- SDL_Surface *pBIG_Luxury;
- SDL_Surface *pBIG_Coin;
- SDL_Surface *pBIG_Colb;
- /*SDL_Surface *pBIG_Face; */
- SDL_Surface *pBIG_Coin_Corr;
- SDL_Surface *pBIG_Coin_UpKeep;
-
- SDL_Surface *pFood;
- SDL_Surface *pShield;
- SDL_Surface *pTrade;
- SDL_Surface *pLuxury;
- SDL_Surface *pCoin;
- SDL_Surface *pColb;
- SDL_Surface *pFace;
-
- SDL_Surface *pPollutions;
- SDL_Surface *pFist;
-
- /* Citizens */
- SDL_Surface *pBIG_Male_Happy;
- SDL_Surface *pBIG_Female_Happy;
- SDL_Surface *pBIG_Male_Content;
- SDL_Surface *pBIG_Female_Content;
- SDL_Surface *pBIG_Male_Unhappy;
- SDL_Surface *pBIG_Female_Unhappy;
- SDL_Surface *pBIG_Male_Angry;
- SDL_Surface *pBIG_Female_Angry;
-
- SDL_Surface *pBIG_Spec_Lux; /* Elvis */
- SDL_Surface *pBIG_Spec_Tax; /* TaxMan */
- SDL_Surface *pBIG_Spec_Sci; /* Scientist */
-
- SDL_Surface *pMale_Happy;
- SDL_Surface *pFemale_Happy;
- SDL_Surface *pMale_Content;
- SDL_Surface *pFemale_Content;
- SDL_Surface *pMale_Unhappy;
- SDL_Surface *pFemale_Unhappy;
- SDL_Surface *pMale_Angry;
- SDL_Surface *pFemale_Angry;
-
- SDL_Surface *pSpec_Lux; /* Elvis */
- SDL_Surface *pSpec_Tax; /* TaxMan */
- SDL_Surface *pSpec_Sci; /* Scientist */
-
- enum citizens_styles style;
-
-
-} *pCity_Icon = NULL;
-
static struct city_dialog {
struct city *pCity;
@@ -217,7 +160,6 @@
struct city *pCity);
static void enable_city_dlg_widgets(void);
static void disable_city_dlg_widgets(void);
-static void reload_citizens_icons(enum citizens_styles styles);
static void redraw_city_dialog(struct city *pCity);
static void rebuild_imprm_list(struct city *pCity);
static void rebuild_citydlg_title_str(struct GUI *pWindow,
@@ -225,19 +167,6 @@
/* ======================================================================= */
-/**************************************************************************
- ...
-**************************************************************************/
-SDL_Surface *get_colb_surface(void)
-{
- if (pCity_Icon) {
- return pCity_Icon->pBIG_Colb;
- }
-
- return NULL;
-}
-
-/* ======================================================================= */
/**************************************************************************
...
@@ -919,32 +848,32 @@
i = pUnit->upkeep + pUnit->upkeep_food +
pUnit->upkeep_gold + pUnit->unhappiness;
- if (i * pCity_Icon->pFood->w > NORMAL_TILE_WIDTH / 2) {
- step = (NORMAL_TILE_WIDTH / 2 - pCity_Icon->pFood->w) / (i - 1);
+ if (i * pIcons->pFood->w > NORMAL_TILE_WIDTH / 2) {
+ step = (NORMAL_TILE_WIDTH / 2 - pIcons->pFood->w) / (i - 1);
} else {
- step = pCity_Icon->pFood->w;
+ step = pIcons->pFood->w;
}
- dest.y = 3 * NORMAL_TILE_HEIGHT / 2 - pCity_Icon->pFood->h - 2;
+ dest.y = 3 * NORMAL_TILE_HEIGHT / 2 - pIcons->pFood->h - 2;
dest.x = NORMAL_TILE_WIDTH / 8;
for (i = 0; i < pUnit->upkeep; i++) {
- SDL_BlitSurface(pCity_Icon->pShield, NULL, pSurf, &dest);
+ SDL_BlitSurface(pIcons->pShield, NULL, pSurf, &dest);
dest.x += step;
}
for (i = 0; i < pUnit->upkeep_food; i++) {
- SDL_BlitSurface(pCity_Icon->pFood, NULL, pSurf, &dest);
+ SDL_BlitSurface(pIcons->pFood, NULL, pSurf, &dest);
dest.x += step;
}
for (i = 0; i < pUnit->upkeep_gold; i++) {
- SDL_BlitSurface(pCity_Icon->pCoin, NULL, pSurf, &dest);
+ SDL_BlitSurface(pIcons->pCoin, NULL, pSurf, &dest);
dest.x += step;
}
for (i = 0; i < pUnit->unhappiness; i++) {
- SDL_BlitSurface(pCity_Icon->pFace, NULL, pSurf, &dest);
+ SDL_BlitSurface(pIcons->pFace, NULL, pSurf, &dest);
dest.x += step;
}
@@ -1219,21 +1148,24 @@
case 0x20:
new ^= 0x20;
new ^= 0x40;
- pWidget->gfx = pCity_Icon->pBIG_Spec_Tax;
+ /* tax_collector */
+ pWidget->gfx = (SDL_Surface *)sprites.citizen[2];
pWidget->ID = MAX_ID - 0x40;
redraw_ibutton(pWidget);
refresh_rect(pWidget->size);
break;
case 0x40:
new &= 0x1f;
- pWidget->gfx = pCity_Icon->pBIG_Spec_Lux;
+ /* entertainer */
+ pWidget->gfx = (SDL_Surface *)sprites.citizen[0];
pWidget->ID = MAX_ID - 0x60;
redraw_ibutton(pWidget);
refresh_rect(pWidget->size);
break;
case 0x60:
new |= 0x20;
- pWidget->gfx = pCity_Icon->pBIG_Spec_Sci;
+ /* scientist */
+ pWidget->gfx = (SDL_Surface *)sprites.citizen[1];
pWidget->ID = MAX_ID - 0x20;
redraw_ibutton(pWidget);
refresh_rect(pWidget->size);
@@ -1363,16 +1295,16 @@
change_ptsize16(pStr, 13);
if (pCity->city_options & 0x20) {
- pSurf = pCity_Icon->pBIG_Spec_Sci;
+ pSurf = (SDL_Surface *)sprites.citizen[1];
pBuf = create_icon_button(pSurf, pStr, WF_ICON_CENTER_RIGHT);
add_to_gui_list(MAX_ID - 0x20, pBuf);
} else {
if (pCity->city_options & 0x40) {
- pSurf = pCity_Icon->pBIG_Spec_Tax;
+ pSurf = (SDL_Surface *)sprites.citizen[2];
pBuf = create_icon_button(pSurf, pStr, WF_ICON_CENTER_RIGHT);
add_to_gui_list(MAX_ID - 0x40, pBuf);
} else {
- pSurf = pCity_Icon->pBIG_Spec_Lux;
+ pSurf = (SDL_Surface *)sprites.citizen[0];
pBuf = create_icon_button(pSurf, pStr, WF_ICON_CENTER_RIGHT);
add_to_gui_list(MAX_ID - 0x60, pBuf);
}
@@ -2679,17 +2611,17 @@
step = (SCALLED_TILE_WIDTH - 2 * dest.x) / (food + shield + trade);
for (i = 0; i < food; i++) {
- SDL_BlitSurface(pCity_Icon->pFood, NULL, pTile, &dest);
+ SDL_BlitSurface(pIcons->pFood, NULL, pTile, &dest);
dest.x += step;
}
for (i = 0; i < shield; i++) {
- SDL_BlitSurface(pCity_Icon->pShield, NULL, pTile, &dest);
+ SDL_BlitSurface(pIcons->pShield, NULL, pTile, &dest);
dest.x += step;
}
for (i = 0; i < trade; i++) {
- SDL_BlitSurface(pCity_Icon->pTrade, NULL, pTile, &dest);
+ SDL_BlitSurface(pIcons->pTrade, NULL, pTile, &dest);
dest.x += step;
}
}
@@ -3115,19 +3047,19 @@
FREESURFACE(pSurf);
- if (((pCity_Icon->pPollutions->w + 1) * pCity->pollution) > 187) {
- step = (187 - pCity_Icon->pPollutions->w) / (pCity->pollution - 1);
+ if (((pIcons->pPollution->w + 1) * pCity->pollution) > 187) {
+ step = (187 - pIcons->pPollution->w) / (pCity->pollution - 1);
} else {
- step = pCity_Icon->pPollutions->w + 1;
+ step = pIcons->pPollution->w + 1;
}
for (i = 0; i < pCity->pollution; i++) {
- SDL_BlitSurface(pCity_Icon->pPollutions, NULL, Main.screen, &dest);
+ SDL_BlitSurface(pIcons->pPollution, NULL, Main.screen, &dest);
dest.x += step;
}
dest.x = pCityWindow->size.x + 10;
- dest.y += pCity_Icon->pPollutions->h + 30;
+ dest.y += pIcons->pPollution->h + 30;
} else {
my_snprintf(cBuf, sizeof(cBuf), _("Pollution : none"));
@@ -3193,7 +3125,7 @@
/* blit trade icon */
dest.x += pSurf->w + 3;
dest.y += 4;
- SDL_BlitSurface(pCity_Icon->pTrade, NULL, Main.screen, &dest);
+ SDL_BlitSurface(pIcons->pTrade, NULL, Main.screen, &dest);
dest.x = pCityWindow->size.x + 10;
dest.y -= 4;
@@ -3212,7 +3144,7 @@
dest.x += pSurf->w + 3;
dest.y += 4;
- SDL_BlitSurface(pCity_Icon->pTrade, NULL, Main.screen, &dest);
+ SDL_BlitSurface(pIcons->pTrade, NULL, Main.screen, &dest);
FREESURFACE(pSurf);
} else {
@@ -3280,10 +3212,10 @@
pCity->ppl_unhappy[4] + pCity->ppl_angry[4] +
pCity->ppl_elvis + pCity->ppl_scientist + pCity->ppl_taxman;
- if (count * pCity_Icon->pMale_Happy->w > 180) {
- step = (180 - pCity_Icon->pMale_Happy->w) / (count - 1);
+ if (count * pIcons->pMale_Happy->w > 180) {
+ step = (180 - pIcons->pMale_Happy->w) / (count - 1);
} else {
- step = pCity_Icon->pMale_Happy->w;
+ step = pIcons->pMale_Happy->w;
}
for (j = 0; j < 5; j++) {
@@ -3298,85 +3230,85 @@
}
if (pCity->ppl_happy[j]) {
- pSurf = pCity_Icon->pMale_Happy;
+ pSurf = pIcons->pMale_Happy;
for (i = 0; i < pCity->ppl_happy[j]; i++) {
SDL_BlitSurface(pSurf, NULL, Main.screen, &dest);
dest.x += step;
- if (pSurf == pCity_Icon->pMale_Happy) {
- pSurf = pCity_Icon->pFemale_Happy;
+ if (pSurf == pIcons->pMale_Happy) {
+ pSurf = pIcons->pFemale_Happy;
} else {
- pSurf = pCity_Icon->pMale_Happy;
+ pSurf = pIcons->pMale_Happy;
}
}
}
if (pCity->ppl_content[j]) {
- pSurf = pCity_Icon->pMale_Content;
+ pSurf = pIcons->pMale_Content;
for (i = 0; i < pCity->ppl_content[j]; i++) {
SDL_BlitSurface(pSurf, NULL, Main.screen, &dest);
dest.x += step;
- if (pSurf == pCity_Icon->pMale_Content) {
- pSurf = pCity_Icon->pFemale_Content;
+ if (pSurf == pIcons->pMale_Content) {
+ pSurf = pIcons->pFemale_Content;
} else {
- pSurf = pCity_Icon->pMale_Content;
+ pSurf = pIcons->pMale_Content;
}
}
}
if (pCity->ppl_unhappy[j]) {
- pSurf = pCity_Icon->pMale_Unhappy;
+ pSurf = pIcons->pMale_Unhappy;
for (i = 0; i < pCity->ppl_unhappy[j]; i++) {
SDL_BlitSurface(pSurf, NULL, Main.screen, &dest);
dest.x += step;
- if (pSurf == pCity_Icon->pMale_Unhappy) {
- pSurf = pCity_Icon->pFemale_Unhappy;
+ if (pSurf == pIcons->pMale_Unhappy) {
+ pSurf = pIcons->pFemale_Unhappy;
} else {
- pSurf = pCity_Icon->pMale_Unhappy;
+ pSurf = pIcons->pMale_Unhappy;
}
}
}
if (pCity->ppl_angry[j]) {
- pSurf = pCity_Icon->pMale_Angry;
+ pSurf = pIcons->pMale_Angry;
for (i = 0; i < pCity->ppl_angry[j]; i++) {
SDL_BlitSurface(pSurf, NULL, Main.screen, &dest);
dest.x += step;
- if (pSurf == pCity_Icon->pMale_Angry) {
- pSurf = pCity_Icon->pFemale_Angry;
+ if (pSurf == pIcons->pMale_Angry) {
+ pSurf = pIcons->pFemale_Angry;
} else {
- pSurf = pCity_Icon->pMale_Angry;
+ pSurf = pIcons->pMale_Angry;
}
}
}
if (pCity->ppl_elvis) {
for (i = 0; i < pCity->ppl_elvis; i++) {
- SDL_BlitSurface(pCity_Icon->pSpec_Lux, NULL, Main.screen, &dest);
+ SDL_BlitSurface(pIcons->pSpec_Lux, NULL, Main.screen, &dest);
dest.x += step;
}
}
if (pCity->ppl_taxman) {
for (i = 0; i < pCity->ppl_taxman; i++) {
- SDL_BlitSurface(pCity_Icon->pSpec_Tax, NULL, Main.screen, &dest);
+ SDL_BlitSurface(pIcons->pSpec_Tax, NULL, Main.screen, &dest);
dest.x += step;
}
}
if (pCity->ppl_scientist) {
for (i = 0; i < pCity->ppl_scientist; i++) {
- SDL_BlitSurface(pCity_Icon->pSpec_Sci, NULL, Main.screen, &dest);
+ SDL_BlitSurface(pIcons->pSpec_Sci, NULL, Main.screen, &dest);
dest.x += step;
}
}
if (j == 1) { /* luxury effect */
dest.x =
- pCityWindow->size.x + 212 - pCity_Icon->pBIG_Luxury->w - 2;
+ pCityWindow->size.x + 212 - pIcons->pBIG_Luxury->w - 2;
count = dest.y;
- dest.y += (pCity_Icon->pBIG_Male_Happy->h -
- pCity_Icon->pBIG_Luxury->h) / 2;
- SDL_BlitSurface(pCity_Icon->pBIG_Luxury, NULL, Main.screen, &dest);
+ dest.y += (pIcons->pMale_Happy->h -
+ pIcons->pBIG_Luxury->h) / 2;
+ SDL_BlitSurface(pIcons->pBIG_Luxury, NULL, Main.screen, &dest);
dest.y = count;
}
@@ -3422,7 +3354,7 @@
dest.x = pCityWindow->size.x + 212 - pSurf->w - 2;
i = dest.y;
- dest.y += (pCity_Icon->pBIG_Male_Happy->h - count) / 2;
+ dest.y += (pIcons->pMale_Happy->h - count) / 2;
if (pTmp1) { /* Temple */
@@ -3447,12 +3379,12 @@
dest.y = i;
}
- if (j == 3) { /* garnison effect */
- dest.x = pCityWindow->size.x + 212 - pCity_Icon->pFist->w - 5;
+ if (j == 3) {/* police effect */
+ dest.x = pCityWindow->size.x + 212 - pIcons->pPolice->w - 5;
i = dest.y;
dest.y +=
- (pCity_Icon->pBIG_Male_Happy->h - pCity_Icon->pFist->h) / 2;
- SDL_BlitSurface(pCity_Icon->pFist, NULL, Main.screen, &dest);
+ (pIcons->pMale_Happy->h - pIcons->pPolice->h) / 2;
+ SDL_BlitSurface(pIcons->pPolice, NULL, Main.screen, &dest);
dest.y = i;
}
@@ -3507,7 +3439,7 @@
dest.x = pCityWindow->size.x + 212 - pSurf->w - 2;
i = dest.y;
- dest.y += (pCity_Icon->pBIG_Male_Happy->h - count) / 2;
+ dest.y += (pIcons->pMale_Happy->h - count) / 2;
if (pTmp1) { /* Cure of Cancer */
@@ -3538,7 +3470,7 @@
}
dest.x = pCityWindow->size.x + 10;
- dest.y += pCity_Icon->pMale_Happy->h + 5;
+ dest.y += pIcons->pMale_Happy->h + 5;
}
}
@@ -3665,7 +3597,7 @@
FREESURFACE(pBuf);
/* draw food income */
- dest.y = pWindow->size.y + 245 + (16 - pCity_Icon->pBIG_Food->h) / 2;
+ dest.y = pWindow->size.y + 245 + (16 - pIcons->pBIG_Food->h) / 2;
dest.x = pWindow->size.x + 203;
if (pCity->food_surplus >= 0) {
@@ -3674,14 +3606,14 @@
count = pCity->food_prod;
}
- if (((pCity_Icon->pBIG_Food->w + 1) * count) > 200) {
- step = (200 - pCity_Icon->pBIG_Food->w) / (count - 1);
+ if (((pIcons->pBIG_Food->w + 1) * count) > 200) {
+ step = (200 - pIcons->pBIG_Food->w) / (count - 1);
} else {
- step = pCity_Icon->pBIG_Food->w + 1;
+ step = pIcons->pBIG_Food->w + 1;
}
for (i = 0; i < count; i++) {
- SDL_BlitSurface(pCity_Icon->pBIG_Food, NULL, Main.screen, &dest);
+ SDL_BlitSurface(pIcons->pBIG_Food, NULL, Main.screen, &dest);
dest.x += step;
}
@@ -3709,10 +3641,10 @@
if (pCity->food_surplus > 0) {
count = pCity->food_surplus;
- pBuf = pCity_Icon->pBIG_Food;
+ pBuf = pIcons->pBIG_Food;
} else {
count = -1 * pCity->food_surplus;
- pBuf = pCity_Icon->pBIG_Food_Corr;
+ pBuf = pIcons->pBIG_Food_Corr;
}
dest.x = pWindow->size.x + 423;
@@ -3761,10 +3693,10 @@
if (pCity->shield_surplus > 0) {
count = pCity->shield_surplus;
- pBuf = pCity_Icon->pBIG_Shield;
+ pBuf = pIcons->pBIG_Shield;
} else {
count = -1 * pCity->shield_surplus;
- pBuf = pCity_Icon->pBIG_Shield_Corr;
+ pBuf = pIcons->pBIG_Shield_Corr;
}
dest.y = pWindow->size.y + 280 + (16 - pBuf->h) / 2;
@@ -3806,18 +3738,18 @@
if (pCity->shield_prod - pCity->shield_surplus) {
dest.x = pWindow->size.x + 423;
dest.y =
- pWindow->size.y + 280 + (16 - pCity_Icon->pBIG_Shield->h) / 2;
- if ((pCity_Icon->pBIG_Shield->w + 1) * (pCity->shield_prod -
+ pWindow->size.y + 280 + (16 - pIcons->pBIG_Shield->h) / 2;
+ if ((pIcons->pBIG_Shield->w + 1) * (pCity->shield_prod -
pCity->shield_surplus) > 30) {
step =
- (30 - pCity_Icon->pBIG_Food->w) / (pCity->shield_prod -
+ (30 - pIcons->pBIG_Food->w) / (pCity->shield_prod -
pCity->shield_surplus - 1);
} else {
- step = pCity_Icon->pBIG_Shield->w + 1;
+ step = pIcons->pBIG_Shield->w + 1;
}
for (i = 0; i < (pCity->shield_prod - pCity->shield_surplus); i++) {
- SDL_BlitSurface(pCity_Icon->pBIG_Shield, NULL, Main.screen, &dest);
+ SDL_BlitSurface(pIcons->pBIG_Shield, NULL, Main.screen, &dest);
dest.x -= step;
}
}
@@ -3846,17 +3778,17 @@
/* draw total (trade - corruption) */
if (pCity->trade_prod) {
dest.y =
- pWindow->size.y + 315 + (16 - pCity_Icon->pBIG_Trade->h) / 2;
+ pWindow->size.y + 315 + (16 - pIcons->pBIG_Trade->h) / 2;
dest.x = pWindow->size.x + 203;
- if (((pCity_Icon->pBIG_Trade->w + 1) * pCity->trade_prod) > 200) {
- step = (200 - pCity_Icon->pBIG_Trade->w) / (pCity->trade_prod - 1);
+ if (((pIcons->pBIG_Trade->w + 1) * pCity->trade_prod) > 200) {
+ step = (200 - pIcons->pBIG_Trade->w) / (pCity->trade_prod - 1);
} else {
- step = pCity_Icon->pBIG_Trade->w + 1;
+ step = pIcons->pBIG_Trade->w + 1;
}
for (i = 0; i < pCity->trade_prod; i++) {
- SDL_BlitSurface(pCity_Icon->pBIG_Trade, NULL, Main.screen, &dest);
+ SDL_BlitSurface(pIcons->pBIG_Trade, NULL, Main.screen, &dest);
dest.x += step;
}
}
@@ -3884,17 +3816,17 @@
if (pCity->corruption) {
dest.x = pWindow->size.x + 423;
dest.y =
- pWindow->size.y + 315 + (16 - pCity_Icon->pBIG_Trade->h) / 2;
+ pWindow->size.y + 315 + (16 - pIcons->pBIG_Trade->h) / 2;
- if (((pCity_Icon->pBIG_Trade_Corr->w + 1) * pCity->corruption) > 30) {
+ if (((pIcons->pBIG_Trade_Corr->w + 1) * pCity->corruption) > 30) {
step =
- (30 - pCity_Icon->pBIG_Trade_Corr->w) / (pCity->corruption - 1);
+ (30 - pIcons->pBIG_Trade_Corr->w) / (pCity->corruption - 1);
} else {
- step = pCity_Icon->pBIG_Trade_Corr->w + 1;
+ step = pIcons->pBIG_Trade_Corr->w + 1;
}
for (i = 0; i < pCity->corruption; i++) {
- SDL_BlitSurface(pCity_Icon->pBIG_Trade_Corr, NULL, Main.screen,
+ SDL_BlitSurface(pIcons->pBIG_Trade_Corr, NULL, Main.screen,
&dest);
dest.x -= step;
}
@@ -3926,10 +3858,10 @@
if (count) {
if (count > 0) {
- pBuf = pCity_Icon->pBIG_Coin;
+ pBuf = pIcons->pBIG_Coin;
} else {
count *= -1;
- pBuf = pCity_Icon->pBIG_Coin_Corr;
+ pBuf = pIcons->pBIG_Coin_Corr;
}
dest.y = pWindow->size.y + 358 + (16 - pBuf->h) / 2;
@@ -3978,18 +3910,18 @@
dest.x = pWindow->size.x + 423;
dest.y = pWindow->size.y + 358
- + (16 - pCity_Icon->pBIG_Coin_UpKeep->h) / 2;
+ + (16 - pIcons->pBIG_Coin_UpKeep->h) / 2;
- if (((pCity_Icon->pBIG_Coin_UpKeep->w + 1) *
+ if (((pIcons->pBIG_Coin_UpKeep->w + 1) *
(pCity->tax_total - count)) > 110) {
- step = (110 - pCity_Icon->pBIG_Coin_UpKeep->w) /
+ step = (110 - pIcons->pBIG_Coin_UpKeep->w) /
(pCity->tax_total - count - 1);
} else {
- step = pCity_Icon->pBIG_Coin_UpKeep->w + 1;
+ step = pIcons->pBIG_Coin_UpKeep->w + 1;
}
for (i = 0; i < (pCity->tax_total - count); i++) {
- SDL_BlitSurface(pCity_Icon->pBIG_Coin_UpKeep, NULL, Main.screen,
+ SDL_BlitSurface(pIcons->pBIG_Coin_UpKeep, NULL, Main.screen,
&dest);
dest.x -= step;
}
@@ -4019,11 +3951,11 @@
if (pCity->science_total) {
dest.y =
- pWindow->size.y + 393 + (16 - pCity_Icon->pBIG_Colb->h) / 2;
+ pWindow->size.y + 393 + (16 - pIcons->pBIG_Colb->h) / 2;
dest.x = pWindow->size.x + 203;
- if ((pCity_Icon->pBIG_Colb->w * pCity->science_total) > 235) {
- step = (235 - pCity_Icon->pBIG_Colb->w) / (pCity->science_total - 1);
+ if ((pIcons->pBIG_Colb->w * pCity->science_total) > 235) {
+ step = (235 - pIcons->pBIG_Colb->w) / (pCity->science_total - 1);
if (step) {
count = pCity->science_total;
} else {
@@ -4031,11 +3963,11 @@
count = 222;
}
} else {
- step = pCity_Icon->pBIG_Colb->w;
+ step = pIcons->pBIG_Colb->w;
}
for (i = 0; i < count; i++) {
- SDL_BlitSurface(pCity_Icon->pBIG_Colb, NULL, Main.screen, &dest);
+ SDL_BlitSurface(pIcons->pBIG_Colb, NULL, Main.screen, &dest);
dest.x += step;
}
}
@@ -4064,18 +3996,18 @@
if (pCity->luxury_total) {
dest.y =
- pWindow->size.y + 428 + (16 - pCity_Icon->pBIG_Luxury->h) / 2;
+ pWindow->size.y + 428 + (16 - pIcons->pBIG_Luxury->h) / 2;
dest.x = pWindow->size.x + 203;
- if ((pCity_Icon->pBIG_Luxury->w * pCity->luxury_total) > 235) {
+ if ((pIcons->pBIG_Luxury->w * pCity->luxury_total) > 235) {
step =
- (235 - pCity_Icon->pBIG_Luxury->w) / (pCity->luxury_total - 1);
+ (235 - pIcons->pBIG_Luxury->w) / (pCity->luxury_total - 1);
} else {
- step = pCity_Icon->pBIG_Luxury->w;
+ step = pIcons->pBIG_Luxury->w;
}
for (i = 0; i < pCity->luxury_total; i++) {
- SDL_BlitSurface(pCity_Icon->pBIG_Luxury, NULL, Main.screen, &dest);
+ SDL_BlitSurface(pIcons->pBIG_Luxury, NULL, Main.screen, &dest);
dest.x += step;
}
}
@@ -4115,11 +4047,11 @@
count = (city_granary_size(pCity->size)) / 10;
if (count > 12) {
- step = (168 - pCity_Icon->pBIG_Food->h) / (11 + count - 12);
+ step = (168 - pIcons->pBIG_Food->h) / (11 + count - 12);
i = (count - 1) * step + 14;
count = 12;
} else {
- step = pCity_Icon->pBIG_Food->h;
+ step = pIcons->pBIG_Food->h;
i = count * step;
}
@@ -4179,8 +4111,8 @@
dest.x += 2;
dest.y += 2;
while (count && cost) {
- SDL_BlitSurface(pCity_Icon->pBIG_Food, NULL, Main.screen, &dest);
- dest.x += pCity_Icon->pBIG_Food->w;
+ SDL_BlitSurface(pIcons->pBIG_Food, NULL, Main.screen, &dest);
+ dest.x += pIcons->pBIG_Food->w;
count--;
cost--;
if (dest.x > pWindow->size.x + 620) {
@@ -4205,8 +4137,8 @@
dest.x += 2;
dest.y += 2;
while (count) {
- SDL_BlitSurface(pCity_Icon->pBIG_Food, NULL, Main.screen, &dest);
- dest.x += pCity_Icon->pBIG_Food->w;
+ SDL_BlitSurface(pIcons->pBIG_Food, NULL, Main.screen, &dest);
+ dest.x += pIcons->pBIG_Food->w;
count--;
if (dest.x > pWindow->size.x + 532) {
dest.x = pWindow->size.x + 464;
@@ -4248,8 +4180,8 @@
dest.x += 2;
dest.y += 2;
while (count) {
- SDL_BlitSurface(pCity_Icon->pBIG_Food, NULL, Main.screen, &dest);
- dest.x += pCity_Icon->pBIG_Food->w;
+ SDL_BlitSurface(pIcons->pBIG_Food, NULL, Main.screen, &dest);
+ dest.x += pIcons->pBIG_Food->w;
count--;
if (dest.x > pWindow->size.x + 602) {
dest.x = pWindow->size.x + 464;
@@ -4331,10 +4263,10 @@
if (count) {
if (count > 11) {
- step = (154 - pCity_Icon->pBIG_Shield->h) / (10 + count - 11);
- i = (step * (count - 1)) + pCity_Icon->pBIG_Shield->h;
+ step = (154 - pIcons->pBIG_Shield->h) / (10 + count - 11);
+ i = (step * (count - 1)) + pIcons->pBIG_Shield->h;
} else {
- step = pCity_Icon->pBIG_Shield->h;
+ step = pIcons->pBIG_Shield->h;
i = count * step;
}
@@ -4352,8 +4284,8 @@
dest.x += 2;
dest.y += 2;
while (count) {
- SDL_BlitSurface(pCity_Icon->pBIG_Shield, NULL, Main.screen, &dest);
- dest.x += pCity_Icon->pBIG_Shield->w;
+ SDL_BlitSurface(pIcons->pBIG_Shield, NULL, Main.screen, &dest);
+ dest.x += pIcons->pBIG_Shield->w;
count--;
if (dest.x > pWindow->size.x + 170) {
dest.x = pWindow->size.x + 31;
@@ -4413,64 +4345,65 @@
pCity->ppl_unhappy[4] + pCity->ppl_angry[4] +
pCity->ppl_elvis + pCity->ppl_scientist + pCity->ppl_taxman;
+ pBuf = (SDL_Surface *)sprites.citizen[0];
if (count > 13) {
- step = (400 - pCity_Icon->pBIG_Male_Happy->w) / (12 + count - 13);
+ step = (400 - pBuf->w) / (12 + count - 13);
} else {
- step = pCity_Icon->pBIG_Male_Happy->w;
+ step = pBuf->w;
}
dest.y =
- pWindow->size.y + 26 + (42 - pCity_Icon->pBIG_Male_Happy->h) / 2;
+ pWindow->size.y + 26 + (42 - pBuf->h) / 2;
dest.x = pWindow->size.x + 227;
if (pCity->ppl_happy[4]) {
- pBuf = pCity_Icon->pBIG_Male_Happy;
+ pBuf = (SDL_Surface *)sprites.citizen[5];/* male */
for (i = 0; i < pCity->ppl_happy[4]; i++) {
SDL_BlitSurface(pBuf, NULL, Main.screen, &dest);
dest.x += step;
- if (pBuf == pCity_Icon->pBIG_Male_Happy) {
- pBuf = pCity_Icon->pBIG_Female_Happy;
+ if (pBuf == (SDL_Surface *)sprites.citizen[5]) {
+ pBuf = (SDL_Surface *)sprites.citizen[6];/* female */
} else {
- pBuf = pCity_Icon->pBIG_Male_Happy;
+ pBuf = (SDL_Surface *)sprites.citizen[5];
}
}
}
if (pCity->ppl_content[4]) {
- pBuf = pCity_Icon->pBIG_Male_Content;
+ pBuf = (SDL_Surface *)sprites.citizen[3];/* male */
for (i = 0; i < pCity->ppl_content[4]; i++) {
SDL_BlitSurface(pBuf, NULL, Main.screen, &dest);
dest.x += step;
- if (pBuf == pCity_Icon->pBIG_Male_Content) {
- pBuf = pCity_Icon->pBIG_Female_Content;
+ if (pBuf == (SDL_Surface *)sprites.citizen[3]) {
+ pBuf = (SDL_Surface *)sprites.citizen[4];/* female */
} else {
- pBuf = pCity_Icon->pBIG_Male_Content;
+ pBuf = (SDL_Surface *)sprites.citizen[3];
}
}
}
if (pCity->ppl_unhappy[4]) {
- pBuf = pCity_Icon->pBIG_Male_Unhappy;
+ pBuf = (SDL_Surface *)sprites.citizen[7];/* male */
for (i = 0; i < pCity->ppl_unhappy[4]; i++) {
SDL_BlitSurface(pBuf, NULL, Main.screen, &dest);
dest.x += step;
- if (pBuf == pCity_Icon->pBIG_Male_Unhappy) {
- pBuf = pCity_Icon->pBIG_Female_Unhappy;
+ if (pBuf == (SDL_Surface *)sprites.citizen[7]) {
+ pBuf = (SDL_Surface *)sprites.citizen[8];/* female */
} else {
- pBuf = pCity_Icon->pBIG_Male_Unhappy;
+ pBuf = (SDL_Surface *)sprites.citizen[7];
}
}
}
if (pCity->ppl_angry[4]) {
- pBuf = pCity_Icon->pBIG_Male_Angry;
+ pBuf = (SDL_Surface *)sprites.citizen[9];/* male */
for (i = 0; i < pCity->ppl_angry[4]; i++) {
SDL_BlitSurface(pBuf, NULL, Main.screen, &dest);
dest.x += step;
- if (pBuf == pCity_Icon->pBIG_Male_Angry) {
- pBuf = pCity_Icon->pBIG_Female_Angry;
+ if (pBuf == (SDL_Surface *)sprites.citizen[9]) {
+ pBuf = (SDL_Surface *)sprites.citizen[10];/* female */
} else {
- pBuf = pCity_Icon->pBIG_Male_Angry;
+ pBuf = (SDL_Surface *)sprites.citizen[9];
}
}
}
@@ -4480,13 +4413,14 @@
FREE(pCityDlg->specs_area[2]);
if (pCity->ppl_elvis) {
+ pBuf = (SDL_Surface *)sprites.citizen[0];/* elvis */
pCityDlg->specs_area[0] = MALLOC(sizeof(SDL_Rect));
pCityDlg->specs_area[0]->x = dest.x;
pCityDlg->specs_area[0]->y = dest.y;
- pCityDlg->specs_area[0]->w = pCity_Icon->pBIG_Spec_Lux->w;
- pCityDlg->specs_area[0]->h = pCity_Icon->pBIG_Spec_Lux->h;
+ pCityDlg->specs_area[0]->w = pBuf->w;
+ pCityDlg->specs_area[0]->h = pBuf->h;
for (i = 0; i < pCity->ppl_elvis; i++) {
- SDL_BlitSurface(pCity_Icon->pBIG_Spec_Lux, NULL, Main.screen, &dest);
+ SDL_BlitSurface(pBuf, NULL, Main.screen, &dest);
dest.x += step;
pCityDlg->specs_area[0]->w += step;
}
@@ -4494,13 +4428,14 @@
}
if (pCity->ppl_taxman) {
+ pBuf = (SDL_Surface *)sprites.citizen[2];/* Tax */
pCityDlg->specs_area[1] = MALLOC(sizeof(SDL_Rect));
pCityDlg->specs_area[1]->x = dest.x;
pCityDlg->specs_area[1]->y = dest.y;
- pCityDlg->specs_area[1]->w = pCity_Icon->pBIG_Spec_Tax->w;
- pCityDlg->specs_area[1]->h = pCity_Icon->pBIG_Spec_Tax->h;
+ pCityDlg->specs_area[1]->w = pBuf->w;
+ pCityDlg->specs_area[1]->h = pBuf->h;
for (i = 0; i < pCity->ppl_taxman; i++) {
- SDL_BlitSurface(pCity_Icon->pBIG_Spec_Tax, NULL, Main.screen, &dest);
+ SDL_BlitSurface(pBuf, NULL, Main.screen, &dest);
dest.x += step;
pCityDlg->specs_area[1]->w += step;
}
@@ -4508,13 +4443,14 @@
}
if (pCity->ppl_scientist) {
+ pBuf = (SDL_Surface *)sprites.citizen[1];/* Sci */
pCityDlg->specs_area[2] = MALLOC(sizeof(SDL_Rect));
pCityDlg->specs_area[2]->x = dest.x;
pCityDlg->specs_area[2]->y = dest.y;
- pCityDlg->specs_area[2]->w = pCity_Icon->pBIG_Spec_Sci->w;
- pCityDlg->specs_area[2]->h = pCity_Icon->pBIG_Spec_Sci->h;
+ pCityDlg->specs_area[2]->w = pBuf->w;
+ pCityDlg->specs_area[2]->h = pBuf->h;
for (i = 0; i < pCity->ppl_scientist; i++) {
- SDL_BlitSurface(pCity_Icon->pBIG_Spec_Sci, NULL, Main.screen, &dest);
+ SDL_BlitSurface(pBuf, NULL, Main.screen, &dest);
dest.x += step;
pCityDlg->specs_area[2]->w += step;
}
@@ -4747,7 +4683,7 @@
struct GUI *pWindow = NULL, *pBuf = NULL;
SDL_Surface *pLogo = NULL;
SDL_String16 *pStr = NULL;
- enum citizens_styles cs;
+ int cs;
if (pCityDlg)
return;
@@ -5024,9 +4960,9 @@
/* ===================================================== */
/* check if Citizen Icon style was loaded */
- cs = city_styles[get_city_style(pCity)].citizens_style;
+ cs = get_city_style(pCity);
- if (cs != pCity_Icon->style) {
+ if (cs != pIcons->style) {
reload_citizens_icons(cs);
}
@@ -5163,694 +5099,3 @@
return FALSE;
}
-
-/* ===================================================== */
-/* ================== City Gfx Managment =============== */
-/* ===================================================== */
-
-/**************************************************************************
- reload citizens "style" icons.
-**************************************************************************/
-static void reload_citizens_icons(enum citizens_styles styles)
-{
-
- char cBuf[80]; /* I hope this is enought :) */
- SDL_Rect crop_rect = { 0, 0, 27, 30 };
- SDL_Surface *pBuf = NULL;
-
- FREESURFACE(pCity_Icon->pBIG_Male_Content);
- FREESURFACE(pCity_Icon->pBIG_Female_Content);
- FREESURFACE(pCity_Icon->pBIG_Male_Happy);
- FREESURFACE(pCity_Icon->pBIG_Female_Happy);
- FREESURFACE(pCity_Icon->pBIG_Male_Unhappy);
- FREESURFACE(pCity_Icon->pBIG_Female_Unhappy);
- FREESURFACE(pCity_Icon->pBIG_Male_Angry);
- FREESURFACE(pCity_Icon->pBIG_Female_Angry);
-
- FREESURFACE(pCity_Icon->pBIG_Spec_Lux); /* Elvis */
- FREESURFACE(pCity_Icon->pBIG_Spec_Tax); /* TaxMan */
- FREESURFACE(pCity_Icon->pBIG_Spec_Sci); /* Scientist */
-
- /* info icons */
- FREESURFACE(pCity_Icon->pMale_Content);
- FREESURFACE(pCity_Icon->pFemale_Content);
- FREESURFACE(pCity_Icon->pMale_Happy);
- FREESURFACE(pCity_Icon->pFemale_Happy);
- FREESURFACE(pCity_Icon->pMale_Unhappy);
- FREESURFACE(pCity_Icon->pFemale_Unhappy);
- FREESURFACE(pCity_Icon->pMale_Angry);
- FREESURFACE(pCity_Icon->pFemale_Angry);
-
- FREESURFACE(pCity_Icon->pSpec_Lux); /* Elvis */
- FREESURFACE(pCity_Icon->pSpec_Tax); /* TaxMan */
- FREESURFACE(pCity_Icon->pSpec_Sci); /* Scientist */
-
-
- pCity_Icon->style = styles;
-
- sprintf(cBuf, "%s%s", pDataPath, "theme/default/city_citizens.png");
-
- pBuf = load_surf(cBuf);
- if (!pBuf) {
- abort();
- }
-
- crop_rect.x = 1;
- crop_rect.y = 1 + pCity_Icon->style * 31;
-
- pCity_Icon->pBIG_Male_Happy = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pBIG_Male_Happy,
- SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pBIG_Male_Happy, 0, 0));
-
- crop_rect.x += 28;
- pCity_Icon->pBIG_Female_Happy = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pBIG_Female_Happy,
- SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pBIG_Female_Happy, 0, 0));
-
- crop_rect.x += 28;
- pCity_Icon->pBIG_Male_Content = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pBIG_Male_Content,
- SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pBIG_Male_Content, 0, 0));
-
- crop_rect.x += 28;
- pCity_Icon->pBIG_Female_Content =
- crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pBIG_Female_Content,
- SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pBIG_Female_Content, 0, 0));
-
- crop_rect.x += 28;
- pCity_Icon->pBIG_Male_Unhappy = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pBIG_Male_Unhappy,
- SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pBIG_Male_Unhappy, 0, 0));
-
- crop_rect.x += 28;
- pCity_Icon->pBIG_Female_Unhappy =
- crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pBIG_Female_Unhappy,
- SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pBIG_Female_Unhappy, 0, 0));
-
- crop_rect.x += 28;
- pCity_Icon->pBIG_Male_Angry = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pBIG_Male_Angry,
- SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pBIG_Male_Angry, 0, 0));
-
- crop_rect.x += 28;
- pCity_Icon->pBIG_Female_Angry = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pBIG_Female_Angry,
- SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pBIG_Female_Angry, 0, 0));
-
- crop_rect.x += 28;
- pCity_Icon->pBIG_Spec_Lux = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pBIG_Spec_Lux,
- SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pBIG_Spec_Lux, 0, 0));
-
- crop_rect.x += 28;
- pCity_Icon->pBIG_Spec_Tax = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pBIG_Spec_Tax,
- SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pBIG_Spec_Tax, 0, 0));
-
- crop_rect.x += 28;
- pCity_Icon->pBIG_Spec_Sci = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pBIG_Spec_Sci,
- SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pBIG_Spec_Sci, 0, 0));
-
- FREESURFACE(pBuf);
-
- /* info icons */
- pCity_Icon->pMale_Happy =
- ResizeSurface(pCity_Icon->pBIG_Male_Happy, 15, 26, 1);
- SDL_SetColorKey(pCity_Icon->pMale_Happy, SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pMale_Happy, 0, 0));
-
- pCity_Icon->pFemale_Happy =
- ResizeSurface(pCity_Icon->pBIG_Female_Happy, 15, 26, 1);
- SDL_SetColorKey(pCity_Icon->pFemale_Happy,
- SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pFemale_Happy, 0, 0));
-
- pCity_Icon->pMale_Content =
- ResizeSurface(pCity_Icon->pBIG_Male_Content, 15, 26, 1);
- SDL_SetColorKey(pCity_Icon->pMale_Content,
- SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pMale_Content, 0, 0));
-
- pCity_Icon->pFemale_Content =
- ResizeSurface(pCity_Icon->pBIG_Female_Content, 15, 26, 1);
- SDL_SetColorKey(pCity_Icon->pFemale_Content,
- SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pFemale_Content, 0, 0));
-
- pCity_Icon->pMale_Unhappy =
- ResizeSurface(pCity_Icon->pBIG_Male_Unhappy, 15, 26, 1);
- SDL_SetColorKey(pCity_Icon->pMale_Unhappy,
- SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pMale_Unhappy, 0, 0));
-
- pCity_Icon->pFemale_Unhappy =
- ResizeSurface(pCity_Icon->pBIG_Female_Unhappy, 15, 26, 1);
- SDL_SetColorKey(pCity_Icon->pFemale_Unhappy,
- SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pFemale_Unhappy, 0, 0));
-
- pCity_Icon->pMale_Angry =
- ResizeSurface(pCity_Icon->pBIG_Male_Angry, 15, 26, 1);
- SDL_SetColorKey(pCity_Icon->pMale_Angry, SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pMale_Angry, 0, 0));
-
- pCity_Icon->pFemale_Angry =
- ResizeSurface(pCity_Icon->pBIG_Female_Angry, 15, 26, 1);
- SDL_SetColorKey(pCity_Icon->pFemale_Angry,
- SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pFemale_Angry, 0, 0));
-
- pCity_Icon->pSpec_Lux =
- ResizeSurface(pCity_Icon->pBIG_Spec_Lux, 15, 26, 1);
- SDL_SetColorKey(pCity_Icon->pSpec_Lux, SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pSpec_Lux, 0, 0));
-
- pCity_Icon->pSpec_Tax =
- ResizeSurface(pCity_Icon->pBIG_Spec_Tax, 15, 26, 1);
- SDL_SetColorKey(pCity_Icon->pSpec_Tax, SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pSpec_Tax, 0, 0));
-
- pCity_Icon->pSpec_Sci =
- ResizeSurface(pCity_Icon->pBIG_Spec_Sci, 15, 26, 1);
- SDL_SetColorKey(pCity_Icon->pSpec_Sci, SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pSpec_Sci, 0, 0));
-
-}
-
-/**************************************************************************
- FIXME: port me to Freeciv tilespec functons.
- Loading city icons and gfx.
-**************************************************************************/
-void load_city_icons(void)
-{
- char cBuf[80]; /* I hope this is enought :) */
- SDL_Rect crop_rect = { 0, 0, 36, 20 };
- SDL_Surface *pBuf = NULL;
-#if 0
- struct impr_type *pImpr = NULL;
-
- sprintf(cBuf, "%s%s", pDataPath, "theme/default/city_imprvm.png");
-
- pBuf = load_surf(cBuf);
- if (!pBuf) {
- abort();
- }
-
- crop_rect.x = 1;
- crop_rect.y = 1;
-
- pImpr = get_improvement_type(B_PALACE);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_BARRACKS);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- get_improvement_type(B_BARRACKS2)->sprite = pImpr->sprite;
- get_improvement_type(B_BARRACKS3)->sprite = pImpr->sprite;
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_GRANARY);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_TEMPLE);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_MARKETPLACE);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_LIBRARY);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_COURTHOUSE);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_CITY);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x = 1;
- crop_rect.y += 21;
- pImpr = get_improvement_type(B_AQUEDUCT);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_BANK);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_CATHEDRAL);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_UNIVERSITY);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_MASS);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_COLOSSEUM);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_FACTORY);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_MFG);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x = 1;
- crop_rect.y += 21;
- pImpr = get_improvement_type(B_SDI);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_RECYCLING);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_POWER);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_HYDRO);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_NUCLEAR);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_STOCK);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_SEWER);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_SUPERMARKET);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x = 1;
- crop_rect.y += 21;
- pImpr = get_improvement_type(B_SUPERHIGHWAYS);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_RESEARCH);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_SAM);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_COASTAL);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_SOLAR);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_HARBOUR);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_OFFSHORE);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_AIRPORT);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x = 1;
- crop_rect.y += 21;
- pImpr = get_improvement_type(B_POLICE);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_PORT);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_SSTRUCTURAL);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_SCOMP);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_SMODULE);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_CAPITAL);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x = 1;
- crop_rect.y += 21;
- pImpr = get_improvement_type(B_PYRAMIDS);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_HANGING);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_COLLOSSUS);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_LIGHTHOUSE);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_GREAT);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_ORACLE);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_WALL);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x = 1;
- crop_rect.y += 21;
- pImpr = get_improvement_type(B_SUNTZU);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_RICHARDS);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_MARCO);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_MICHELANGELO);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_COPERNICUS);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_MAGELLAN);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_SHAKESPEARE);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x = 1;
- crop_rect.y += 21;
- pImpr = get_improvement_type(B_LEONARDO);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_BACH);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_ISAAC);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_ASMITHS);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_DARWIN);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_LIBERTY);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_EIFFEL);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x = 1;
- crop_rect.y += 21;
- pImpr = get_improvement_type(B_WOMENS);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_HOOVER);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_MANHATTEN);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_UNITED);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_APOLLO);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_SETI);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
- crop_rect.x += 37;
- pImpr = get_improvement_type(B_CURE);
- pImpr->sprite =
- (struct Sprite *) crop_rect_from_surface(pBuf, &crop_rect);
-
-
- FREESURFACE(pBuf);
-#endif
-
- /* ================================================================= */
- pCity_Icon = MALLOC(sizeof(*pCity_Icon));
-
- sprintf(cBuf, "%s%s", pDataPath, "theme/default/city_icons.png");
-
- pBuf = load_surf(cBuf);
- if (!pBuf) {
- abort();
- }
- crop_rect.w = crop_rect.h = 14;
- crop_rect.x = 1;
- crop_rect.y = 1;
-
- pCity_Icon->pBIG_Food_Corr = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pBIG_Food_Corr,
- SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pBIG_Food_Corr, 13, 0));
-
- crop_rect.x += 15;
- pCity_Icon->pBIG_Shield_Corr = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pBIG_Shield_Corr,
- SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pBIG_Shield_Corr, 0, 0));
-
- crop_rect.x += 15;
- pCity_Icon->pBIG_Trade_Corr = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pBIG_Trade_Corr,
- SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pBIG_Trade_Corr, 0, 0));
-
- crop_rect.x = 1;
- crop_rect.y += 15;
- pCity_Icon->pBIG_Food = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pBIG_Food, SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pBIG_Food, 13, 0));
-
- crop_rect.x += 15;
- pCity_Icon->pBIG_Shield = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pBIG_Shield, SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pBIG_Shield, 0, 0));
-
- crop_rect.x += 15;
- pCity_Icon->pBIG_Trade = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pBIG_Trade, SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pBIG_Trade, 0, 0));
- crop_rect.x = 1;
- crop_rect.y += 15;
- pCity_Icon->pBIG_Luxury = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pBIG_Luxury, SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pBIG_Luxury, 0, 0));
- crop_rect.x += 15;
- pCity_Icon->pBIG_Coin = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pBIG_Coin, SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pBIG_Coin, 0, 0));
- crop_rect.x += 15;
- pCity_Icon->pBIG_Colb = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pBIG_Colb, SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pBIG_Colb, 0, 0));
-
- crop_rect.x = 1 + 15;
- crop_rect.y += 15;
- pCity_Icon->pBIG_Coin_Corr = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pBIG_Coin_Corr,
- SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pBIG_Coin_Corr, 0, 0));
-
- crop_rect.x += 15;
- pCity_Icon->pBIG_Coin_UpKeep = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pBIG_Coin_UpKeep,
- SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pBIG_Coin_UpKeep, 0, 0));
- /* small icon */
- crop_rect.x = 1;
- crop_rect.y = 72;
- crop_rect.w = 10;
- crop_rect.h = 10;
- pCity_Icon->pFood = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pFood, SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pFood, 0, 0));
-
- crop_rect.x += 11;
- pCity_Icon->pShield = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pShield, SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pShield, 0, 0));
-
- crop_rect.x += 11;
- pCity_Icon->pTrade = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pTrade, SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pTrade, 0, 0));
-
- crop_rect.x += 11;
- pCity_Icon->pFace = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pFace, SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pFace, 0, 0));
-
- crop_rect.x += 1;
- crop_rect.y += 11;
- pCity_Icon->pLuxury = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pLuxury, SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pLuxury, 0, 0));
- crop_rect.x += 11;
- pCity_Icon->pCoin = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pCoin, SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pCoin, 0, 0));
- crop_rect.x += 11;
- pCity_Icon->pColb = crop_rect_from_surface(pBuf, &crop_rect);
- SDL_SetColorKey(pCity_Icon->pColb, SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pColb, 0, 0));
-
- FREESURFACE(pBuf);
- /* ================================================================= */
- sprintf(cBuf, "%s%s", pDataPath, "theme/default/city_pollution.png");
-
- pCity_Icon->pPollutions = load_surf(cBuf);
-
- if (!pCity_Icon->pPollutions) {
- abort();
- }
-
- SDL_SetColorKey(pCity_Icon->pPollutions, SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pPollutions, 0, 0));
- /* ================================================================= */
- sprintf(cBuf, "%s%s", pDataPath, "theme/default/city_fist.png");
-
- pCity_Icon->pFist = load_surf(cBuf);
-
- if (!pCity_Icon->pFist) {
- abort();
- }
-
- SDL_SetColorKey(pCity_Icon->pFist, SDL_SRCCOLORKEY | SDL_RLEACCEL,
- getpixel(pCity_Icon->pFist, 1, 0));
-
- /* ================================================================= */
-
- pCity_Icon->style = 999;
-}
diff -u -r fc2/client/gui-sdl/citydlg.h fc/client/gui-sdl/citydlg.h
--- fc2/client/gui-sdl/citydlg.h Mon Dec 2 09:47:01 2002
+++ fc/client/gui-sdl/citydlg.h Wed Dec 4 18:59:44 2002
@@ -24,9 +24,7 @@
#include "citydlg_g.h"
-void load_city_icons(void);
void refresh_city_dlg_background(void);
-SDL_Surface *get_colb_surface(void);
SDL_Rect *get_citydlg_rect(void);
-#endif /* FC__CITYDLG_H */
+#endif /* FC__CITYDLG_H */
diff -u -r fc2/client/gui-sdl/cma_fe.c fc/client/gui-sdl/cma_fe.c
--- fc2/client/gui-sdl/cma_fe.c Mon Dec 2 09:47:02 2002
+++ fc/client/gui-sdl/cma_fe.c Thu Dec 5 20:54:18 2002
@@ -44,6 +44,7 @@
#define BUFFER_SIZE 64
+#if 0
#define SPECLIST_TAG cma_dialog
#define SPECLIST_TYPE struct cma_dialog
#include "speclist.h"
@@ -55,3 +56,4 @@
#define cma_dialog_list_iterate(presetlist, ppreset) \
TYPED_LIST_ITERATE(struct cma_dialog, presetlist, ppreset)
#define cma_dialog_list_iterate_end LIST_ITERATE_END
+#endif
diff -u -r fc2/client/gui-sdl/connectdlg.c fc/client/gui-sdl/connectdlg.c
--- fc2/client/gui-sdl/connectdlg.c Mon Dec 2 09:47:02 2002
+++ fc/client/gui-sdl/connectdlg.c Thu Dec 5 17:35:10 2002
@@ -47,7 +47,7 @@
#include "graphics.h"
#include "gui_string.h"
#include "gui_stuff.h"
-
+#include "gui_tilespec.h"
#include "gui_id.h"
#include "gui_main.h"
diff -u -r fc2/client/gui-sdl/dialogs.c fc/client/gui-sdl/dialogs.c
--- fc2/client/gui-sdl/dialogs.c Mon Dec 2 09:47:02 2002
+++ fc/client/gui-sdl/dialogs.c Thu Dec 5 21:44:42 2002
@@ -59,7 +59,7 @@
#include "gui_stuff.h"
#include "gui_zoom.h"
#include "gui_id.h"
-
+#include "gui_tilespec.h"
#include "gui_main.h"
#include "mapview.h"
@@ -68,6 +68,15 @@
#include "dialogs.h"
+/**********************************************************************
+ This function is called when the client disconnects or the game is
+ over. It should close all dialog windows for that game.
+***********************************************************************/
+void popdown_all_game_dialogs(void)
+{
+ freelog(LOG_DEBUG, "popdown_all_game_dialogs : PORT ME");
+}
+
/**************************************************************************
Popup a dialog to display information about an event that has a
specific location. The user should be given the option to goto that
@@ -1220,7 +1229,7 @@
sz_strlcpy(packet.name, pStr);
FREE(pStr);
- if (!get_sane_name(packet.name)) {
+ if (!is_sane_name(packet.name)) {
append_output_window(_("You must type a legal name."));
pSellected_Widget = pStart_Button;
set_wstate(pStart_Button, WS_SELLECTED);
diff -u -r fc2/client/gui-sdl/graphics.c fc/client/gui-sdl/graphics.c
--- fc2/client/gui-sdl/graphics.c Mon Dec 2 09:47:02 2002
+++ fc/client/gui-sdl/graphics.c Fri Dec 6 00:24:07 2002
@@ -103,11 +103,12 @@
{
Uint8 *data;
Uint8 *mask;
+ SDL_Cursor *mouse;
int i = 0;
size_t size = height << 2;
- data = ALLOCA(size);
- mask = ALLOCA(size);
+ data = MALLOC(size);
+ mask = MALLOC(size);
while (i != size) {
data[i] = image_data[i + 3];
@@ -121,7 +122,12 @@
i += 4;
}
- return SDL_CreateCursor(data, mask, width, height, hot_x, hot_y);
+ mouse = SDL_CreateCursor(data, mask, width, height, hot_x, hot_y);
+
+ FREE( data );
+ FREE( mask );
+
+ return mouse;
}
/**************************************************************************
@@ -1853,9 +1859,9 @@
graphics types extensions. Extensions listed first will be checked
first.
**************************************************************************/
-char **gfx_fileextensions(void)
+const char **gfx_fileextensions(void)
{
- static char *ext[] = {
+ static const char *ext[] = {
"png",
"xpm",
NULL
@@ -1877,8 +1883,7 @@
if ((pBuf = IMG_Load(filename)) == NULL) {
freelog(LOG_ERROR,
- _
- ("load_surf: £adowanie pliku graficznego %s nie powiod³o siê !!"),
+ _("load_surf: £adowanie pliku graficznego %s nie powiod³o siê !!"),
filename);
return NULL; /* Should I use abotr() ? */
}
diff -u -r fc2/client/gui-sdl/gui_main.c fc/client/gui-sdl/gui_main.c
--- fc2/client/gui-sdl/gui_main.c Mon Dec 2 09:47:02 2002
+++ fc/client/gui-sdl/gui_main.c Thu Dec 5 21:28:41 2002
@@ -77,6 +77,7 @@
#include "spaceshipdlg.h"
#include "resources.h"
#include "tilespec.h"
+#include "gui_tilespec.h"
#include "gui_main.h"
@@ -509,11 +510,12 @@
{
parse_options(argc, argv);
- load_theme();
-
tilespec_load_tiles();
load_cursors();
+ tilespec_setup_theme();
+
+ tilespec_setup_city_icons();
pSellected_Widget = create_themeicon(pTheme->Options_Icon,
(WF_WIDGET_HAS_INFO_LABEL |
@@ -550,7 +552,7 @@
gui_main_loop();
- unload_theme();
+ tilespec_unload_theme();
unload_cursors();
quit_sdl();
diff -u -r fc2/client/gui-sdl/gui_main.h fc/client/gui-sdl/gui_main.h
--- fc2/client/gui-sdl/gui_main.h Mon Dec 2 09:47:02 2002
+++ fc/client/gui-sdl/gui_main.h Thu Dec 5 17:32:40 2002
@@ -46,7 +46,6 @@
#define CF_CHANGE_TAXRATE_SCI_BLOCK 0x8000
extern struct Sdl Main;
-extern struct Theme *pTheme;
extern struct GUI *pSellected_Widget;
extern Uint32 SDL_Client_Flags;
diff -u -r fc2/client/gui-sdl/gui_mem.h fc/client/gui-sdl/gui_mem.h
--- fc2/client/gui-sdl/gui_mem.h Mon Dec 2 09:47:02 2002
+++ fc/client/gui-sdl/gui_mem.h Fri Dec 6 00:06:25 2002
@@ -27,16 +27,6 @@
/* free with a check */
#define FREE(ptr) do { if (ptr) free(ptr); ptr = NULL; } while(0)
-/* dynamic allocate mem with a check and clear */
-
-#define ALLOCA(size) \
-(__extension__ \
- ({ \
- void *__new = alloca(size); \
- if (!__new) abort(); \
- memset(__new, 0, size); \
- }))
-
/* malloc with check and clear */
#define MALLOC(size) memset(fc_real_malloc((size), "malloc", \
__LINE__, __FILE__), 0, size)
diff -u -r fc2/client/gui-sdl/gui_string.c fc/client/gui-sdl/gui_string.c
--- fc2/client/gui-sdl/gui_string.c Mon Dec 2 09:47:02 2002
+++ fc/client/gui-sdl/gui_string.c Fri Dec 6 00:16:24 2002
@@ -405,7 +405,7 @@
}
size = strlen(pDataPath) + strlen(FONT_WITH_PATH) + 1;
- pFont_with_FullPath = ALLOCA(size);
+ pFont_with_FullPath = MALLOC(size);
my_snprintf(pFont_with_FullPath, size, "%s%s", pDataPath,
FONT_WITH_PATH);
@@ -415,9 +415,12 @@
freelog(LOG_ERROR,
_("Error in load_font2: Couldn't load %d pt font from %s: %s"),
ptsize, pFont_with_FullPath, SDL_GetError());
+ FREE( pFont_with_FullPath );
return font_tmp;
}
+ FREE( pFont_with_FullPath );
+
/* add new font to list */
if (Sizeof_Font_TAB == 0) {
Sizeof_Font_TAB++;
diff -u -r fc2/client/gui-sdl/gui_stuff.c fc/client/gui-sdl/gui_stuff.c
--- fc2/client/gui-sdl/gui_stuff.c Mon Dec 2 09:47:02 2002
+++ fc/client/gui-sdl/gui_stuff.c Fri Dec 6 00:14:05 2002
@@ -42,7 +42,7 @@
#include "unistring.h"
#include "gui_string.h"
#include "gui_zoom.h"
-
+#include "gui_tilespec.h"
#include "gui_main.h"
#include "gui_stuff.h"
@@ -50,7 +50,6 @@
#define INFO_TIMER_INTERVAL 1500
struct GUI *pSellected_Widget;
-struct Theme *pTheme;
extern char *pDataPath;
@@ -2776,6 +2775,7 @@
int iStart_X = 5, iInputChain_X = 0;
int iStart_Mod_X;
+ struct UniChar ___last;
struct UniChar *pBeginTextChain = NULL;
struct UniChar *pEndTextChain = NULL;
struct UniChar *pInputChain = NULL;
@@ -2801,7 +2801,7 @@
/* Creating Empty (Last) pice of Chain */
- pInputChain = ALLOCA(sizeof(struct UniChar));
+ pInputChain = &___last;
pEndTextChain = pInputChain;
pEndTextChain->chr = 32; /*spacebar */
diff -u -r fc2/client/gui-sdl/gui_stuff.h fc/client/gui-sdl/gui_stuff.h
--- fc2/client/gui-sdl/gui_stuff.h Mon Dec 2 09:47:02 2002
+++ fc/client/gui-sdl/gui_stuff.h Thu Dec 5 17:33:13 2002
@@ -78,72 +78,6 @@
WT_ICON2 = 56 /* flat Button from 1 - state icon */
};
-struct Theme {
- SDL_Surface *Button;
- SDL_Surface *Edit;
- SDL_Surface *CBOX_Sell_Icon;
- SDL_Surface *CBOX_Unsell_Icon;
- SDL_Surface *OK_Icon;
- SDL_Surface *CANCEL_Icon;
- SDL_Surface *FORWARD_Icon;
- SDL_Surface *BACK_Icon;
- SDL_Surface *META_Icon;
- SDL_Surface *INFO_Icon;
- SDL_Surface *UP_Icon;
- SDL_Surface *DOWN_Icon;
- SDL_Surface *LEFT_Icon;
- SDL_Surface *RIGHT_Icon;
- SDL_Surface *Vertic;
- SDL_Surface *Horiz;
- SDL_Surface *FR_Vert;
- SDL_Surface *FR_Hor;
- SDL_Surface *R_ARROW_Icon;
- SDL_Surface *L_ARROW_Icon;
-
- SDL_Surface *Options_Icon;
- SDL_Surface *Block;
- SDL_Surface *UNITS_Icon;
- SDL_Surface *MAP_Icon;
- SDL_Surface *LOG_Icon;
- SDL_Surface *FindCity_Icon;
- SDL_Surface *NEW_TURN_Icon;
-
- /* city icons */
- SDL_Surface *Army_Icon;
- SDL_Surface *Support_Icon;
- SDL_Surface *Happy_Icon;
- SDL_Surface *CMA_Icon;
- SDL_Surface *PROD_Icon;
- SDL_Surface *QPROD_Icon;
- SDL_Surface *Buy_PROD_Icon;
-
- /* orders icons */
- SDL_Surface *Order_Icon;
- SDL_Surface *ODisband_Icon;
- SDL_Surface *OWait_Icon;
- SDL_Surface *ODone_Icon;
- SDL_Surface *OAutoAtt_Icon;
- SDL_Surface *OAutoExp_Icon;
- SDL_Surface *OAutoSett_Icon;
- SDL_Surface *OAutoConet_Icon;
- SDL_Surface *OUnload_Icon;
- SDL_Surface *OBuildCity_Icon;
- SDL_Surface *OGotoCity_Icon;
- SDL_Surface *OGoto_Icon;
- SDL_Surface *OHomeCity_Icon;
- SDL_Surface *OPatrol_Icon;
- SDL_Surface *OMine_Icon;
- SDL_Surface *OForest_Icon;
- SDL_Surface *OCropForest_Icon;
- SDL_Surface *OFortify_Icon;
- SDL_Surface *OSentry_Icon;
- SDL_Surface *OIrigation_Icon;
- SDL_Surface *ORoad_Icon;
-};
-
-void load_theme(void);
-void unload_theme(void);
-
struct ScrollBar {
Uint16 active; /* used by scroll: active(sean)
size of scroll list */
diff -u -r fc2/client/gui-sdl/gui_tilespec.c fc/client/gui-sdl/gui_tilespec.c
--- fc2/client/gui-sdl/gui_tilespec.c Thu Dec 5 22:32:05 2002
+++ fc/client/gui-sdl/gui_tilespec.c Thu Dec 5 17:27:21 2002
@@ -0,0 +1,415 @@
+/**********************************************************************
+ Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+***********************************************************************/
+
+/**********************************************************************
+ gui_tilespec.c - description
+ -------------------
+ begin : Dec. 2 2002
+ copyright : (C) 2002 by Rafa³ Bursig
+ email : Rafal Bursig <bursig@xxxxxxxxx>
+ **********************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <SDL/SDL.h>
+
+#include "hash.h"
+
+#include "tilespec.h"
+
+#include "gui_mem.h"
+#include "graphics.h"
+#include "gui_zoom.h"
+
+#include "gui_tilespec.h"
+
+
+/*******************************************************************************
+ * reload small citizens "style" icons.
+
*******************************************************************************/
+static void reload_small_citizens_icons( int style )
+{
+
+ /* free info icons */
+ FREESURFACE( pIcons->pMale_Content );
+ FREESURFACE( pIcons->pFemale_Content );
+ FREESURFACE( pIcons->pMale_Happy );
+ FREESURFACE( pIcons->pFemale_Happy );
+ FREESURFACE( pIcons->pMale_Unhappy );
+ FREESURFACE( pIcons->pFemale_Unhappy );
+ FREESURFACE( pIcons->pMale_Angry );
+ FREESURFACE( pIcons->pFemale_Angry );
+
+ FREESURFACE( pIcons->pSpec_Lux ); /* Elvis */
+ FREESURFACE( pIcons->pSpec_Tax ); /* TaxMan */
+ FREESURFACE( pIcons->pSpec_Sci ); /* Scientist */
+
+ /* allocate icons */
+ pIcons->pMale_Happy = ResizeSurface( (SDL_Surface *)sprites.citizen[5] , 15
, 26, 1 );
+ SDL_SetColorKey( pIcons->pMale_Happy , SDL_SRCCOLORKEY|SDL_RLEACCEL ,
+ getpixel( pIcons->pMale_Happy , 0 ,0 ) );
+
+ pIcons->pFemale_Happy = ResizeSurface( (SDL_Surface *)sprites.citizen[6] ,
15 , 26, 1 );
+ SDL_SetColorKey( pIcons->pFemale_Happy , SDL_SRCCOLORKEY|SDL_RLEACCEL ,
+ getpixel( pIcons->pFemale_Happy , 0 ,0 ) );
+
+ pIcons->pMale_Content = ResizeSurface( (SDL_Surface *)sprites.citizen[3] ,
15 , 26, 1 );
+ SDL_SetColorKey( pIcons->pMale_Content , SDL_SRCCOLORKEY|SDL_RLEACCEL ,
+ getpixel( pIcons->pMale_Content , 0 ,0 ) );
+
+ pIcons->pFemale_Content = ResizeSurface( (SDL_Surface *)sprites.citizen[4],
15 , 26, 1 );
+ SDL_SetColorKey( pIcons->pFemale_Content , SDL_SRCCOLORKEY|SDL_RLEACCEL ,
+ getpixel( pIcons->pFemale_Content , 0 ,0 ) );
+
+ pIcons->pMale_Unhappy = ResizeSurface( (SDL_Surface *)sprites.citizen[7], 15
, 26, 1 );
+ SDL_SetColorKey( pIcons->pMale_Unhappy , SDL_SRCCOLORKEY|SDL_RLEACCEL ,
+ getpixel( pIcons->pMale_Unhappy , 0 ,0 ) );
+
+ pIcons->pFemale_Unhappy = ResizeSurface( (SDL_Surface *)sprites.citizen[8],
15 , 26, 1 );
+ SDL_SetColorKey( pIcons->pFemale_Unhappy , SDL_SRCCOLORKEY|SDL_RLEACCEL ,
+ getpixel( pIcons->pFemale_Unhappy , 0 ,0 ) );
+
+ pIcons->pMale_Angry = ResizeSurface( (SDL_Surface *)sprites.citizen[9], 15 ,
26, 1 );
+ SDL_SetColorKey( pIcons->pMale_Angry , SDL_SRCCOLORKEY|SDL_RLEACCEL ,
+ getpixel( pIcons->pMale_Angry , 0 ,0 ) );
+
+ pIcons->pFemale_Angry = ResizeSurface( (SDL_Surface *)sprites.citizen[10],
15 , 26, 1 );
+ SDL_SetColorKey( pIcons->pFemale_Angry , SDL_SRCCOLORKEY|SDL_RLEACCEL ,
+ getpixel( pIcons->pFemale_Angry , 0 ,0 ) );
+
+ pIcons->pSpec_Lux = ResizeSurface( (SDL_Surface *)sprites.citizen[0] , 15 ,
26, 1 );
+ SDL_SetColorKey( pIcons->pSpec_Lux , SDL_SRCCOLORKEY|SDL_RLEACCEL ,
+ getpixel( pIcons->pSpec_Lux , 0 ,0 ) );
+
+ pIcons->pSpec_Tax = ResizeSurface( (SDL_Surface *)sprites.citizen[2] , 15 ,
26, 1 );
+ SDL_SetColorKey( pIcons->pSpec_Tax , SDL_SRCCOLORKEY|SDL_RLEACCEL ,
+ getpixel( pIcons->pSpec_Tax , 0 ,0 ) );
+
+ pIcons->pSpec_Sci = ResizeSurface( (SDL_Surface *)sprites.citizen[1] , 15 ,
26, 1 );
+ SDL_SetColorKey( pIcons->pSpec_Sci , SDL_SRCCOLORKEY|SDL_RLEACCEL ,
+ getpixel( pIcons->pSpec_Sci , 0 ,0 ) );
+
+}
+/*
=================================================================================
*/
+/* ===================================== Public
==================================== */
+/*
=================================================================================
*/
+
+/**********************************************************************
+ Set city citizens icons sprite value; should only happen after
+ start of game (city style struct was filled ).
+***********************************************************************/
+void reload_citizens_icons( int style )
+{
+ tilespec_setup_citizens_tiles( style );
+ reload_small_citizens_icons( style );
+ pIcons->style = style;
+}
+
+/**********************************************************************
+ Set city icons sprite value; should only happen after
+ tilespec_load_tiles().
+***********************************************************************/
+void tilespec_setup_city_icons(void)
+{
+ struct hash_table *local_sprite_hash = get_sprite_hash();
+
+ pIcons = ( struct City_Icon *)MALLOC( sizeof( struct City_Icon ));
+
+ pIcons->pPollution = hash_lookup_data(local_sprite_hash, "city.pollution" );
+ assert(pIcons->pPollution != NULL);
+
+ pIcons->pPolice = hash_lookup_data(local_sprite_hash, "city.police" );
+ assert(pIcons->pPolice != NULL);
+
+ pIcons->pBIG_Food_Corr = hash_lookup_data(local_sprite_hash,
"city.food_waste" );
+ assert(pIcons->pBIG_Food_Corr != NULL);
+
+ pIcons->pBIG_Shield_Corr = hash_lookup_data(local_sprite_hash,
"city.shield_waste" );
+ assert(pIcons->pBIG_Shield_Corr != NULL);
+
+ pIcons->pBIG_Trade_Corr = hash_lookup_data(local_sprite_hash,
"city.trade_waste" );
+ assert(pIcons->pBIG_Trade_Corr != NULL);
+
+ pIcons->pBIG_Food = hash_lookup_data(local_sprite_hash, "city.food" );
+ assert(pIcons->pBIG_Food != NULL);
+
+ pIcons->pBIG_Shield = hash_lookup_data(local_sprite_hash, "city.shield" );
+ assert(pIcons->pBIG_Shield != NULL);
+
+ pIcons->pBIG_Trade = hash_lookup_data(local_sprite_hash, "city.trade" );
+ assert(pIcons->pBIG_Trade != NULL);
+
+ pIcons->pBIG_Luxury = hash_lookup_data(local_sprite_hash, "city.lux" );
+ assert(pIcons->pBIG_Luxury != NULL);
+
+ pIcons->pBIG_Coin = hash_lookup_data(local_sprite_hash, "city.coin" );
+ assert(pIcons->pBIG_Coin != NULL);
+
+ pIcons->pBIG_Colb = hash_lookup_data(local_sprite_hash, "city.colb" );
+ assert(pIcons->pBIG_Colb != NULL);
+/*
+ pIcons->pBIG_Face = hash_lookup_data(local_sprite_hash, "city.red_face" );
+ assert(pIcons->pBIG_Face != NULL);
+*/
+ pIcons->pBIG_Coin_Corr = hash_lookup_data(local_sprite_hash,
"city.dark_coin" );
+ assert(pIcons->pBIG_Coin_Corr != NULL);
+
+ pIcons->pBIG_Coin_UpKeep = hash_lookup_data(local_sprite_hash,
"city.unkeep_coin" );
+ assert(pIcons->pBIG_Coin_UpKeep != NULL);
+
+ /* small */
+ pIcons->pFood = hash_lookup_data(local_sprite_hash, "city.small_food" );
+ assert(pIcons->pFood != NULL);
+
+ pIcons->pShield = hash_lookup_data(local_sprite_hash, "city.small_shield" );
+ assert(pIcons->pShield != NULL);
+
+ pIcons->pTrade = hash_lookup_data(local_sprite_hash, "city.small_trade" );
+ assert(pIcons->pTrade != NULL);
+
+ pIcons->pFace = hash_lookup_data(local_sprite_hash, "city.small_red_face" );
+ assert(pIcons->pFace != NULL);
+
+ pIcons->pLuxury = hash_lookup_data(local_sprite_hash, "city.small_lux" );
+ assert(pIcons->pLuxury != NULL);
+
+ pIcons->pCoin = hash_lookup_data(local_sprite_hash, "city.small_coin" );
+ assert(pIcons->pCoin != NULL);
+
+ pIcons->pColb = hash_lookup_data(local_sprite_hash, "city.small_colb" );
+ assert(pIcons->pColb != NULL);
+
+/*
+ pIcons->pDark_Face = hash_lookup_data(local_sprite_hash,
"city.small_dark_face" );
+ assert(pIcons->pDark_Face != NULL);
+*/
+
+ /* force reload citizens */
+ pIcons->style = 999;
+}
+/* =================================================== */
+/* ===================== THEME ======================= */
+/* =================================================== */
+
+/*
+ * Alloc and fill Theme struct
+ */
+void tilespec_setup_theme(void)
+{
+ struct hash_table *local_sprite_hash = get_sprite_hash();
+
+ pTheme = (struct Theme *)MALLOC( sizeof(struct Theme) );
+
+ pTheme->Button = hash_lookup_data(local_sprite_hash, "theme.button" );
+ assert(pTheme->Button != NULL);
+
+ pTheme->Edit = hash_lookup_data(local_sprite_hash, "theme.edit" );
+ assert(pTheme->Edit != NULL);
+
+ pTheme->OK_Icon = hash_lookup_data(local_sprite_hash, "theme.OK_button" );
+ assert(pTheme->OK_Icon != NULL);
+
+ pTheme->CANCEL_Icon = hash_lookup_data(local_sprite_hash,
"theme.FAIL_button" );
+ assert(pTheme->CANCEL_Icon != NULL);
+
+ pTheme->FORWARD_Icon = hash_lookup_data(local_sprite_hash,
"theme.NEXT_button" );
+ assert(pTheme->FORWARD_Icon != NULL);
+
+ pTheme->BACK_Icon = hash_lookup_data(local_sprite_hash, "theme.BACK_button"
);
+ assert(pTheme->BACK_Icon != NULL);
+
+ pTheme->UP_Icon = hash_lookup_data(local_sprite_hash, "theme.UP_scroll" );
+ assert(pTheme->UP_Icon != NULL);
+
+ pTheme->DOWN_Icon = hash_lookup_data(local_sprite_hash, "theme.DOWN_scroll"
);
+ assert(pTheme->DOWN_Icon != NULL);
+/*
+ pTheme->LEFT_Icon = hash_lookup_data(local_sprite_hash, "theme.LEFT_scroll"
);
+ assert(pTheme->LEFT_Icon != NULL);
+
+ pTheme->RIGHT_Icon = hash_lookup_data(local_sprite_hash,
"theme.RIGHT_scroll" );
+ assert(pTheme->RIGHT_Icon != NULL);
+*/
+ pTheme->Vertic = hash_lookup_data(local_sprite_hash,
"theme.vertic_scrollbar" );
+ assert(pTheme->Vertic != NULL);
+
+ pTheme->Horiz = hash_lookup_data(local_sprite_hash, "theme.horiz_scrollbar"
);
+ assert(pTheme->Horiz != NULL);
+
+ pTheme->CBOX_Sell_Icon = hash_lookup_data(local_sprite_hash, "theme.sbox" );
+ assert(pTheme->CBOX_Sell_Icon != NULL);
+
+ pTheme->CBOX_Unsell_Icon = hash_lookup_data(local_sprite_hash, "theme.ubox"
);
+ assert(pTheme->CBOX_Unsell_Icon != NULL);
+
+ pTheme->FR_Vert = hash_lookup_data(local_sprite_hash, "theme.vertic_frame" );
+ assert(pTheme->FR_Vert != NULL);
+
+ pTheme->FR_Hor = hash_lookup_data(local_sprite_hash, "theme.horiz_frame" );
+ assert(pTheme->FR_Hor != NULL);
+
+ pTheme->Block = hash_lookup_data(local_sprite_hash, "theme.block" );
+ assert(pTheme->Block != NULL);
+
+ pTheme->R_ARROW_Icon = hash_lookup_data(local_sprite_hash,
"theme.RIGHT_ARROW_button" );
+ assert(pTheme->R_ARROW_Icon != NULL);
+
+ pTheme->L_ARROW_Icon = hash_lookup_data(local_sprite_hash,
"theme.LEFT_ARROW_button" );
+ assert(pTheme->L_ARROW_Icon != NULL);
+
+ pTheme->META_Icon = hash_lookup_data(local_sprite_hash, "theme.META_button"
);
+ assert(pTheme->META_Icon != NULL);
+
+ pTheme->Options_Icon = hash_lookup_data(local_sprite_hash,
"theme.OPTIONS_button" );
+ assert(pTheme->Options_Icon != NULL);
+
+ pTheme->UNITS_Icon = hash_lookup_data(local_sprite_hash,
"theme.UNITS_button" );
+ assert(pTheme->UNITS_Icon != NULL);
+
+ pTheme->MAP_Icon = hash_lookup_data(local_sprite_hash, "theme.MAP_button" );
+ assert(pTheme->MAP_Icon != NULL);
+
+ pTheme->LOG_Icon = hash_lookup_data(local_sprite_hash, "theme.LOG_button" );
+ assert(pTheme->LOG_Icon != NULL);
+
+ pTheme->FindCity_Icon = hash_lookup_data(local_sprite_hash,
"theme.FIND_CITY_button" );
+ assert(pTheme->FindCity_Icon != NULL);
+
+ pTheme->NEW_TURN_Icon = hash_lookup_data(local_sprite_hash,
"theme.NEW_TURN_button" );
+ assert(pTheme->NEW_TURN_Icon != NULL);
+
+ /* ================================================================== */
+
+ pTheme->INFO_Icon = hash_lookup_data(local_sprite_hash, "theme.INFO_button"
);
+ assert(pTheme->INFO_Icon != NULL);
+
+ pTheme->Happy_Icon = hash_lookup_data(local_sprite_hash,
"theme.HAPPY_button" );
+ assert(pTheme->Happy_Icon != NULL);
+
+ pTheme->Army_Icon = hash_lookup_data(local_sprite_hash, "theme.ARMY_button"
);
+ assert(pTheme->Army_Icon != NULL);
+
+ pTheme->Support_Icon = hash_lookup_data(local_sprite_hash,
"theme.HOME_button" );
+ assert(pTheme->Support_Icon != NULL);
+
+ pTheme->PROD_Icon = hash_lookup_data(local_sprite_hash, "theme.PROD_button"
);
+ assert(pTheme->PROD_Icon != NULL);
+
+ pTheme->QPROD_Icon = hash_lookup_data(local_sprite_hash,
"theme.WORK_LIST_button" );
+ assert(pTheme->QPROD_Icon != NULL);
+
+ pTheme->Buy_PROD_Icon = hash_lookup_data(local_sprite_hash,
"theme.BUY_button" );
+ assert(pTheme->Buy_PROD_Icon != NULL);
+
+ pTheme->CMA_Icon = hash_lookup_data(local_sprite_hash, "theme.CMA_button" );
+ assert(pTheme->CMA_Icon != NULL);
+
+ /* ================================================================== */
+
+ pTheme->Order_Icon = hash_lookup_data(local_sprite_hash, "theme.order_empty"
);
+ assert(pTheme->Order_Icon != NULL);
+
+ pTheme->ODisband_Icon = hash_lookup_data(local_sprite_hash,
"theme.order_disband" );
+ assert(pTheme->Order_Icon != NULL);
+
+
+ pTheme->OWait_Icon = hash_lookup_data(local_sprite_hash, "theme.order_wait"
);
+ assert(pTheme->OWait_Icon != NULL);
+
+ pTheme->ODone_Icon = hash_lookup_data(local_sprite_hash, "theme.order_done"
);
+ assert(pTheme->ODone_Icon != NULL);
+
+ pTheme->OAutoAtt_Icon = hash_lookup_data(local_sprite_hash,
"theme.order_auto_attack" );
+ assert(pTheme->OAutoAtt_Icon != NULL);
+
+ pTheme->OAutoSett_Icon = hash_lookup_data(local_sprite_hash,
"theme.order_auto_settler" );
+ assert(pTheme->OAutoSett_Icon != NULL);
+
+ pTheme->OAutoConet_Icon = hash_lookup_data(local_sprite_hash,
"theme.order_connect" );
+ assert(pTheme->OAutoConet_Icon != NULL);
+
+ pTheme->OAutoExp_Icon = hash_lookup_data(local_sprite_hash,
"theme.order_auto_explorer" );
+ assert(pTheme->OAutoExp_Icon != NULL);
+
+ pTheme->OUnload_Icon = hash_lookup_data(local_sprite_hash,
"theme.order_unload" );
+ assert(pTheme->OUnload_Icon != NULL);
+
+ pTheme->OBuildCity_Icon = hash_lookup_data(local_sprite_hash,
"theme.order_build_city" );
+ assert(pTheme->OBuildCity_Icon != NULL);
+
+ pTheme->OGotoCity_Icon = hash_lookup_data(local_sprite_hash,
"theme.order_goto_city" );
+ assert(pTheme->OGotoCity_Icon != NULL);
+
+ pTheme->OHomeCity_Icon = hash_lookup_data(local_sprite_hash,
"theme.order_home" );
+ assert(pTheme->OHomeCity_Icon != NULL);
+
+ pTheme->OGoto_Icon = hash_lookup_data(local_sprite_hash, "theme.order_goto"
);
+ assert(pTheme->OGoto_Icon != NULL);
+
+ pTheme->OPatrol_Icon = hash_lookup_data(local_sprite_hash,
"theme.order_patrol" );
+ assert(pTheme->OPatrol_Icon != NULL);
+
+ pTheme->OMine_Icon = hash_lookup_data(local_sprite_hash,
"theme.order_build_mining" );
+ assert(pTheme->OMine_Icon != NULL);
+
+ pTheme->OForest_Icon = hash_lookup_data(local_sprite_hash,
"theme.order_plant_tree" );
+ assert(pTheme->OForest_Icon != NULL);
+
+ pTheme->OCropForest_Icon = hash_lookup_data(local_sprite_hash,
"theme.order_crop_tree" );
+ assert(pTheme->OCropForest_Icon != NULL);
+
+ pTheme->OFortify_Icon = hash_lookup_data(local_sprite_hash,
"theme.order_fortify" );
+ assert(pTheme->OFortify_Icon != NULL);
+
+ pTheme->OSentry_Icon = hash_lookup_data(local_sprite_hash,
"theme.order_sentry" );
+ assert(pTheme->OSentry_Icon != NULL);
+
+ pTheme->OIrigation_Icon = hash_lookup_data(local_sprite_hash,
"theme.order_irrigation" );
+ assert(pTheme->OIrigation_Icon != NULL);
+
+ pTheme->ORoad_Icon = hash_lookup_data(local_sprite_hash,
"theme.order_build_road" );
+ assert(pTheme->ORoad_Icon != NULL);
+
+ return;
+}
+
+/*
+ * Free memmory
+ */
+void tilespec_unload_theme(void)
+{
+ FREESURFACE( pTheme->Button);
+ FREESURFACE( pTheme->Edit);
+ FREESURFACE( pTheme->OK_Icon);
+ FREESURFACE( pTheme->CANCEL_Icon);
+ FREESURFACE( pTheme->FORWARD_Icon);
+ FREESURFACE( pTheme->BACK_Icon);
+ FREESURFACE( pTheme->META_Icon);
+ FREESURFACE( pTheme->UP_Icon );
+ FREESURFACE( pTheme->DOWN_Icon );
+ FREESURFACE( pTheme->Vertic );
+ FREESURFACE( pTheme->Options_Icon );
+ FREESURFACE( pTheme->FR_Vert );
+ FREESURFACE( pTheme->FR_Hor );
+
+ /* TO DO ADD Rest */
+
+ FREE(pTheme);
+ return;
+}
diff -u -r fc2/client/gui-sdl/gui_tilespec.h fc/client/gui-sdl/gui_tilespec.h
--- fc2/client/gui-sdl/gui_tilespec.h Thu Dec 5 22:31:59 2002
+++ fc/client/gui-sdl/gui_tilespec.h Thu Dec 5 17:29:22 2002
@@ -0,0 +1,137 @@
+/**********************************************************************
+ Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+***********************************************************************/
+
+/**********************************************************************
+ gui_tilespec.h - description
+ -------------------
+ begin : Dec. 2 2002
+ copyright : (C) 2002 by Rafa³ Bursig
+ email : Rafal Bursig <bursig@xxxxxxxxx>
+ **********************************************************************/
+
+#ifndef FC__GUI_TILESPEC_H
+#define FC__GUI_TILESPEC_H
+
+struct Theme {
+ SDL_Surface *Button;
+ SDL_Surface *Edit;
+ SDL_Surface *CBOX_Sell_Icon;
+ SDL_Surface *CBOX_Unsell_Icon;
+ SDL_Surface *OK_Icon;
+ SDL_Surface *CANCEL_Icon;
+ SDL_Surface *FORWARD_Icon;
+ SDL_Surface *BACK_Icon;
+ SDL_Surface *META_Icon;
+ SDL_Surface *INFO_Icon;
+ SDL_Surface *UP_Icon;
+ SDL_Surface *DOWN_Icon;
+ SDL_Surface *LEFT_Icon;
+ SDL_Surface *RIGHT_Icon;
+ SDL_Surface *Vertic;
+ SDL_Surface *Horiz;
+ SDL_Surface *FR_Vert;
+ SDL_Surface *FR_Hor;
+ SDL_Surface *R_ARROW_Icon;
+ SDL_Surface *L_ARROW_Icon;
+
+ SDL_Surface *Options_Icon;
+ SDL_Surface *Block;
+ SDL_Surface *UNITS_Icon;
+ SDL_Surface *MAP_Icon;
+ SDL_Surface *LOG_Icon;
+ SDL_Surface *FindCity_Icon;
+ SDL_Surface *NEW_TURN_Icon;
+
+ /* city icons */
+ SDL_Surface *Army_Icon;
+ SDL_Surface *Support_Icon;
+ SDL_Surface *Happy_Icon;
+ SDL_Surface *CMA_Icon;
+ SDL_Surface *PROD_Icon;
+ SDL_Surface *QPROD_Icon;
+ SDL_Surface *Buy_PROD_Icon;
+
+ /* orders icons */
+ SDL_Surface *Order_Icon;
+ SDL_Surface *ODisband_Icon;
+ SDL_Surface *OWait_Icon;
+ SDL_Surface *ODone_Icon;
+ SDL_Surface *OAutoAtt_Icon;
+ SDL_Surface *OAutoExp_Icon;
+ SDL_Surface *OAutoSett_Icon;
+ SDL_Surface *OAutoConet_Icon;
+ SDL_Surface *OUnload_Icon;
+ SDL_Surface *OBuildCity_Icon;
+ SDL_Surface *OGotoCity_Icon;
+ SDL_Surface *OGoto_Icon;
+ SDL_Surface *OHomeCity_Icon;
+ SDL_Surface *OPatrol_Icon;
+ SDL_Surface *OMine_Icon;
+ SDL_Surface *OForest_Icon;
+ SDL_Surface *OCropForest_Icon;
+ SDL_Surface *OFortify_Icon;
+ SDL_Surface *OSentry_Icon;
+ SDL_Surface *OIrigation_Icon;
+ SDL_Surface *ORoad_Icon;
+} *pTheme;
+
+void tilespec_setup_theme(void);
+void tilespec_unload_theme(void);
+
+struct City_Icon {
+ int style;
+ SDL_Surface *pBIG_Food_Corr;
+ SDL_Surface *pBIG_Shield_Corr;
+ SDL_Surface *pBIG_Trade_Corr;
+ SDL_Surface *pBIG_Food;
+ SDL_Surface *pBIG_Shield;
+ SDL_Surface *pBIG_Trade;
+ SDL_Surface *pBIG_Luxury;
+ SDL_Surface *pBIG_Coin;
+ SDL_Surface *pBIG_Colb;
+ /*SDL_Surface *pBIG_Face;*/
+ SDL_Surface *pBIG_Coin_Corr;
+ SDL_Surface *pBIG_Coin_UpKeep;
+
+ SDL_Surface *pFood;
+ SDL_Surface *pShield;
+ SDL_Surface *pTrade;
+ SDL_Surface *pLuxury;
+ SDL_Surface *pCoin;
+ SDL_Surface *pColb;
+ SDL_Surface *pFace;
+ /*SDL_Surface *pDark_Face;*/
+
+ SDL_Surface *pPollution;
+ SDL_Surface *pPolice;
+
+ /* Small Citizens */
+ SDL_Surface *pMale_Happy;
+ SDL_Surface *pFemale_Happy;
+ SDL_Surface *pMale_Content;
+ SDL_Surface *pFemale_Content;
+ SDL_Surface *pMale_Unhappy;
+ SDL_Surface *pFemale_Unhappy;
+ SDL_Surface *pMale_Angry;
+ SDL_Surface *pFemale_Angry;
+
+ SDL_Surface *pSpec_Lux; /* Elvis */
+ SDL_Surface *pSpec_Tax; /* TaxMan */
+ SDL_Surface *pSpec_Sci; /* Scientist */
+
+} *pIcons;
+
+void tilespec_setup_city_icons(void);
+void reload_citizens_icons( int style );
+
+#endif /* FC__GUI_TILESPEC_H */
diff -u -r fc2/client/gui-sdl/mapctrl.c fc/client/gui-sdl/mapctrl.c
--- fc2/client/gui-sdl/mapctrl.c Mon Dec 2 09:47:03 2002
+++ fc/client/gui-sdl/mapctrl.c Thu Dec 5 17:37:14 2002
@@ -44,6 +44,7 @@
#include "gui_id.h"
#include "gui_zoom.h"
#include "gui_main.h"
+#include "gui_tilespec.h"
#include "chatline.h"
#include "citydlg.h"
diff -u -r fc2/client/gui-sdl/mapview.c fc/client/gui-sdl/mapview.c
--- fc2/client/gui-sdl/mapview.c Mon Dec 2 09:47:03 2002
+++ fc/client/gui-sdl/mapview.c Thu Dec 5 22:04:30 2002
@@ -60,6 +60,7 @@
#include "gui_id.h"
#include "gui_zoom.h"
#include "gui_main.h"
+#include "gui_tilespec.h"
#include "menu.h"
#include "mapctrl.h"
@@ -125,6 +126,21 @@
} while(0)
/**************************************************************************
+ This function can be used by mapview_common code to determine the
+ location and dimensions of the mapview canvas.
+**************************************************************************/
+void get_mapview_dimensions(int *map_view_topleft_map_x,
+ int *map_view_topleft_map_y,
+ int *map_view_pixel_width,
+ int *map_view_pixel_height)
+{
+ *map_view_topleft_map_x = map_view_x0;
+ *map_view_topleft_map_y = map_view_y0;
+ *map_view_pixel_width = Main.screen->w;
+ *map_view_pixel_height = Main.screen->h;
+}
+
+/**************************************************************************
normalize_map_pos + (y) corrections. This function must go!
**************************************************************************/
int correction_map_pos(int *pCol, int *pRow)
@@ -259,42 +275,9 @@
}
}
-/**************************************************************************
- ...
-**************************************************************************/
-void get_center_tile_mapcanvas(int *pCol, int *pRow)
-{
- get_mcell_cr(Main.screen->w / 2, Main.screen->h / 2, pCol, pRow);
-}
-
/* ===================================================================== */
/**************************************************************************
- Find if (col, row) tile is seen on screen
-**************************************************************************/
-bool tile_visible_mapcanvas(int col, int row)
-{
- int dummy_x, dummy_y; /* well, it needs two pointers... */
- return get_mcell_xy(col, row, &dummy_x, &dummy_y);
-}
-
-/**************************************************************************
- This function has moved.
-**************************************************************************/
-bool tile_visible_and_not_on_border_mapcanvas(int col, int row)
-{
-
- int cell_x, cell_y;
-
- get_mcell_xy(col, row, &cell_x, &cell_y);
-
- return cell_x > NORMAL_TILE_WIDTH / 2
- && cell_x < Main.screen->w - 3 * NORMAL_TILE_WIDTH / 2
- && cell_y >= NORMAL_TILE_HEIGHT
- && cell_y < Main.screen->h - 3 * NORMAL_TILE_HEIGHT / 2;
-}
-
-/**************************************************************************
Typically an info box is provided to tell the player about the state
of their civilization. This function is called when the label is
changed.
@@ -598,135 +581,112 @@
}
/**************************************************************************
- Draw a description for the given city. (canvas_x, canvas_y) is the
- canvas position of the city itself.
+ Draw a description for the given city onto the surface.
**************************************************************************/
-static void show_desc_at_tile(SDL_Surface * pDest, Sint16 sx, Sint16 sy,
- Uint16 col, Uint16 row)
+static void put_city_desc_on_surface(SDL_Surface *pDest,
+ struct city *pcity,
+ int canvas_x, int canvas_y)
{
static char buffer[512];
- struct city *pCity;
SDL_Surface *pBuf = NULL;
- int togrow, y_offset = sy;
+ int togrow;
SDL_String16 *pText = NULL;
- if ((pCity = map_get_city(col, row))) {
- pText = create_string16(NULL, 12);
- pText->style |= TTF_STYLE_BOLD;
- pText->forecol.r = 255;
- pText->forecol.g = 255;
- pText->forecol.b = 255;
+ pText = create_string16(NULL, 12);
+ pText->style |= TTF_STYLE_BOLD;
+ pText->forecol.r = 255;
+ pText->forecol.g = 255;
+ pText->forecol.b = 255;
+
+ canvas_y += NORMAL_TILE_HEIGHT;
- if (draw_city_names) {
- togrow = city_turns_to_grow(pCity);
+ if (draw_city_names) {
+ if (draw_city_growth && pcity->owner == game.player_idx) {
+ togrow = city_turns_to_grow(pcity);
switch (togrow) {
case 0:
- my_snprintf(buffer, sizeof(buffer), "%s: #", pCity->name);
+ my_snprintf(buffer, sizeof(buffer), "%s: #", pcity->name);
break;
case FC_INFINITY:
- my_snprintf(buffer, sizeof(buffer), "%s: --", pCity->name);
+ my_snprintf(buffer, sizeof(buffer), "%s: --", pcity->name);
break;
default:
- my_snprintf(buffer, sizeof(buffer), "%s: %d", pCity->name, togrow);
+ my_snprintf(buffer, sizeof(buffer), "%s: %d", pcity->name, togrow);
break;
}
+ } else {
+ /* Force certain behavior below. */
+ togrow = 0;
+ my_snprintf(buffer, sizeof(buffer), "%s", pcity->name);
+ }
- if (togrow < 0) {
- pText->forecol.g = 0;
- pText->forecol.b = 0;
- }
-
- pText->text = convert_to_utf16(buffer);
- pBuf = create_text_surf_from_str16(pText);
+ if (togrow < 0) {
+ pText->forecol.g = 0;
+ pText->forecol.b = 0;
+ }
- if (togrow < 0) {
- pText->forecol.g = 255;
- pText->forecol.b = 255;
- }
+ pText->text = convert_to_utf16(buffer);
+ pBuf = create_text_surf_from_str16(pText);
- y_offset += NORMAL_TILE_HEIGHT - pBuf->h / 2;
- blit_entire_src(pBuf, pDest,
- sx + (NORMAL_TILE_WIDTH - pBuf->w) / 2, y_offset);
+ if (togrow < 0) {
+ pText->forecol.g = 255;
+ pText->forecol.b = 255;
+ }
- y_offset += pBuf->h;
- FREESURFACE(pBuf);
+ blit_entire_src(pBuf, pDest,
+ canvas_x + (NORMAL_TILE_WIDTH - pBuf->w) / 2,
+ canvas_y);
- }
+ canvas_y += pBuf->h;
+ FREESURFACE(pBuf);
+
+ }
- /* City Production */
- if (draw_city_productions && (pCity->owner == game.player_idx)) {
- /*pText->style &= ~TTF_STYLE_BOLD; */
- change_ptsize16(pText, 10);
+ /* City Production */
+ if (draw_city_productions && pcity->owner == game.player_idx) {
+ /*pText->style &= ~TTF_STYLE_BOLD; */
+ change_ptsize16(pText, 10);
- /* set text color */
- if (pCity->is_building_unit) {
+ /* set text color */
+ if (pcity->is_building_unit) {
+ pText->forecol.r = 255;
+ pText->forecol.g = 255;
+ pText->forecol.b = 0;
+ } else {
+ if (get_improvement_type(pcity->currently_building)->is_wonder) {
+ pText->forecol.r = 0xe2;
+ pText->forecol.g = 0xc2;
+ pText->forecol.b = 0x1f;
+ } else {
pText->forecol.r = 255;
pText->forecol.g = 255;
- pText->forecol.b = 0;
- } else {
- if (get_improvement_type(pCity->currently_building)->is_wonder) {
- pText->forecol.r = 0xe2;
- pText->forecol.g = 0xc2;
- pText->forecol.b = 0x1f;
- } else {
- pText->forecol.r = 255;
- pText->forecol.g = 255;
- pText->forecol.b = 255;
- }
+ pText->forecol.b = 255;
}
+ }
- get_city_mapview_production(pCity, buffer, sizeof(buffer));
-
- FREE(pText->text);
- pText->text = convert_to_utf16(buffer);
- pBuf = create_text_surf_from_str16(pText);
-
- if (y_offset == sy) {
- y_offset += NORMAL_TILE_HEIGHT - pBuf->h / 2;
- } else {
- y_offset -= 3;
- }
+ get_city_mapview_production(pcity, buffer, sizeof(buffer));
- blit_entire_src(pBuf, pDest,
- sx + (NORMAL_TILE_WIDTH - pBuf->w) / 2, y_offset);
+ FREE(pText->text);
+ pText->text = convert_to_utf16(buffer);
+ pBuf = create_text_surf_from_str16(pText);
- FREESURFACE(pBuf);
- }
+ blit_entire_src(pBuf, pDest,
+ canvas_x + (NORMAL_TILE_WIDTH - pBuf->w) / 2,
+ canvas_y);
- FREESTRING16(pText);
+ FREESURFACE(pBuf);
}
+
+ FREESTRING16(pText);
}
/**************************************************************************
- This function has moved.
+ Draw a description for the given city. (canvas_x, canvas_y) is the
+ canvas position of the city itself.
**************************************************************************/
-static void show_city_descriptions(void)
+void show_city_desc(struct city *pcity, int canvas_x, int canvas_y)
{
- int map_row = map_view_row0;
- int map_col = map_view_col0;
- Uint16 col, row;
- int Sx, Sy;
-
- if (!draw_city_names && !draw_city_productions) {
- return;
- }
-
- for (col = 0; col < map_view_rectsize; col++) {
- for (row = 0; row < map_view_rectsize; row++) {
-
- if (real_get_mcell_xy(Main.screen, map_view_x0,
- map_view_y0, col, row, &Sx, &Sy)) {
-
- show_desc_at_tile(Main.screen, Sx, Sy, map_col, map_row);
-
- }
-
- Inc_Row(map_row);
- }
-
- map_row = map_view_row0;
- Inc_Col(map_col);
- }
+ put_city_desc_on_surface(Main.screen, pcity, canvas_x, canvas_y);
}
/**************************************************************************
@@ -841,9 +801,6 @@
if (pMMap) {
del_widget_from_gui_list(pMMap);
}
-
- /* load city resource gfx ( should be ported to specfile code ) */
- load_city_icons();
}
/**************************************************************************
@@ -1135,7 +1092,7 @@
add_refresh_rect(pMMap->size);
- } else { /* map hiden */
+ } else {/* map hiden */
map_area.x = FRAME_WH;
@@ -1561,9 +1518,6 @@
}
}
-/*
- *
- */
/**************************************************************************
This function draw 3x3 map cells rect to 'pTmpSurface33' surface.
To Main.screen is only blit (col0,row0) center tile from 'pTmpSurface33'
@@ -1608,6 +1562,7 @@
(pTmpSurface33->w - NORMAL_TILE_WIDTH) / 2, 0,
col0, row0, 3, 3, 0);
+#if 0
/* redraw city names and productions */
if (draw_city_names || draw_city_productions) {
int real_col = col0;
@@ -1631,6 +1586,7 @@
Inc_Col(real_col);
}
}
+#endif
/* set blit area in Main.screen */
dest.x = sx;
@@ -1858,23 +1814,6 @@
}
}
-/*
- */
-/**************************************************************************
- Rerfesh ALL.
-
- The hack is after all packets have been read call
- 'update_map_canvas_visible'. The functions track which areas of the
- screen need updating and refresh them all at one.
-
- Problem is "the redraw of the city descriptions bug" is back :(
-**************************************************************************/
-void update_map_canvas_visible(void)
-{
- freelog(LOG_DEBUG, "MAPVIEW: update_map_canvas_visible");
- refresh_rects();
-}
-
/**************************************************************************
Update (refresh) the locations of the mapview scrollbars (if it uses
them).
@@ -2131,11 +2070,13 @@
}
/**************************************************************************
- ...
+ This function is called when the tileset is changed.
**************************************************************************/
-void undraw_segment(int src_x, int src_y, int dir)
+void tileset_changed(void)
{
- freelog(LOG_DEBUG, "MAPVIEW: undraw_segment : PORT ME");
+ /* PORTME */
+ /* Here you should do any necessary redraws (for instance, the city
+ * dialogs usually need to be resized). */
}
/* =====================================================================
diff -u -r fc2/client/gui-sdl/menu.c fc/client/gui-sdl/menu.c
--- fc2/client/gui-sdl/menu.c Mon Dec 2 09:47:03 2002
+++ fc/client/gui-sdl/menu.c Thu Dec 5 17:36:19 2002
@@ -52,10 +52,10 @@
#include "graphics.h"
#include "gui_string.h"
#include "gui_stuff.h" /* gui */
-
#include "gui_id.h"
-
+#include "gui_tilespec.h"
#include "gui_main.h"
+
#include "helpdlg.h"
#include "mapctrl.h" /* center_on_unit */
#include "messagedlg.h"
diff -u -r fc2/client/gui-sdl/optiondlg.c fc/client/gui-sdl/optiondlg.c
--- fc2/client/gui-sdl/optiondlg.c Mon Dec 2 09:47:03 2002
+++ fc/client/gui-sdl/optiondlg.c Thu Dec 5 21:29:27 2002
@@ -42,7 +42,7 @@
#include "gui_id.h"
#include "gui_stuff.h"
#include "gui_zoom.h"
-
+#include "gui_tilespec.h"
#include "gui_main.h"
#include "civclient.h"
diff -u -r fc2/client/gui-sdl/repodlgs.c fc/client/gui-sdl/repodlgs.c
--- fc2/client/gui-sdl/repodlgs.c Mon Dec 2 09:47:03 2002
+++ fc/client/gui-sdl/repodlgs.c Wed Dec 4 16:35:33 2002
@@ -54,7 +54,8 @@
#include "gui_stuff.h"
#include "helpdlg.h"
#include "optiondlg.h"
-#include "citydlg.h"
+/* #include "citydlg.h" */
+#include "gui_tilespec.h"
#include "repodlgs_common.h"
#include "repodlgs.h"
@@ -136,7 +137,7 @@
char cBuf[120];
SDL_String16 *pStr;
int cost = total_bulbs_required(game.player_ptr);
- SDL_Surface *pSurf, *pColb_Surface = get_colb_surface();
+ SDL_Surface *pSurf, *pColb_Surface = pIcons->pBIG_Colb;
int step, i;
SDL_Rect dest, src;
SDL_Color color = *get_game_colorRGB(COLOR_STD_WHITE);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#2497) compile fixes + GUITheme/City Icons load by Specfiles,
Rafa³ Bursig via RT <=
|
|