Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

linux-gtk/simulation-ui.c File Reference

simulation UI file. Contains code to debug the simulation routines. More...

#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <zakdef.h>
#include <simulation.h>
#include <ui.h>
#include <globals.h>
#include <main.h>
#include <drawing.h>
#include <string.h>
#include <strings.h>
#include <assert.h>

Go to the source code of this file.

Data Structures

struct  button_list
 the list of buttons and fields they care about More...

struct  tag_pmh
 pixmap handles for the map More...


Defines

#define SHOW_POWER   1
 show the power bitmap

#define SHOW_WATER   (SHOW_POWER<<1)
 show the water bitmap


Enumerations

enum  ccr_t
 color need/desire table


Functions

void bpwater_clicked (GtkWidget *widget, gpointer data)
 one of the buttons was clicked

gint close_window (GtkWidget *wid, gpointer data)
 close the window

void updateAMap (Int16 xpos, Int16 ypos, GdkColor *col, ccr_t carry, GdkDrawable *dw_ori, GdkDrawable *dw_mask)
 update one of the maps

ccr_t checkCommon (welem_t world, selem_t flag, carryfn_t carry, UInt8 flagbit)
 check if the node carries the specific flagged item

void updatePower (Int16 xpos, Int16 ypos, ccr_t has_carry)
 update a power field

void updateWater (Int16 xpos, Int16 ypos, ccr_t has_carry)
 update a water field

void doPixPaint (void)
 initialize the map initialize the painting structures

gint expose_pw (GtkWidget *area, GdkEventExpose *event, gpointer data)
 handle the window being exposed

void showMap (void)
 show the map

void UIPaintMapField (UInt16 xpos, UInt16 ypos, welem_t elem)
 update an individual position on the map

void UIPaintMapStatus (UInt16 xpos, UInt16 ypos, welem_t world, selem_t status)
 update a map status position

void resizeMap (void)
 resize the map ... need to recreate all the elements


Variables

GtkWidget * pw_win
 window handle

GtkWidget * dw_area
 pointer to the drawing area

tag_pmh pmh
 pixmap handles for the map

int shown_pixmaps
 govern the visibility of the water and power pixmaps

GtkWidget * button_power
 handle for the power button

GtkWidget * button_water
 handle for the water button

button_list list_buttons []
 the list of buttons and fields they care about

GdkColor colBlank = { 0, 0, 0, 0 }
 blank color

GdkColor colNeedPower = { 1, 255, 0, 0 }
 need power color

GdkColor colNeedWater = { 1, 0, 0, 255 }
 need water color

GdkColor colFull = { 2, 255, 255, 255 }
 power/ware is supplied color


Detailed Description

simulation UI file. Contains code to debug the simulation routines.

Displays the map/power/water distribution graphs. principal is: red == need power, blue == need water When supplied the node turns black, otherwise it stays the bad color

This code is really part of the map functionality. I just need it for debugging for the moment.

Definition in file simulation-ui.c.


Function Documentation

void bpwater_clicked GtkWidget *    widget,
gpointer    data
[static]
 

one of the buttons was clicked

Parameters:
widget  the button that was clicked
data  unused

Definition at line 68 of file simulation-ui.c.

References button_list::button, dw_area, button_list::field, list_buttons, and shown_pixmaps.

Referenced by showMap().

ccr_t checkCommon welem_t    world,
selem_t    flag,
carryfn_t    carry,
UInt8    flagbit
[static]
 

check if the node carries the specific flagged item

Parameters:
world  the value of the world
flag  the value of the flag
carry  test function for carrying
flagbit  the flagbt to check with
Returns:
the carries/doesn carry/supplied state

Definition at line 175 of file simulation-ui.c.

References selem_t, UInt8, and welem_t.

Referenced by UIPaintMapStatus().

gint close_window GtkWidget *    wid,
gpointer    data
[static]
 

close the window

Parameters:
wid  unused
data  unused
Returns:
false, it always closes.

Definition at line 99 of file simulation-ui.c.

References pw_win.

Referenced by showMap().

gint expose_pw GtkWidget *    area,
GdkEventExpose *    event,
gpointer    data
[static]
 

handle the window being exposed

Parameters:
area  the widget area being exposed
event  the exposure event
data  unused
Returns:
FALSE, let system also handle the event

Definition at line 276 of file simulation-ui.c.

References tag_pmh::allmap, pmh, tag_pmh::power, tag_pmh::power_mask, SHOW_POWER, SHOW_WATER, tag_pmh::water, and tag_pmh::water_mask.

Referenced by showMap().

void UIPaintMapField UInt16    xpos,
UInt16    ypos,
welem_t    elem
 

update an individual position on the map

this would consist of painting it's location, as well as the power and water items for that location. It is the map version of UIDrawField.

Parameters:
xpos  the x position
ypos  the y position
elem  the item to paint on the map

Definition at line 378 of file simulation-ui.c.

References tag_pmh::allmap, doPixPaint(), pmh, UIDrawMapZone(), UInt16, and welem_t.

Referenced by BuildSomething(), and DrawFieldWithoutInit().

void UIPaintMapStatus UInt16    xpos,
UInt16    ypos,
welem_t    world,
selem_t    status
 

update a map status position

Parameters:
xpos  the x position on the map
ypos  the y position on the map
world  the world pointer
status  the status of the zone

Definition at line 388 of file simulation-ui.c.

References checkCommon(), POWEREDBIT, selem_t, UInt16, updatePower(), updateWater(), WATEREDBIT, and welem_t.

Referenced by BuildSomething(), and DrawFieldWithoutInit().

void updateAMap Int16    xpos,
Int16    ypos,
GdkColor *    col,
ccr_t    carry,
GdkDrawable *    dw_ori,
GdkDrawable *    dw_mask
[static]
 

update one of the maps

Parameters:
xpos  the x position
ypos  the y position
col  the color to use
carry  doe sthe item carry the subject in question
dw_ori  the drawing of the origin
dw_mask  the mask for the drawing

Definition at line 139 of file simulation-ui.c.

References ccr_t, colBlank, colFull, and Int16.

Referenced by updatePower(), and updateWater().

void updatePower Int16    xpos,
Int16    ypos,
ccr_t    has_carry
[static]
 

update a power field

Parameters:
xpos  the xposition
ypos  the y position
has_carry  does carry the item

Definition at line 191 of file simulation-ui.c.

References ccr_t, colNeedPower, Int16, pmh, tag_pmh::power, tag_pmh::power_mask, and updateAMap().

Referenced by UIPaintMapStatus().

void updateWater Int16    xpos,
Int16    ypos,
ccr_t    has_carry
[static]
 

update a water field

Parameters:
xpos  the xposition
ypos  the y position
has_carry  does carry the item

Definition at line 205 of file simulation-ui.c.

References ccr_t, colNeedWater, Int16, pmh, updateAMap(), tag_pmh::water, and tag_pmh::water_mask.

Referenced by UIPaintMapStatus().


Generated on Mon Aug 30 19:44:17 2004 for pocketcity by doxygen1.2.18