Compare commits

..

2 Commits

Author SHA1 Message Date
9ff08e4a91 Use prettynames.h 2026-02-24 14:03:43 +01:00
a094105476 prettynames.c 2026-02-24 13:59:10 +01:00
4 changed files with 30 additions and 20 deletions

View File

@@ -6,8 +6,8 @@ TARGET = main
all: $(TARGET) all: $(TARGET)
$(TARGET): main.c random.c random.h world.c world.h $(TARGET): main.c random.c random.h world.c world.h prettynames.c prettynames.h
$(CC) $(CFLAGS) -o $@ main.c random.c world.c $(CC) $(CFLAGS) -o $@ main.c random.c world.c prettynames.c
clean: clean:
rm -f $(TARGET) rm -f $(TARGET)

View File

@@ -1,27 +1,10 @@
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include "prettynames.h"
#include "random.h" #include "random.h"
#include "world.h" #include "world.h"
static const char *quadrant_type_name(quadrant_type type) {
switch (type) {
case Q_EMPTY: return "Empty";
case Q_ASTEROID_FIELD: return "Asteroid field";
case Q_STAR_SYSTEM: return "Star system";
case Q_NEBULA: return "Nebula";
case Q_BLACK_HOLE: return "Black hole";
case Q_WHITE_HOLE: return "White hole";
case Q_PULSAR: return "Pulsar";
case Q_QUASAR: return "Quasar";
case Q_SUPERNOVA: return "Supernova";
case Q_ANOMALY: return "Anomaly";
case Q_SINGULARITY: return "Singularity";
case Q_COUNT: return "Count";
default: return "Undefined";
}
}
int main() { int main() {
uint32_t seed; uint32_t seed;
printf("Enter seed: "); printf("Enter seed: ");

19
iris_c/prettynames.c Normal file
View File

@@ -0,0 +1,19 @@
#include "prettynames.h"
const char *quadrant_type_name(quadrant_type type) {
switch (type) {
case Q_EMPTY: return "Empty";
case Q_ASTEROID_FIELD: return "Asteroid field";
case Q_STAR_SYSTEM: return "Star system";
case Q_NEBULA: return "Nebula";
case Q_BLACK_HOLE: return "Black hole";
case Q_WHITE_HOLE: return "White hole";
case Q_PULSAR: return "Pulsar";
case Q_QUASAR: return "Quasar";
case Q_SUPERNOVA: return "Supernova";
case Q_ANOMALY: return "Anomaly";
case Q_SINGULARITY: return "Singularity";
case Q_COUNT: return "Count";
default: return "Undefined";
}
}

8
iris_c/prettynames.h Normal file
View File

@@ -0,0 +1,8 @@
#ifndef PRETTYNAMES_H
#define PRETTYNAMES_H
#include "world.h"
const char *quadrant_type_name(quadrant_type type);
#endif