[Tux4kids-commits] [SCM] tuxhistory - Educational history game branch, master, updated. 38aa05b6d993f0f90d22d1f8ddf503c614e0d553
JesusMager
fongog at gmail.com
Fri Jul 30 17:16:24 UTC 2010
The following commit has been merged in the master branch:
commit 38aa05b6d993f0f90d22d1f8ddf503c614e0d553
Author: JesusMager <fongog at gmail.com>
Date: Fri Jul 30 12:15:00 2010 -0500
Improving interaction
diff --git a/configure.ac b/configure.ac
index 5893c9e..f90d11e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -466,6 +466,7 @@ data/images/penguins/Makefile
data/images/status/Makefile
data/images/title/Makefile
data/images/tux/Makefile
+data/images/units/Makefile
data/images/terrain/Makefile
data/images/terrain/arctic/Makefile
data/images/terrain/desert/Makefile
diff --git a/data/images/Makefile.am b/data/images/Makefile.am
index 8bb2c99..a4ac4ac 100644
--- a/data/images/Makefile.am
+++ b/data/images/Makefile.am
@@ -9,5 +9,6 @@ SUBDIRS = backgrounds \
penguins \
status \
title \
- tux
+ tux \
+ units
diff --git a/data/images/others/Makefile.am b/data/images/others/Makefile.am
index be541ac..6742f43 100644
--- a/data/images/others/Makefile.am
+++ b/data/images/others/Makefile.am
@@ -5,4 +5,6 @@
othersdir = $(pkgdatadir)/images/others
dist_others_DATA = isomapper.png \
-select.png
+select.png \
+go.png \
+wrong.png
diff --git a/data/images/others/go.png b/data/images/others/go.png
new file mode 100644
index 0000000..e9bc97f
Binary files /dev/null and b/data/images/others/go.png differ
diff --git a/data/maps/map.xml b/data/maps/map.xml
index 6dfae11..188a7ca 100644
--- a/data/maps/map.xml
+++ b/data/maps/map.xml
@@ -194,8 +194,8 @@
<tilde>
<height>1</height>
<terrain>GRASSLAND</terrain>
- <object></object>
- <unit></unit>
+ <object>VILLAGER_MILKMAID</object>
+ <unit>VILLAGER_MILKMAID</unit>
<building></building>
</tilde>
<tilde>
diff --git a/data/objects/objects.xml b/data/objects/objects.xml
index b2770e7..09a5b04 100644
--- a/data/objects/objects.xml
+++ b/data/objects/objects.xml
@@ -36,5 +36,15 @@
<description>Cut this trees and get 300 woods</description>
<live>300</live>
</object>
+ <object>
+ <type>UNIT</type>
+ <name>VILLAGER_MILKMAID</name>
+ <rname>Vilager</rname>
+ <description>This unit can create buildings, and recolect resources.</description>
+ <live>25</live>
+ <defence>1</defence>
+ <attack>3</attack>
+ <move>1</move>
+ </object>
</data>
diff --git a/src/Makefile.am b/src/Makefile.am
index fb29a8e..5713c6a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -49,7 +49,8 @@ tuxhistory_SOURCES = tuxhistory.c \
SDL_rotozoom.c \
scandir.c \
pixels.c \
- throttle.c
+ throttle.c \
+ tuxrts.c
# HACK "TuxHistory" is the Windows program, whereas "tuxhistory" is the Unix program
@@ -77,12 +78,13 @@ EXTRA_DIST = credits.h \
players.h \
SDL_extras.h \
SDL_rotozoom.h \
- gettext.h \
- scandir.h \
- pixels.h \
- compiler.h \
+ gettext.h \
+ scandir.h \
+ pixels.h \
+ compiler.h \
transtruct.h \
- throttle.h
+ throttle.h \
+ tuxrts.h
diff --git a/src/fileops.h b/src/fileops.h
index be25dcc..709c5a1 100644
--- a/src/fileops.h
+++ b/src/fileops.h
@@ -71,6 +71,8 @@ enum {
IMG_GAMEOVER_WON,
IMG_ISOMAPPER,
IMG_ISOSELECT,
+ IMG_ISOGO,
+ IMG_ISOWRONG,
NUM_IMAGES
};
@@ -369,6 +371,7 @@ enum{
FOREST_WETLAND,
FOREST_RAIN,
FOREST_BROADLEAF,
+ VILLAGER_MILKMAID,
NUM_OBJECTS // Must be at the end.
};
diff --git a/src/fileops_media.c b/src/fileops_media.c
index 9ce0053..3fde5d4 100644
--- a/src/fileops_media.c
+++ b/src/fileops_media.c
@@ -62,7 +62,9 @@ int load_image_data()
"status/gameover.png",
"status/gameover_won.png",
"others/isomapper.png",
- "others/select.png"
+ "others/select.png",
+ "others/go.png",
+ "others/wrong.png"
};
@@ -302,7 +304,8 @@ int load_image_data()
"forest/boreal.png",
"forest/wetland.png",
"forest/rain.png",
- "forest/broadleaf.png"
+ "forest/broadleaf.png",
+ "units/milkmaid.png"
};
diff --git a/src/game.c b/src/game.c
index 9d1aff9..e059c53 100644
--- a/src/game.c
+++ b/src/game.c
@@ -71,19 +71,32 @@ static SDL_Surface* scaled_bkgd = NULL; //native resolution (fullscreen)
// Game vars
static SDL_Rect origin;
-static SDL_Rect select_rect;
-static SDL_Rect select_rect_dest;
static int screen_x;
static int screen_y;
-static th_point Pmouse;
static th_point Pscreen;
-static th_point Prclick;
-static th_point Plclick;
-static int mousedown_flag;
-static int mouseclicked_flag;
static int screen_margin_in;
static int screen_margin_out;
+
+typedef struct io_vars
+{
+ th_point Pmouse;
+ th_point Prclick;
+ th_point Plclick;
+ int mousedown_flag;
+ int mousedownr_flag;
+ int mouseclicked_flag;
+ SDL_Rect select_xy;
+ SDL_Rect select_rect;
+ SDL_Rect select_rect_dest;
+ th_point go_xy;
+ SDL_Rect go_rect;
+ SDL_Rect go_rect_dest;
+ int go_valid_flag;
+}io_vars;
+
+io_vars io;
+
/********** Static functions definitions *********/
static int game_init(void);
@@ -92,6 +105,7 @@ static void game_draw(void);
static void game_handle_user_events(void);
static void game_handle_mouse(void);
static int game_mouse_event(SDL_Event event);
+static void game_proces(void);
static int check_exit_conditions(void);
static int game_over(int);
@@ -207,6 +221,7 @@ int game(void)
game_handle_mouse();
game_status = check_exit_conditions();
+ game_proces();
game_draw();
SDL_Flip(screen);
@@ -268,9 +283,24 @@ static void game_draw(void)
obj_node = obj_node->next;
}while(obj_node != NULL);
}
+// User interaction
+ if(io.select_rect_dest.x != -1 && io.select_rect_dest.y != -1)
+ SDL_BlitSurface(images[IMG_ISOSELECT], NULL, screen, &io.select_rect_dest);
- if(select_rect_dest.x != -1 && select_rect_dest.y != -1)
- SDL_BlitSurface(images[IMG_ISOSELECT], NULL, screen, &select_rect_dest);
+ if((io.go_rect.x != -1 && io.go_rect.y != -1) &&
+ io.go_valid_flag == 1)
+ {
+ SDL_BlitSurface(images[IMG_ISOGO], NULL, screen, &io.go_rect_dest);
+ io.go_rect.x = -1;
+ io.go_rect.y = -1;
+ }
+ else if((io.go_rect.x != -1 && io.go_rect.y != -1) &&
+ !io.go_valid_flag)
+ {
+ SDL_BlitSurface(images[IMG_ISOWRONG], NULL, screen, &io.go_rect_dest);
+ io.go_rect.x = -1;
+ io.go_rect.y = -1;
+ }
/*Third layer: User Interface*/
dest.x = (screen->w - images[IMG_STOP]->w - 5);
@@ -278,13 +308,56 @@ static void game_draw(void)
SDL_BlitSurface(images[IMG_STOP], NULL, screen, &dest);
}
+static void game_proces(void)
+{
+ // TODO: Need to proces per player
+ int i, j;
+ //io.go_xy.x = 0;
+ //io.go_xy.y = 0;
+ if( io.go_rect.x != -1 &&
+ io.go_rect.y != -1 )
+ {
+ if( io.go_rect_dest.x != -1 &&
+ io.go_rect_dest.y != -1 )
+ {
+ if(gmaps[0][io.go_xy.x][io.go_xy.y].terrain == OCEAN)
+ {
+ io.go_valid_flag = 0;
+ }
+ else if(gmaps[0][io.go_xy.x][io.go_xy.y].terrain == HIGHSEA)
+ {
+ io.go_valid_flag = 0;
+ }
+ else if(gmaps[0][io.go_xy.x][io.go_xy.y].object != NULL)
+ {
+ if( gmaps[0][io.go_xy.x][io.go_xy.y].object->type == FOREST ||
+ gmaps[0][io.go_xy.x][io.go_xy.y].object->type == GOLD ||
+ gmaps[0][io.go_xy.x][io.go_xy.y].object->type == STONE )
+ {
+ io.go_valid_flag = 0;
+ // From to condition... Ships may use wather,
+ // pawns may une FOREST, GOLD, AND STONE
+ }
+ else
+ {
+ io.go_valid_flag = 1;
+ }
+ }
+ else
+ {
+ io.go_valid_flag = 1;
+ }
+ }
+ }
+}
+
static void game_handle_mouse(void)
{
th_point Pmousemap;
th_point Pdtmap;
int i, j;
- Pmousemap = mouse_map(Pmouse, Pscreen);
+ Pmousemap = mouse_map(io.Pmouse, Pscreen);
Pdtmap = Pscreen;
if(Pmousemap.x != -1 && Pmousemap.y != -1)
{
@@ -296,65 +369,95 @@ static void game_handle_mouse(void)
{
// Is the mouse close to the border? Move the
// map...
- if(Pmouse.x < screen_margin_in && Pscreen.x > IN_SCROLL){
+ if(io.Pmouse.x < screen_margin_in && Pscreen.x > IN_SCROLL){
Pscreen.x = Pscreen.x - IN_SCROLL;
}
- if(Pmouse.x > screen->w - screen_margin_in &&
+ if(io.Pmouse.x > screen->w - screen_margin_in &&
(Pscreen.x + screen->w) < (map_image->w - IN_SCROLL)){
Pscreen.x = Pscreen.x + IN_SCROLL;
}
- if(Pmouse.y < screen_margin_in && Pscreen.y > IN_SCROLL){
+ if(io.Pmouse.y < screen_margin_in && Pscreen.y > IN_SCROLL){
Pscreen.y = Pscreen.y - IN_SCROLL;
}
- if(Pmouse.y > screen->h - screen_margin_in &&
+ if(io.Pmouse.y > screen->h - screen_margin_in &&
(Pscreen.y + screen->h) < (map_image->h - IN_SCROLL)){
Pscreen.y = Pscreen.y + IN_SCROLL;
}
// Is the mouse VERY close to the border?
// Move the map faster!
- if(Pmouse.x < screen_margin_out && Pscreen.x > OUT_SCROLL){
+ if(io.Pmouse.x < screen_margin_out && Pscreen.x > OUT_SCROLL){
Pscreen.x = Pscreen.x - OUT_SCROLL;
}
- if(Pmouse.x > screen->w - screen_margin_out &&
+ if(io.Pmouse.x > screen->w - screen_margin_out &&
(Pscreen.x + screen->w) < (map_image->w - OUT_SCROLL)){
Pscreen.x = Pscreen.x + OUT_SCROLL;
}
- if(Pmouse.y < screen_margin_out && Pscreen.y > OUT_SCROLL){
+ if(io.Pmouse.y < screen_margin_out && Pscreen.y > OUT_SCROLL){
Pscreen.y = Pscreen.y - OUT_SCROLL;
}
- if(Pmouse.y > screen->h - screen_margin_out &&
+ if(io.Pmouse.y > screen->h - screen_margin_out &&
(Pscreen.y + screen->h) < (map_image->h - OUT_SCROLL)){
Pscreen.y = Pscreen.y + OUT_SCROLL;
}
}
- if( select_rect.x > Pscreen.x &&
- select_rect.x < Pscreen.x + screen->w &&
- select_rect.y > Pscreen.y &&
- select_rect.y < Pscreen.y + screen->h)
+ if( io.select_rect.x > Pscreen.x &&
+ io.select_rect.x < Pscreen.x + screen->w &&
+ io.select_rect.y > Pscreen.y &&
+ io.select_rect.y < Pscreen.y + screen->h)
{
- select_rect_dest.x = select_rect.x - Pscreen.x;
- select_rect_dest.y = select_rect.y - Pscreen.y;
- printf("ScreenP: %d, %d Select: %d, %d \n", Pscreen.x, Pscreen.y, select_rect.x, select_rect.y);
+ io.select_rect_dest.x = io.select_rect.x - Pscreen.x;
+ io.select_rect_dest.y = io.select_rect.y - Pscreen.y;
}
else
{
- select_rect_dest.x = -1;
- select_rect_dest.y = -1;
+ io.select_rect_dest.x = -1;
+ io.select_rect_dest.y = -1;
+ }
+ }
+ if(io.mousedown_flag != 0)
+ {
+ if(io.mouseclicked_flag != 0)
+ {
+ Pmousemap = mouse_map(io.Plclick, Pscreen);
+ io.mousedown_flag = 0;
+ io.select_rect.x = gmaps[0][Pmousemap.x][Pmousemap.y].rect.x;
+ io.select_rect.y = gmaps[0][Pmousemap.x][Pmousemap.y].rect.y;
+ io.select_xy.x = Pmousemap.x;
+ io.select_xy.y = Pmousemap.y;
+ printf("Draw select: %d %d \n", io.select_rect.x, io.select_rect.y);
}
}
- if(mousedown_flag != 0)
+ if(io.mousedownr_flag != 0)
{
- if(mouseclicked_flag != 0)
+ Pmousemap = mouse_map(io.Prclick, Pscreen);
+ io.go_rect.x = gmaps[0][Pmousemap.x][Pmousemap.y].rect.x;
+ io.go_rect.y = gmaps[0][Pmousemap.x][Pmousemap.y].rect.y;
+ printf("Go select: %d %d \n", io.go_rect.x, io.go_rect.y);
+ io.mousedownr_flag = 0;
+ if( io.go_rect.x > Pscreen.x &&
+ io.go_rect.x < Pscreen.x + screen->w &&
+ io.go_rect.y > Pscreen.y &&
+ io.go_rect.y < Pscreen.y + screen->h)
+ {
+ io.go_rect_dest.x = io.go_rect.x - Pscreen.x;
+ io.go_rect_dest.y = io.go_rect.y - Pscreen.y;
+ io.go_xy.x = Pmousemap.x;
+ io.go_xy.y = Pmousemap.y;
+ printf("ScreenP: %d, %d go: %d, %d \n", Pscreen.x, Pscreen.y, io.go_rect.x, io.go_rect.y);
+ }
+ else
{
- Pmousemap = mouse_map(Prclick, Pscreen);
- mousedown_flag = 0;
- select_rect.x = gmaps[0][Pmousemap.x][Pmousemap.y].rect.x;
- select_rect.y = gmaps[0][Pmousemap.x][Pmousemap.y].rect.y;
- printf("Draw select: %d %d ", select_rect.x, select_rect.y);
+ io.go_rect_dest.x = -1;
+ io.go_rect_dest.y = -1;
}
}
+ else
+ {
+ io.go_rect.x = -1;
+ io.go_rect.y = -1;
+ }
}
static int pause_game(void)
@@ -548,23 +651,24 @@ static void game_handle_user_events(void)
}
if (event.type == SDL_MOUSEMOTION)
{
- Pmouse.x = event.button.x;
- Pmouse.y = event.button.y;
+ io.Pmouse.x = event.button.x;
+ io.Pmouse.y = event.button.y;
}
if (event.type == SDL_MOUSEBUTTONDOWN)
{
if(event.button.button == SDL_BUTTON_LEFT)
{
- Plclick.x = event.button.x;
- Plclick.y = event.button.y;
- mousedown_flag = 1;
- mouseclicked_flag = 1;
+ io.Plclick.x = event.button.x;
+ io.Plclick.y = event.button.y;
+ io.mousedown_flag = 1;
+ io.mouseclicked_flag = 1;
}
- if(event.button.button == SDL_BUTTON_LEFT)
+ if(event.button.button == SDL_BUTTON_RIGHT)
{
- Prclick.x = event.button.x;
- Prclick.y = event.button.y;
+ io.mousedownr_flag = 1;
+ io.Prclick.x = event.button.x;
+ io.Prclick.y = event.button.y;
}
key = game_mouse_event(event);
@@ -573,7 +677,7 @@ static void game_handle_user_events(void)
{
if(event.button.button == SDL_BUTTON_LEFT)
{
- mousedown_flag = 0;
+ io.mousedown_flag = 0;
}
}
diff --git a/src/graphs.c b/src/graphs.c
index 42bdfd7..599b321 100644
--- a/src/graphs.c
+++ b/src/graphs.c
@@ -80,6 +80,7 @@ int create_gmaps(int players)
{
count++;
gmaps[i][j][k].visible = 1;
+ gmaps[i][j][k].terrain = map[j][k].terrain;
for(l = 0; l < NUM_DIRS; l++)
{
point.x = j;
diff --git a/src/graphs.h b/src/graphs.h
index e47acc6..1185190 100644
--- a/src/graphs.h
+++ b/src/graphs.h
@@ -15,6 +15,7 @@
#define GRAPHS_H
#include "SDL.h"
+#include "tuxhistory.h"
#include "globals.h"
#include "objects.h"
#include "map.h"
diff --git a/src/llist.c b/src/llist.c
index 0b49aa3..8e66e03 100644
--- a/src/llist.c
+++ b/src/llist.c
@@ -74,7 +74,7 @@ void list_print(list_node *node)
}
while (node != NULL)
{
- printf("print %p %p %s\n", node, node->next, node->obj.name);
+ printf("in List objecin List object: %p %p %s\n", node, node->next, node->obj.name);
node = node->next;
}
}
diff --git a/src/map.c b/src/map.c
index 6b8e5fa..86b96c5 100644
--- a/src/map.c
+++ b/src/map.c
@@ -137,7 +137,6 @@ int map_xml(FILE *fp)
printf("Error: field not found...");
//return 0;
}
- //printf("%d",node->child->value.integer);
if(node->child->value.integer >= 0)
{
@@ -163,8 +162,6 @@ int map_xml(FILE *fp)
tmp_obj.y = y;
list_add(&list_nodes, tmp_obj);
- //map[i][j].obj_id = object_counter;
-
object_counter++;
}
else
@@ -698,8 +695,8 @@ int generate_map(void)
anchor.y = dest.y + terrain[*img_enums]->h/2;
- printf(" Tile dest in px: (%d,%d) from: (%d,%d) with anchori (%d,%d)\n",
- dest.x, dest.y, i, j, anchor.x, anchor.y);
+ //printf(" Tile dest in px: (%d,%d) from: (%d,%d) with anchori (%d,%d)\n",
+ // dest.x, dest.y, i, j, anchor.x, anchor.y);
gmaps[0][i][j].anchor = anchor;
gmaps[0][i][j].rect.x = dest.x;
diff --git a/src/objects.c b/src/objects.c
index 14dbcd6..1cdc1ca 100644
--- a/src/objects.c
+++ b/src/objects.c
@@ -24,6 +24,7 @@ static int init_obj_hash(void)
hashtable_add(obj_table_hash, "FOREST_BOREAL", FOREST_BOREAL);
hashtable_add(obj_table_hash, "FOREST_WETLAND", FOREST_WETLAND);
hashtable_add(obj_table_hash, "FOREST_RAIN", FOREST_RAIN);
+ hashtable_add(obj_table_hash, "VILLAGER_MILKMAID", VILLAGER_MILKMAID);
hashtable_add(obj_table_hash, "FOREST", FOREST);
hashtable_add(obj_table_hash, "GOLD", GOLD);
@@ -141,14 +142,78 @@ int objects_xml(FILE *fp)
return 1;
}
+ if(object[i].type != FOREST ||
+ object[i].type != GOLD ||
+ object[i].type != STONE)
+ {
+ node = mxmlFindElement(inode, inode, "defence",
+ NULL, NULL, MXML_DESCEND);
+
+ if(node != NULL)
+ {
+ if(atoi(node->child->value.opaque) >= 0)
+ {
+ object[i].defence = atoi(node->child->value.opaque);
+ }
+ else
+ {
+ object[i].defence = -1;
+ printf("objects_xml: Error loading objects description file.\n");
+ return 1;
+ }
+ }
+
+ node = mxmlFindElement(inode, inode, "attack",
+ NULL, NULL, MXML_DESCEND);
+
+ if(node != NULL)
+ {
+ if(atoi(node->child->value.opaque) >= 0)
+ {
+ object[i].attack = atoi(node->child->value.opaque);
+ }
+ else
+ {
+ object[i].attack = -1;
+ printf("objects_xml: Error loading objects description file.\n");
+ return 1;
+ }
+ }
+
+ node = mxmlFindElement(inode, inode, "move",
+ NULL, NULL, MXML_DESCEND);
+
+ if(node != NULL)
+ {
+ if(atoi(node->child->value.opaque) >= 0)
+ {
+ object[i].move = atoi(node->child->value.opaque);
+ }
+ else
+ {
+ object[i].move = -1;
+ printf("objects_xml: Error loading objects description file.\n");
+ return 1;
+ }
+ }
+ }
+ else
+ {
+ object[i].defence = -1;
+ object[i].attack = -1;
+ object[i].move = -1;
+ }
/* Debug: print the values of current object */
- printf("%d %s:%d(%s) %s lives: %d\n",
+ printf("%d %s:%d(%s) %s lives: %d, def: %d, att: %d, mov: %d\n",
object[i].type,
object[i].name,
object[i].name_enum,
object[i].rname,
object[i].description,
- object[i].live);
+ object[i].live,
+ object[i].defence,
+ object[i].attack,
+ object[i].move);
/* End of debug */
hashtable_add(objects_hash, object[i].name, &object[i]);
diff --git a/src/options.c b/src/options.c
index 56ab43c..1957019 100644
--- a/src/options.c
+++ b/src/options.c
@@ -114,7 +114,7 @@ int Opts_Initialize(void)
global_options->iopts[USE_SOUND] = DEFAULT_USE_SOUND;
global_options->iopts[MENU_SOUND] = DEFAULT_MENU_SOUND;
global_options->iopts[MENU_MUSIC] = DEFAULT_MENU_MUSIC;
- global_options->iopts[FULLSCREEN] = DEFAULT_FULLSCREEN;
+ global_options->iopts[FULLSCREEN] = 0;
global_options->iopts[USE_KEYPAD] = DEFAULT_USE_KEYPAD;
global_options->iopts[USE_IGLOOS] = DEFAULT_USE_IGLOOS;
strncpy(game_options->current_font_name, DEFAULT_FONT_NAME,
diff --git a/src/setup.c b/src/setup.c
index b11054d..62fca35 100644
--- a/src/setup.c
+++ b/src/setup.c
@@ -315,7 +315,8 @@ void handle_command_args(int argc, char* argv[])
else if (strcmp(argv[i], "--fullscreen") == 0 ||
strcmp(argv[i], "-f") == 0)
{
- Opts_SetGlobalOpt(FULLSCREEN, 1);
+ printf("Fullscreen is not now supported...");
+ Opts_SetGlobalOpt(FULLSCREEN, 0);
}
else if (strcmp(argv[i], "--windowed") == 0 ||
strcmp(argv[i], "-w") == 0)
diff --git a/src/tuxrts.c b/src/tuxrts.c
index 4ed971d..9b4faf1 100644
--- a/src/tuxrts.c
+++ b/src/tuxrts.c
@@ -1,7 +1,11 @@
#include "tuxrts.h"
+#include "tuxhistory.h"
#include "loaders.h"
+#include "maps.h"
+#include "players.h"
#include "graphs.h"
-
+#include "llist.h"
+/*
int tuxrts_init(char *map_name, th_players *players)
{
@@ -29,4 +33,47 @@ int tuxrts_init(char *map_name, th_players *players)
generate_map();
return 0;
}
+*/
+// Returns 1 if the tile is valid to use for a player, and unit
+// and 0 if not.
+static int rts_valid_tile(int player, int unit, th_point coords)
+{
+ list_node *unit_p;
+ if(coords.x < 0 || coords.x > x_tildes)
+ return 0;
+ if(coords.y < 0 || coords.y > y_tildes)
+ return 0;
+ if(player < 0 || player > num_of_players)
+ return 0;
+
+ unit_p = list_search(list_nodes, unit);
+
+ if(gmaps[player][coords.x][coords.y].terrain == OCEAN)
+ {
+ return 0;
+ }
+ else if(gmaps[player][coords.x][coords.y].terrain == HIGHSEA)
+ {
+ return 0;
+ }
+ else if(gmaps[player][coords.x][coords.y].object != NULL)
+ {
+ if( gmaps[player][coords.x][coords.y].object->type == FOREST ||
+ gmaps[player][coords.x][coords.y].object->type == GOLD ||
+ gmaps[player][coords.x][coords.y].object->type == STONE )
+ {
+ return 0;
+ // From to condition... Ships may use wather,
+ // pawns may une FOREST, GOLD, AND STONE
+ }
+ else
+ {
+ return 1;
+ }
+ }
+ else
+ {
+ return 1;
+ }
+}
--
tuxhistory - Educational history game
More information about the Tux4kids-commits
mailing list