First playable version

This commit is contained in:
Shadow15510 2022-06-23 14:26:38 +02:00
parent 1ef42ee837
commit 9c03091c9b
2 changed files with 20 additions and 6 deletions

View File

@ -116,8 +116,9 @@ void next_step(struct calccity *calccity, struct map *map)
if (calccity->disaster)
{
int random_event = rand() % 10000;
// Firehazard
if (calccity->stat[7] > 500 && rand() % 1000 == 0)
if (calccity->stat[7] > 500 && random_event == 0)
{
display_message("UN INCENDIE A RAVAGE VOTRE VILLE.");
disaster(calccity, map, calccity->stat[7]);
@ -125,7 +126,7 @@ void next_step(struct calccity *calccity, struct map *map)
}
// Nuclear disaster
if (calccity->stat[8] >= 1 && rand() % 10000 == 0)
if (calccity->stat[8] >= 1 && random_event == 1)
{
display_message("UN ACCIDENT NUCLEAIRE A RAVAGE VOTRE VILLE.");
disaster(calccity, map, calccity->stat[8] * 100);
@ -133,7 +134,7 @@ void next_step(struct calccity *calccity, struct map *map)
}
// Earthquake
if (rand() % 10000 == 0)
if (random_event == 2)
{
display_message("UN TREMBLEMENT DE TERRE A RAVAGE VOTRE VILLE.");
disaster(calccity, map, rand() % 10);
@ -141,7 +142,7 @@ void next_step(struct calccity *calccity, struct map *map)
}
// Treasure
if (calccity->misc[0] > 1000 && rand() % 1000 == 0)
if (calccity->misc[0] > 1000 && random_event == 3)
{
if (rand() % 2)
{
@ -156,6 +157,13 @@ void next_step(struct calccity *calccity, struct map *map)
}
}
}
// No money
if (calccity->misc[0] == 0)
{
display_message("DES MECENES PRIVES VOUS ONT FAIT UN DON DE 1000$.");
calccity->misc[0] += 1000;
}
}

View File

@ -1,6 +1,7 @@
#include <gint/display.h>
#include <gint/keyboard.h>
#include <math.h>
#include <stdio.h>
#include "display.h"
@ -95,8 +96,13 @@ void display_around(struct calccity *calccity, struct camera *camera, const int
{
extern const bopti_image_t img_fn_keys;
// Date in the top-left corner
dprint_opt(5, 1, C_BLACK, C_WHITE, DTEXT_LEFT, DTEXT_TOP, "%d-%d", calccity->month, calccity->year);
// Date in the top-left corner and treasure
char up_data[25];
sprintf(up_data, "%d-%d | %d$", calccity->month, calccity->year, calccity->misc[0]);
int width;
dsize(up_data, NULL, &width, NULL);
drect(4, 1, 5 + width, 6, C_WHITE);
dprint_opt(5, 1, C_BLACK, C_WHITE, DTEXT_LEFT, DTEXT_TOP, up_data);
// Cursor
if (disp_cursor)