2021-10-31 15:12:30 +01:00
|
|
|
#ifndef _CORE_H
|
|
|
|
#define _CORE_H
|
|
|
|
|
|
|
|
#include "calccity.h"
|
|
|
|
#include "display.h"
|
2021-11-04 18:08:43 +01:00
|
|
|
#include "menus.h"
|
2021-10-31 15:12:30 +01:00
|
|
|
|
|
|
|
// callback_tick : time function
|
|
|
|
int callback_tick(volatile int *tick);
|
|
|
|
|
|
|
|
// default_values : initialize the game
|
|
|
|
void default_values(struct calccity *current_game, struct camera *camera, struct map *map);
|
|
|
|
|
|
|
|
// rtc_key : get a key with RTC system
|
|
|
|
int rtc_key(void);
|
|
|
|
|
2021-11-04 18:08:43 +01:00
|
|
|
// next_step : compute in-game time
|
2021-11-07 16:44:29 +01:00
|
|
|
void next_step(struct calccity *calccity, struct map *map);
|
2021-11-04 18:08:43 +01:00
|
|
|
|
2021-11-06 20:39:36 +01:00
|
|
|
// main_loop : game main loop, manage key, menu, map actualization and building
|
2021-10-31 15:12:30 +01:00
|
|
|
void main_loop(struct calccity *calccity, struct camera *camera, struct map *map);
|
|
|
|
|
2021-11-05 16:37:09 +01:00
|
|
|
// keyboard_managment : get the key, manage input and open menus
|
2022-02-06 10:22:25 +01:00
|
|
|
void keyboard_managment(struct camera *camera, const int key, const int build_mode);
|
2021-11-05 16:37:09 +01:00
|
|
|
|
2021-11-06 14:23:42 +01:00
|
|
|
// can_build : test if the build is legit
|
2022-06-20 15:28:06 +02:00
|
|
|
bool can_build(struct calccity *calccity, struct map *map, struct building *building, const unsigned short x, const unsigned short y, unsigned char *index);
|
2021-11-06 14:23:42 +01:00
|
|
|
|
|
|
|
// exit_build_mode : reset build mode and cusor
|
|
|
|
void exit_build_mode(struct camera *camera, int *build_mode);
|
2021-11-04 18:08:43 +01:00
|
|
|
|
2022-02-06 10:22:25 +01:00
|
|
|
// large_building : detect large buildings and adjust the building's id
|
2022-06-20 15:28:06 +02:00
|
|
|
struct building large_building(struct map *map, int *build_mode, short unsigned int *loc_x, short unsigned int *loc_y);
|
2022-02-06 10:22:25 +01:00
|
|
|
|
2021-11-07 16:44:29 +01:00
|
|
|
// update_stat : compute the new stat with buildings
|
|
|
|
void update_stat(struct calccity *calccity, struct map *map);
|
|
|
|
|
2021-11-07 18:31:23 +01:00
|
|
|
// end_year : display the year's balance sheet
|
|
|
|
void end_year(struct calccity *calccity);
|
|
|
|
|
2022-06-20 15:28:06 +02:00
|
|
|
// check_shorelines : check the shorelines, roads and railways
|
|
|
|
void check(struct map *map, const int x, const int y);
|
|
|
|
|
|
|
|
// check_harbor : check the harbor's orientation
|
|
|
|
int check_harbor(struct map *map, const int x, const int y);
|
|
|
|
|
|
|
|
// get_reference_id : get the id of large buildings
|
|
|
|
int get_reference_id(const unsigned char tile_id);
|
|
|
|
|
|
|
|
// destruction : manage deconstruction
|
|
|
|
void destruction(struct map *map, int loc_x, int loc_y);
|
|
|
|
|
|
|
|
// disaster : manage disasters
|
|
|
|
void disaster(struct calccity *calccity, struct map *map, const int destruction_rate);
|
|
|
|
|
2021-10-31 15:12:30 +01:00
|
|
|
#endif /* _CORE_H */
|