[Freeciv-Dev] (PR#7440) don't hard-code standard and oil mines
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] (PR#7440) don't hard-code standard and oil mines |
From: |
"Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx> |
Date: |
Wed, 18 Feb 2004 18:19:40 -0800 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=7440 >
Currently oil mines are drawn on desert and arctic, while "regular"
mines are drawn on hills and mountains. This is hard-coded in tilespec.c.
With this simple patch, the sprite to use for a mine is put into the
tileset terrain data.
jason
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.140
diff -u -r1.140 tilespec.c
--- client/tilespec.c 2004/02/19 00:47:15 1.140
+++ client/tilespec.c 2004/02/19 02:17:12
@@ -695,6 +695,8 @@
terrains[i]);
terr->match_type = secfile_lookup_int(file, "%s.match_type",
terrains[i]);
+ terr->mine_tag = secfile_lookup_str_default(file, "-", "%s.mine_sprite",
+ terrains[i]);
if (terr->is_layered && terr->match_type == 0) {
freelog(LOG_FATAL, "%s is layered but has no matching type set.",
@@ -1007,8 +1009,6 @@
SET_SPRITE(user.attention, "user.attention");
SET_SPRITE(tx.fallout, "tx.fallout");
- SET_SPRITE(tx.mine, "tx.mine");
- SET_SPRITE_ALT(tx.oil_mine, "tx.oil_mine", "tx.mine");
SET_SPRITE(tx.pollution, "tx.pollution");
SET_SPRITE(tx.village, "tx.village");
SET_SPRITE(tx.fortress, "tx.fortress");
@@ -1222,6 +1222,10 @@
/* should probably do something if NULL, eg generic default? */
}
+ if (draw->mine_tag) {
+ draw->mine = load_sprite(draw->mine_tag);
+ }
+
sprites.terrain[terrain] = draw;
}
@@ -2016,19 +2020,10 @@
if (contains_special(tspecial, S_FORTRESS) && draw_fortress_airbase) {
ADD_SPRITE_SIMPLE(sprites.tx.fortress_back);
- }
-
- if (contains_special(tspecial, S_MINE) && draw_mines
- && (ttype == T_HILLS || ttype == T_MOUNTAINS)) {
- /* Oil mines come later. */
- ADD_SPRITE_SIMPLE(sprites.tx.mine);
}
-
- if (contains_special(tspecial, S_MINE) && draw_mines
- && ttype != T_HILLS && ttype != T_MOUNTAINS) {
- /* Must be Glacier or Dessert. The mine sprite looks better on top
- * of special. */
- ADD_SPRITE_SIMPLE(sprites.tx.oil_mine);
+
+ if (draw_mines && contains_special(tspecial, S_MINE)) {
+ ADD_SPRITE_SIMPLE(sprites.terrain[ttype]->mine);
}
if (contains_special(tspecial, S_HUT) && draw_specials) {
@@ -2206,11 +2201,8 @@
ADD_SPRITE_SIMPLE(sprites.terrain[ttype]->special[1]);
}
- if(contains_special(tspecial, S_MINE) && draw_mines) {
- if(ttype==T_HILLS || ttype==T_MOUNTAINS)
- ADD_SPRITE_SIMPLE(sprites.tx.mine);
- else /* desert */
- ADD_SPRITE_SIMPLE(sprites.tx.oil_mine);
+ if (draw_mines && contains_special(tspecial, S_MINE)) {
+ ADD_SPRITE_SIMPLE(sprites.terrain[ttype]->mine);
}
if(contains_special(tspecial, S_HUT) && draw_specials) {
Index: client/tilespec.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.h,v
retrieving revision 1.52
diff -u -r1.52 tilespec.h
--- client/tilespec.h 2004/02/19 00:47:15 1.52
+++ client/tilespec.h 2004/02/19 02:17:12
@@ -97,6 +97,7 @@
struct terrain_drawing_data {
char *name;
+ char *mine_tag;
bool is_blended;
bool is_layered;
@@ -105,6 +106,7 @@
struct Sprite *base;
struct Sprite *blend[NUM_DIRECTION_NSEW];
struct Sprite *special[2];
+ struct Sprite *mine;
};
struct named_sprites {
@@ -200,8 +202,6 @@
struct Sprite
*farmland[NUM_DIRECTION_NSEW],
*irrigation[NUM_DIRECTION_NSEW],
- *mine,
- *oil_mine,
*pollution,
*village,
*fortress,
Index: data/isotrident.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/isotrident.tilespec,v
retrieving revision 1.9
diff -u -r1.9 isotrident.tilespec
--- data/isotrident.tilespec 2004/02/17 04:52:59 1.9
+++ data/isotrident.tilespec 2004/02/19 02:17:12
@@ -61,11 +61,13 @@
is_blended = 1
is_layered = 0
match_type = 0
+mine_sprite = "tx.oil_mine"
[terrain_desert]
is_blended = 1
is_layered = 0
match_type = 0
+mine_sprite = "tx.oil_mine"
[terrain_forest]
is_blended = 1
@@ -81,6 +83,7 @@
is_blended = 1
is_layered = 1
match_type = 2
+mine_sprite = "tx.mine"
[terrain_jungle]
is_blended = 0
@@ -91,6 +94,7 @@
is_blended = 1
is_layered = 1
match_type = 3
+mine_sprite = "tx.mine"
; ocean has special handling
[terrain_ocean]
Index: data/trident.tilespec
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/trident.tilespec,v
retrieving revision 1.16
diff -u -r1.16 trident.tilespec
--- data/trident.tilespec 2004/02/17 04:52:59 1.16
+++ data/trident.tilespec 2004/02/19 02:17:12
@@ -59,11 +59,13 @@
is_blended = 0
is_layered = 0
match_type = 1
+mine_sprite = "tx.oil_mine"
[terrain_desert]
is_blended = 0
is_layered = 0
match_type = 2
+mine_sprite = "tx.oil_mine"
[terrain_forest]
is_blended = 0
@@ -79,6 +81,7 @@
is_blended = 0
is_layered = 0
match_type = 4
+mine_sprite = "tx.mine"
[terrain_jungle]
is_blended = 0
@@ -89,6 +92,7 @@
is_blended = 0
is_layered = 0
match_type = 6
+mine_sprite = "tx.mine"
; ocean has special handling
[terrain_ocean]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#7440) don't hard-code standard and oil mines,
Jason Short <=
|
|