From 1917708467bb4fa454ae191596c3353a08791d41 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 13 Feb 2019 06:35:56 -1100 Subject: [PATCH] Fix edge case --- src/cc/rogue/command.c | 7 +++++-- src/cc/rogue/main.c | 1 + src/cc/rogue/rogue.h | 10 ++++++++++ src/cc/rogue_rpc.cpp | 31 +++++++++++++++++-------------- 4 files changed, 33 insertions(+), 16 deletions(-) diff --git a/src/cc/rogue/command.c b/src/cc/rogue/command.c index 9446d704f..63aed25be 100644 --- a/src/cc/rogue/command.c +++ b/src/cc/rogue/command.c @@ -312,9 +312,12 @@ over: after = FALSE; msg(rs,"version %s. (mctesq was here)", release); when 'S': - msg(rs,"Saving is disabled, use bailout rpc"); after = FALSE; - //save_game(rs); +#ifdef STANDALONE + save_game(rs); +#else + msg(rs,"Saving is disabled, use bailout rpc"); +#endif when '.': ; /* Rest command */ when ' ': after = FALSE; /* "Legal" illegal command */ when '^': diff --git a/src/cc/rogue/main.c b/src/cc/rogue/main.c index 21c52deab..c3484eafe 100644 --- a/src/cc/rogue/main.c +++ b/src/cc/rogue/main.c @@ -19,6 +19,7 @@ #include #include #include +#include #define SMALLVAL 0.000000000000001 #define SATOSHIDEN ((uint64_t)100000000L) diff --git a/src/cc/rogue/rogue.h b/src/cc/rogue/rogue.h index 5eccb2e8c..a407ae8a6 100644 --- a/src/cc/rogue/rogue.h +++ b/src/cc/rogue/rogue.h @@ -17,6 +17,16 @@ #undef lines +#ifdef LINES +#undef LINES +#endif +#ifdef COLS +#undef COLS +#endif + +#define LINES 24 +#define COLS 80 + #define NOOP(x) (x += 0) #define CCHAR(x) ( (char) (x & A_CHARTEXT) ) /* diff --git a/src/cc/rogue_rpc.cpp b/src/cc/rogue_rpc.cpp index f37d587ea..86a633212 100644 --- a/src/cc/rogue_rpc.cpp +++ b/src/cc/rogue_rpc.cpp @@ -22,6 +22,23 @@ #define ROGUE_MAXPLAYERS 64 // need to send unused fees back to globalCC address to prevent leeching #define ROGUE_MAXKEYSTROKESGAP 60 #define ROGUE_MAXITERATIONS 777 + +#define MAXPACK 23 +struct rogue_packitem +{ + int32_t type,launch,count,which,hplus,dplus,arm,flags,group; + char damage[8],hurldmg[8]; +}; +struct rogue_player +{ + int32_t gold,hitpoints,strength,level,experience,packsize,dungeonlevel,pad; + struct rogue_packitem roguepack[MAXPACK]; +}; +int32_t rogue_replay2(uint8_t *newdata,uint64_t seed,char *keystrokes,int32_t num,struct rogue_player *player); +#define ROGUE_DECLARED_PACK +void rogue_packitemstr(char *packitemstr,struct rogue_packitem *item); + + std::string Rogue_pname = "fred"; /* @@ -133,20 +150,6 @@ std::string Rogue_pname = "fred"; // ./c cclib bailout 17 \"[%226d3243c6e5ab383898b28a87e01f6c00b5bdd9687020f17f5caacc8a61febd19%22]\" // ./komodo-cli -ac_name=ROGUE cclib register 17 \"[%22a898f4ceef7647ba113b9f3c24ef045f5d134935a3b09bdd1a997b9d474f4c1b%22,%22f11d0cb4e2e4c21f029a1146f8e5926f11456885b7ab7d665096f5efedec8ea0%22]\" -#define MAXPACK 23 -struct rogue_packitem -{ - int32_t type,launch,count,which,hplus,dplus,arm,flags,group; - char damage[8],hurldmg[8]; -}; -struct rogue_player -{ - int32_t gold,hitpoints,strength,level,experience,packsize,dungeonlevel,pad; - struct rogue_packitem roguepack[MAXPACK]; -}; -int32_t rogue_replay2(uint8_t *newdata,uint64_t seed,char *keystrokes,int32_t num,struct rogue_player *player); -#define ROGUE_DECLARED_PACK -void rogue_packitemstr(char *packitemstr,struct rogue_packitem *item); CScript rogue_newgameopret(int64_t buyin,int32_t maxplayers) {