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

simulate.h File Reference

Go to the source code of this file.

Functions

void clear_mappoint (short fill, int x, int y)
void new_city (int *originx, int *originy, int random_village)
void count_all_groups (int *group_count)
void do_time_step (void)


Function Documentation

void clear_mappoint short  fill,
int  x,
int  y
 

Definition at line 82 of file simulate.c.

00083 {
00084     MP_TYPE(x,y) = fill;
00085     MP_GROUP(x,y) = get_group_of_type(fill);
00086     if (MP_GROUP(x,y) < 0) MP_GROUP(x,y) = GROUP_BARE;
00087     MP_INFO(x,y).population = 0;
00088     MP_INFO(x,y).flags = 0;
00089     MP_INFO(x,y).int_1 = 0;
00090     MP_INFO(x,y).int_2 = 0;
00091     MP_INFO(x,y).int_3 = 0;
00092     MP_INFO(x,y).int_4 = 0;
00093     MP_INFO(x,y).int_5 = 0;
00094     MP_INFO(x,y).int_6 = 0;
00095     MP_INFO(x,y).int_7 = 0;
00096 }

void count_all_groups int *  group_count  ) 
 

Definition at line 581 of file simulate.c.

00582 {
00583     int x, y;
00584     unsigned short t, g;
00585     for (x = 0; x < NUM_OF_GROUPS; x++)
00586         group_count[x] = 0;
00587     for (y = 0; y < WORLD_SIDE_LEN; y++) {
00588         for (x = 0; x < WORLD_SIDE_LEN; x++) {
00589             t = MP_TYPE(x,y);
00590             if (t != CST_USED && t != CST_GREEN) {
00591                 g = get_group_of_type(t);
00592                 group_count[g]++;
00593             }
00594         }
00595     }
00596 }

void do_time_step void   ) 
 

Definition at line 50 of file simulate.c.

00051 {
00052     /* Increment game time */
00053     total_time++;
00054 #ifdef DEBUG_ENGINE
00055     printf ("In do_time_step (%d)\n", total_time);
00056 #endif
00057 
00058     /* Initialize daily accumulators */
00059     init_daily();
00060 
00061     /* Initialize monthly accumulators */
00062     if (total_time % NUMOF_DAYS_IN_MONTH == 0) {
00063         init_monthly();
00064     }
00065 
00066     /* Initialize yearly accumulators */
00067     if ((total_time % NUMOF_DAYS_IN_YEAR) == 0) {
00068         init_yearly();
00069     }
00070 
00071     /* Clear the power grid */
00072     power_time_step ();
00073 
00074     /* Run through simulation equations for each farm, residence, etc. */
00075     simulate_mappoints ();
00076 
00077     /* Now do the stuff that happens once a year, once a month, etc. */
00078     do_periodic_events ();
00079 }

void new_city int *  originx,
int *  originy,
int  random_village
 

Definition at line 441 of file simulate.c.

00442 {
00443     clear_game ();
00444     coal_reserve_setup ();
00445     setup_river ();
00446     ore_reserve_setup ();
00447     init_pbars ();
00448 
00449     /* Initial population is 100 for empty board or 200 
00450        for random village (100 are housed). */
00451     people_pool = 100;
00452 
00453     if (random_village != 0) {
00454         random_start (originx, originy);
00455         update_pbar(PPOP,200,1); /* So pbars don't flash */
00456     } else {
00457         *originx = *originy = WORLD_SIDE_LEN/2 ;
00458         update_pbar(PPOP,100,1);
00459     }
00460     connect_transport (1,1,WORLD_SIDE_LEN-2,WORLD_SIDE_LEN-2);
00461     refresh_pbars ();
00462 }


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