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

Commit

Permalink
修复致命bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Rratic committed Feb 24, 2021
1 parent ff7d67c commit f5c0b59
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 3 deletions.
4 changes: 3 additions & 1 deletion cpp11/maze-chunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ chunk::chunk(const chunk &other){
w=other.w;
}
chunk::~chunk(){
player=nullptr;
if(player!=nullptr)delete player;
}
void chunk::putchunk(){
for(unsigned short i=0;i<l;++i){
Expand Down Expand Up @@ -48,6 +48,8 @@ bool chunk::toline(string s,unsigned short line){
player=new entity;
player->x=line;
player->y=c;
player->health=10;
player->id=0;
blocks[line][c].id=air;
}
else{
Expand Down
1 change: 1 addition & 0 deletions cpp11/maze-chunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class chunk
{
public:
entity *player;
vector<entity>monsters;
array<array<block,16>,16>blocks;
unsigned short l,w;
chunk();
Expand Down
4 changes: 2 additions & 2 deletions cpp11/maze-game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ void game::clear(){
void level_menu(){
game all;
while(true){
for(unsigned short i=1;i!=5;++i){
for(unsigned short i=1;i!=6;++i){
string te="1-"+tos(i);
cout<<"1-"<<i<<' '<<lang.search("name-"+te)<<' ';
if(savedgame.without(te))cout<<lang.search("level-uncompleted");
if(savedgame.without(te))cout<<"\033[91m"<<lang.search("level-uncompleted")<<"\033[m";
else cout<<lang.search("score")<<':'<<savedgame.tag[te];
cout<<'\n';
}
Expand Down
2 changes: 2 additions & 0 deletions data/lang/en.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ name-1-3:Move Texts
help-1-3:Texts can be moved if they are not blocked.
name-1-4:Start Earning
help-1-4:Be careful!
name-1-5:Little Review
help-1-5:Use q to quit.
2 changes: 2 additions & 0 deletions data/lang/zh.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ name-1-3:推箱子
help-1-3:如果不被阻挡,文字可以被推动。
name-1-4:开始赚钱
help-1-4:小心!
name-1-5:小复习
help-1-5:按q退出。
20 changes: 20 additions & 0 deletions data/levels.data
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,23 @@ $1-4
#........a$..a.#
#........a$.a%.#
################
$1-5
1 8
################
#@#.....#...a.$#
#...###.$.###.##
#a#..$#####...$#
#.###a......a %
#...a$######.#..
#..a......... $
################
$1-6
1 8
################
#...#$.........#
#.@.######......
#....#. . ##.
#..........&{1,zombie}....
#...#.. .....
#.#...###..#...%
################

0 comments on commit f5c0b59

Please sign in to comment.