Main Page | Data Structures | Directories | File List | Data Fields | Globals

mps.h File Reference

#include "cliglobs.h"

Go to the source code of this file.

Defines

#define MPS_GLOBAL_FINANCE   0x10
#define MPS_GLOBAL_OTHER_COSTS   0x11
#define MPS_GLOBAL_HOUSING   0x12
#define MPS_GLOBAL_STYLE_MIN   MPS_GLOBAL_FINANCE
#define MPS_GLOBAL_STYLE_MAX   MPS_GLOBAL_HOUSING
#define _generic_mps

Functions

void mps_full_refresh (void)
void mappoint_stats (int, int, int)


Define Documentation

#define _generic_mps
 

Definition at line 24 of file mps.h.

#define MPS_GLOBAL_FINANCE   0x10
 

Definition at line 12 of file mps.h.

#define MPS_GLOBAL_HOUSING   0x12
 

Definition at line 14 of file mps.h.

#define MPS_GLOBAL_OTHER_COSTS   0x11
 

Definition at line 13 of file mps.h.

#define MPS_GLOBAL_STYLE_MAX   MPS_GLOBAL_HOUSING
 

Definition at line 17 of file mps.h.

#define MPS_GLOBAL_STYLE_MIN   MPS_GLOBAL_FINANCE
 

Definition at line 16 of file mps.h.


Function Documentation

void mappoint_stats int  ,
int  ,
int 
 

Definition at line 109 of file mps.c.

00110 {
00111     static int xx = 0, yy = 0, oldbut = 0;
00112     Rect* mps = &scr.mappoint_stats;
00113     char s[100];
00114 
00115     /* mappoint_stats (-3,-3,-3) means continue using old values 
00116        for the map coordinates and button, but do a full refresh 
00117        of setup strings */
00118     /* mappoint_stats (-2,-2,b) means mps should display "global 
00119        statistics" rather than "map-point statistics".
00120        The "b" parameter identifies which kind of global statistics 
00121        should be displayed (e.g. finance, population, etc.) */
00122     /* mappoint_stats (-1,-1,-1) means continue using old values */
00123     if (x == -3) {
00124         Fgl_fillbox (mps->x, mps->y,
00125                      mps->w + 1, mps->h + 1, 14);
00126         Fgl_setfontcolors (14, TEXT_FG_COLOUR);
00127         
00128         if (xx == -2)
00129             mps_global_setup (oldbut);
00130         else {
00131             /* this should be part of *_setup, but is needed by
00132                mps_right too */
00133             strcpy (s, _(main_groups[MP_GROUP(xx,yy)].name));
00134             Fgl_write (mps->x + (14 - strlen (s)) * 4,
00135                        mps->y, s);
00136             
00137             mps_setup (xx,yy);
00138         }
00139 
00140         button = oldbut;
00141         x = xx;
00142         y = yy;
00143         Fgl_setfontcolors (TEXT_BG_COLOUR, TEXT_FG_COLOUR);
00144 
00145 
00146     } else if (x == -2) {
00147       /* Global statistics */
00148         if (button != oldbut) {
00149             xx = x;
00150             yy = y;
00151             oldbut = button;
00152             Fgl_fillbox (mps->x, mps->y,
00153                          mps->w + 1, mps->h + 1, 14);
00154             Fgl_setfontcolors (14, TEXT_FG_COLOUR);
00155             mps_global_setup (button);
00156             Fgl_setfontcolors (TEXT_BG_COLOUR, TEXT_FG_COLOUR);
00157         }
00158     } else if (x == -1) {
00159       /* Use old values */
00160         x = xx;
00161         y = yy;
00162         button = oldbut;
00163     } else {
00164         if (mappoint_stats_flag == 1 && x == xx && y == yy
00165             && oldbut == LC_MOUSE_LEFTBUTTON
00166             && button == LC_MOUSE_LEFTBUTTON)
00167         {
00168             if (MP_GROUP(xx,yy) == GROUP_MARKET)
00169             {
00170                 clicked_market_cb (xx, yy);
00171                 return;
00172             }
00173             else if (MP_GROUP(xx,yy) == GROUP_PORT)
00174             {
00175                 clicked_port_cb (xx, yy);
00176                 return;
00177             }
00178         }
00179         xx = x;
00180         yy = y;
00181         oldbut = button;
00182         mappoint_stats_flag = 1;
00183         /* draw centre of box */
00184         Fgl_fillbox (mps->x, mps->y,
00185                      mps->w + 1, mps->h + 1, 14);
00186         /* write static stuff */
00187 
00188         Fgl_setfontcolors (14, TEXT_FG_COLOUR);
00189 
00190         strcpy (s, _(main_groups[MP_GROUP(x,y)].name));
00191         Fgl_write (mps->x + (14 - strlen (s)) * 4,
00192                    mps->y, s);
00193 
00194         if (button == LC_MOUSE_RIGHTBUTTON)
00195             mps_right_setup ();
00196         else
00197             mps_setup(x,y);
00198     }
00199 
00200     /* Now act on our decisions */
00201 
00202     Fgl_setfontcolors (14, TEXT_FG_COLOUR);
00203 
00204     if (x == -2 || x == -3) {
00205         mps_global (button);
00206     } else if (button == LC_MOUSE_RIGHTBUTTON) {
00207         mps_right (x, y);
00208     } else {
00209         switch (MP_GROUP(x,y))
00210         {
00211         case GROUP_POWER_LINE:
00212             mps_power_line (x,y);
00213             break;
00214         case GROUP_RESIDENCE_LL:
00215         case GROUP_RESIDENCE_ML:
00216         case GROUP_RESIDENCE_HL:
00217         case GROUP_RESIDENCE_LH:
00218         case GROUP_RESIDENCE_MH:
00219         case GROUP_RESIDENCE_HH:
00220             mps_res (x, y);
00221             break;
00222         case (GROUP_ROAD):
00223             mps_road (x, y);
00224             break;
00225         case (GROUP_RAIL):
00226             mps_rail (x, y);
00227             break;
00228         case (GROUP_TRACK):
00229             mps_track (x, y);
00230             break;
00231         case (GROUP_ORGANIC_FARM):
00232             mps_farm (x, y);
00233             break;
00234         case (GROUP_MARKET):
00235             mps_market (x, y);
00236             break;
00237         case (GROUP_INDUSTRY_L):
00238             mps_indl (x, y);
00239             break;
00240         case (GROUP_INDUSTRY_H):
00241             mps_indh (x, y);
00242             break;
00243         case (GROUP_COALMINE):
00244             mps_coalmine (x, y);
00245             break;
00246         case GROUP_COAL_POWER:
00247             mps_power_source_coal (x, y);
00248             break;
00249         case GROUP_SOLAR_POWER:
00250             mps_power_source (x, y);
00251             break;
00252         case (GROUP_UNIVERSITY):
00253             mps_university (x, y);
00254             break;
00255         case (GROUP_OREMINE):
00256             mps_oremine (x, y);
00257             break;
00258         case (GROUP_RECYCLE):
00259             mps_recycle (x, y);
00260             break;
00261         case (GROUP_SUBSTATION):
00262             mps_substation (x, y);
00263             break;
00264         case (GROUP_ROCKET):
00265             mps_rocket (x, y);
00266             break;
00267         case (GROUP_WINDMILL):
00268             mps_windmill (x, y);
00269             break;
00270         case (GROUP_MONUMENT):
00271             mps_monument (x, y);
00272             break;
00273         case (GROUP_SCHOOL):
00274             mps_school (x, y);
00275             break;
00276         case (GROUP_BLACKSMITH):
00277             mps_blacksmith (x, y);
00278             break;
00279         case (GROUP_MILL):
00280             mps_mill (x, y);
00281             break;
00282         case (GROUP_POTTERY):
00283             mps_pottery (x, y);
00284             break;
00285         case (GROUP_WATER):
00286             mps_water (x, y);
00287             break;
00288         case (GROUP_PORT):
00289             mps_port (x, y);
00290             break;
00291         case (GROUP_TIP):
00292             mps_tip (x, y);
00293             break;
00294         case (GROUP_COMMUNE):
00295             mps_commune (x, y);
00296             break;
00297         case (GROUP_FIRESTATION):
00298             mps_firestation (x, y);
00299             break;
00300         case (GROUP_CRICKET):
00301             mps_cricket (x, y);
00302             break;
00303         case (GROUP_HEALTH):
00304             mps_health (x, y);
00305             break;
00306         default: 
00307             xx = -2;
00308             yy = -2;
00309             oldbut = 2;
00310         }
00311     }
00312 
00313     Fgl_setfontcolors (TEXT_BG_COLOUR, TEXT_FG_COLOUR);
00314 
00315 }

void mps_full_refresh void   ) 
 

Definition at line 100 of file mps.c.

00101 {
00102     Rect* mps = &scr.mappoint_stats;
00103 
00104     draw_small_bezel (mps->x, mps->y, mps->w, mps->h, yellow(0));
00105     mappoint_stats (-3, -3, -3);
00106 }


Generated on Sun Dec 26 11:23:39 2004 for lincity by  doxygen 1.3.9.1