Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Commit

Permalink
功能增加
Browse files Browse the repository at this point in the history
  • Loading branch information
Rratic committed Mar 7, 2021
1 parent fa14684 commit 591c3ef
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
7 changes: 7 additions & 0 deletions cpp11/maze-game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,19 @@ void set_game(){
}
void show_story(string s){
size_t t=s.length();
time_t nowtime;
tm*newtime;
time(&nowtime);
newtime=localtime(&nowtime);
for(size_t i=0;i<t;++i){
if(s[i]=='$'){
string ss;
++i;
for(++i;s[i]!='}';++i)ss+=s[i];
if(ss=="name")cout<<setting.tag["user-name"];
else if(ss=="time")cout<<newtime->tm_hour<<':'<<newtime->tm_min<<':'<<newtime->tm_sec;
else if(ss=="date")cout<<newtime->tm_year+1900<<'/'<<newtime->tm_mon<<'/'<<newtime->tm_mday;
//2038年失效qaq
else cout<<'['<<ss<<']';
continue;
}
Expand Down
6 changes: 6 additions & 0 deletions cpp11/maze-game.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#ifndef rra_maze_game
#define rra_maze_game
#include "maze-chunk.h"
#include <ctime>
using std::time_t;
using std::time;
using std::tm;
using std::localtime;
extern string input;
class game{
private:
Expand All @@ -18,4 +23,5 @@ void world_menu();
void level_menu(unsigned short i);
void set_game();
void show_story(string s);
void rand_game();
#endif
4 changes: 2 additions & 2 deletions cpp11/paint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ heart2="\u2661",\
star="\u2605",\
arroww="\u2191",arrowa="\u2190",arrows="\u2192",arrowd="\u2193",\
arrow2w="\u21d1",arrow2a="\u21d0",arrow2s="\u21d2",arrow2d="\u21d3",\
death="\u2620";
//❤,♡,★,↑←→↓,⇧⇦⇨⇩,☠
death="\u2620",whole_block="\u2588";
//❤,♡,★,↑←→↓,⇧⇦⇨⇩,☠
short mox[8]={-1,0,1,0,-1,1,1,-1},moy[8]={0,1,0,-1,1,1,-1,-1};
/*
+--->y
Expand Down
2 changes: 1 addition & 1 deletion cpp11/paint.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ l=light
f=font
b=background
*/
extern string heart,heart2,star,arroww,arrowa,arrows,arrowd,arrow2w,arrow2a,arrow2s,arrow2d,death;
extern string heart,heart2,star,arroww,arrowa,arrows,arrowd,arrow2w,arrow2a,arrow2s,arrow2d,death,whole_block;
extern short mox[8],moy[8];
#endif

0 comments on commit 591c3ef

Please sign in to comment.