Skip to content

Commit

Permalink
Add more non-kitten items and consts
Browse files Browse the repository at this point in the history
  • Loading branch information
noncombatant committed May 14, 2023
1 parent c7069ea commit 0a9a81b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
14 changes: 13 additions & 1 deletion non_kitten_items.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
static char* Messages[] = {
static const char* Messages[] = {
// Do not change these:
"",
"",
Expand Down Expand Up @@ -969,6 +969,18 @@ static char* Messages[] = {
"This appears to be a 21-sided die. The AD&D rules get weirder every year...",
"A freshly-reinvented wheel that suddenly disappears.",
"Nothing here but the wind.",
"It’s a tracking cookie. It tastes like cardboard.",
"You find an AddressSanitizer report. There was once a bug here.",
"When you look under this rock, you don’t see kitten.",
"In the grand scheme of things, it’s nothing. Don’t worry about it!",
"A few scattered Unicode code points.",
"A child’s birthday party is in progress. There is cake icing everywhere.",
"You have no idea what this is. Neither does it?",
"A wizard’s spellbook.",
"Thieves’ tools.",
"A lute. You twang it.",
"When you wave this magic wand, it sputters.",
"A rusted knight’s helmet. The visor squeaks when you lift it.",
};

#define MessageCount (sizeof(Messages) / sizeof(Messages[0]))
9 changes: 4 additions & 5 deletions robotfindskitten.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

#include "non_kitten_items.h"

static const char Version[] = "2.71828182";
static const char Version[] = "2.718281828";
static const char Introduction[] =
"By the illustrious Leonard Richardson © 1997, 2000.\n"
"Written originally for the Nerth Pork robotfindskitten contest.\n"
Expand Down Expand Up @@ -123,7 +123,7 @@ static void InitializeMessages(void) {
GameState.messages = Messages;
GameState.message_count = MessageCount;
for (size_t i = Bogus; i < (GameState.message_count - 1); ++i) {
size_t j = i + ((size_t)random() % (GameState.message_count - i));
const size_t j = i + ((size_t)random() % (GameState.message_count - i));
if (i != j) {
char* temp = GameState.messages[i];
GameState.messages[i] = GameState.messages[j];
Expand Down Expand Up @@ -338,8 +338,7 @@ static void RedrawScreen(void) {

static void HandleResize(void) {
int xbound = 0, ybound = 0;
unsigned int i;
for (i = 0; i < GameState.item_count; ++i) {
for (size_t i = 0; i < GameState.item_count; ++i) {
if (GameState.items[i].x > xbound) {
xbound = GameState.items[i].x;
}
Expand Down Expand Up @@ -376,7 +375,7 @@ static void ShowIntroduction(void) {
static void PlayAnimation(bool approach_from_right) {
move(1, 0);
clrtoeol();
int animation_meet = (COLS / 2);
const int animation_meet = (COLS / 2);

ScreenObject kitten;
memcpy(&kitten, &GameState.items[Kitten], sizeof(kitten));
Expand Down

0 comments on commit 0a9a81b

Please sign in to comment.