diff --git a/src/random.h b/src/random.h index 4ddd5d8..91c3dde 100644 --- a/src/random.h +++ b/src/random.h @@ -11,7 +11,8 @@ enum { PLATE_IS_OCEAN, PLATE_THICK, PLATE_SPEED_X, - PLATE_SPEED_Y + PLATE_SPEED_Y, + PLATE_AGE }; uint64_t game_hash(uint64_t seed,int type,int subtype); diff --git a/src/terrain.c b/src/terrain.c index a008da8..76684e1 100644 --- a/src/terrain.c +++ b/src/terrain.c @@ -109,6 +109,16 @@ static void plate_speed(struct Plate_list _i,uint64_t seed){ } } +static void plate_age(struct Plate_list _i,uint64_t seed){ + for(int i=0;i<_i.count;i++){ + if((_i._p+i)->is_ocean){ + (_i._p+i)->age=(double)game_hash(seed,PLATE_AGE,i)/UINT64_MAX*200; + }else{ + (_i._p+i)->age=200+(double)game_hash(seed,PLATE_AGE,i)/UINT64_MAX*3800; + } + } +} + struct Plate_list plate_init(uint64_t seed,struct World_Block *block){ int count = plate_count(seed); struct Plate_list list; @@ -117,5 +127,9 @@ struct Plate_list plate_init(uint64_t seed,struct World_Block *block){ plate_seed(list,seed); lloyd_init(block,list); lloyd_iterate(block,list,2); + plate_is_ocean(list,seed); + plate_thick(list,seed); + plate_speed(list,seed); + plate_age(list,seed); return list; } \ No newline at end of file diff --git a/src/terrain.h b/src/terrain.h index 5023f44..367167a 100644 --- a/src/terrain.h +++ b/src/terrain.h @@ -38,7 +38,6 @@ struct Plate { bool is_ocean; double thick; unsigned long age; - int rock_type; int world_block_count; }; @@ -50,6 +49,11 @@ struct Plate_list { struct World_Block { int plate_id; double nearest_plate_dist; + int north_plate_id; + int south_plate_id; + int west_plate_id; + int east_plate_id; + }; struct World {