小游戏
以下所有代码请用VS编译器,且安装运行库
这会还是更新我的小游戏,上次发布了过后
有几个粉丝一共也没有多少个粉丝
说MYSQL运行库懒得下,所以我这次就发几个版本
有数据库MYSQL的代码
数据库请使用GBK格式
头文件
#include <cassert>//← ↑ → ↓
#include <bits/stdc++.h>
#include <fstream>
#include <stdio.h>
#include <graphics.h>
#include <conio.h>//getch
#include <windows.h>
#include <pthread.h>
#include <cctype>
#include <cerrno>
#include <cstring>
#include <ctime>
#include<time.h>
#include <mysql.h>
#include <stdio.h>
#include <stdlib.h>
#include <cstring>
#include <WinSock.h>
#include <thread>
#include <iostream>
#include <cstdlib>
#include <sstream>
#include <cstring>
using namespace std;
IMAGE img_ditu[5];
IMAGE img[6];
IMAGE img_map_zom[10];
IMAGE img_home[6];
IMAGE img_bag[11];
IMAGE img_bag_xs[20];
string banben = "1.3", cdbb, zh = "未命名", mm, nc, dm, m_mysql[6];//游戏版本号,存档版本号,账号
const char* host = "127.0.0.1";
int port = 3306;//端口
char qianbi_cha[100];//钱币char型
char xw_[1000];
char anjian = '1';//按键
int player_x, player_y;//玩家x坐标 玩家y坐标
int nl = 100;//能量
int h;//时间
int n;//随机数
int sh = 6;//伤害
int qianbi = 0, xl = 100;//钱币血量
int zombie_x, zombie_y;//输出x,y僵尸血量
struct ditu {
bool cdt;//在地图上
int dtnl;//地图上的哪里
}ditu;
/* 0=家 1=深林 */
struct _map {
int lei, zom_xl, sl,zom_zl;
bool zom_sy;
}Map[40][40];//定义二维数字 表示地图
struct _bag
{
int dx,sl;
}bag[20][20];//表示书包
int bag_sl = 4;//背包剩余格子数量
int bag_ml=0;//背包满了吗?
enum BAG
{
MUTOU = 1,
};
//背包元素:木头1
enum MAP
{
JX = -3,//界限
SPACE = 0,//空地
PLAYER = 2,//玩家
JX_PLAYER = -1,//界限和玩家
ZOMBIE = 3,//僵尸
STONE = 4,//石头
STONE_DS = 5,//地上的碎石
TERR = 6,//树
TERR_DS = 7,//地上的树枝
};
enum MAP_TS
{
home_jieshuchu = -4,//家_接水处
home_luzi = -5,//家_炉子
home_shengjichu = -6,//家_升级处
home_xiangzichu = -7, //家_箱子处
};
enum ZOMBIE
{
PTZOMBIE = 0,
};
//僵尸元素:普通僵尸1
/*
* banben
* qianbi
* nl
* h
* sh
* ditu.cdt
* ditu.dtnl
* bag
*/
源代码
#include "头文件.h"
MYSQL_ROW M_mysql;
MYSQL mysql;
MYSQL_RES* result = 0;
void _MOUSEMSG()
{
while (1)
{
MOUSEMSG msg;
msg = GetMouseMsg();
if (msg.uMsg == WM_LBUTTONDOWN)
{
cout << msg.x << ' ' << msg.y << "\n";
}
}
return;
}
//string UTF8(char* UTF8)
//
//{
//
// DWORD dwUnicodeLen; //转换后Unicode的长度
//
// TCHAR* pwText; //保存Unicode的指针
//
// string strUnicode; //返回值
//
// //获得转换后的长度,并分配内存
//
// dwUnicodeLen = MultiByteToWideChar(CP_UTF8, 0, UTF8, -1, NULL, 0);
//
// pwText = new TCHAR[dwUnicodeLen];
//
// if (!pwText)
//
// {
//
// return strUnicode;
//
// }
//
// //转为Unicode
//
// MultiByteToWideChar(CP_UTF8, 0, UTF8, -1, pwText, dwUnicodeLen);
//
// //转为CString
//
// strUnicode.Format(_T(“ % s”), pwText);
//
// //清除内存
//
// delete[]pwText;
//
// //返回转换好的Unicode字串
//
// return strUnicode;
//
//}
//char* U2G(char* row_i)
//{
// int len = MultiByteToWideChar(CP_UTF8, 0, row_i, strlen(row_i) + 1, NULL, 0);
// wchar_t* wszStr = new wchar_t[len];
// MultiByteToWideChar(CP_UTF8, 0, row_i, strlen(row_i), wszStr, len);
// wszStr[len] = '\0';
//
// int bufSize = WideCharToMultiByte(CP_ACP, NULL, wszStr, -1, NULL, 0, NULL, FALSE);
//
// char* sp = new char[bufSize];
// WideCharToMultiByte(CP_ACP, NULL, wszStr, -1, sp, bufSize, NULL, FALSE);
// return sp;
//}
int M_bbck()
{
//MYSQL_ROW M_mysql;
//MYSQL mysql;
//MYSQL_RES* result;
mysql_init(&mysql); //初始化MYSQL变量
settextcolor(BLACK);
settextstyle(50, 0, "宋体");//大小+文字体
if (mysql_real_connect(&mysql, host, "root", "MCmhls357753", "neice", port, NULL, 0) == NULL) //连接到mysql
{
settextcolor(RED);
outtextxy(130, 260, "MySQL连接失败");
getchar();
exit(3);
}
else
{
outtextxy(100, 260, "正在访问数据库...");
Sleep(500);
cleardevice();
}
if (mysql_query(&mysql, "SELECT * FROM `banben`") != 0) //若查询成功返回0,失败返回随机数,执行查询语句,这里是查询所有,banben是表名
{
settextcolor(RED);
outtextxy(130, 260, "访问数据库失败");
getchar();
exit(3);
}
else
{
outtextxy(100, 260, "访问数据库成功");
Sleep(500);
cleardevice();
}
result = mysql_store_result(&mysql);//将查询到的结果集储存到result中
M_mysql = mysql_fetch_row(result);//将地址转换成数组
m_mysql[0] = M_mysql[0];
if (banben != M_mysql[0])
{
settextcolor(RED);
outtextxy(70, 270, "您的版本过低,请更新!");
getchar();
exit(3);
};
if (result != NULL)
mysql_free_result(result);//释放结果资源
//mysql_close(&mysql);//关闭MySQL连接
//mysql_library_end();//关闭MySQL库
cleardevice();
}
//检测版本
bool M_dlzh()
{
cl:
cleardevice();
int num;
if (mysql_query(&mysql, "set names gbk"))
cout<<mysql_errno(&mysql);
if (zh == "未命名")
{
putimage(0, 0, img);
while (1)
{
if (MouseHit())//鼠标操作
{
MOUSEMSG msg = GetMouseMsg();
if (msg.x > 122 && msg.x < 519 && msg.y>260 && msg.y < 366 && msg.uMsg == WM_LBUTTONDOWN)
{
cleardevice();
char s[100];
while (1)
{
settextstyle(50, 0, "宋体");//大小+文字体
InputBox(s, 100, "请输入账号");
zh = s;
if (zh.size() == 0)
{
outtextxy(170, 250, "账号不能为空");
Sleep(500);
}
else
break;
}
cleardevice();
while (1)
{
InputBox(s, 100, "请输入密码");
mm = s;
if (mm.size() == 0)
{
outtextxy(220, 250, "密码不能为空");
Sleep(500);
}
else
break;
}
settextstyle(25, 0, "宋体");//大小+文字体
goto dl;
}
if (msg.x > 58 && msg.x < 588 && msg.y>466 && msg.y < 576 && msg.uMsg == WM_LBUTTONDOWN)
{
cleardevice();
char s[100];
while (1)
{
InputBox(s, 100, "请输入账号");
zh = s;
if (zh.size() == 0)
{
outtextxy(220, 250, "账号不能为空");
Sleep(500);
}
else
break;
}
cleardevice();
while (1)
{
InputBox(s, 100, "请输入密码");
mm = s;
if (mm.size() == 0)
{
outtextxy(220, 250, "密码不能为空");
Sleep(500);
}
else
break;
}
cleardevice();
while (1)
{
InputBox(s, 100, "请输入名称");
nc = s;
if (nc.size() == 0)
{
outtextxy(220, 250, "名称不能为空");
Sleep(500);
}
else
break;
}
goto zc;
}
}
}
zc:
if (mysql_query(&mysql, "select * from rs") != 0)
{
outtextxy(150, 250, "访问数据库失败");
getchar();
exit(0);
}
result = mysql_store_result(&mysql);//将查询到的结果集储存到result中
M_mysql = mysql_fetch_row(result);//将地址转换成数组
string dm = M_mysql[0];
string dm2;
stringstream M_stre;
int M_int;
M_stre << dm;
M_stre >> M_int;
M_int = M_int + 1;
stringstream M_stre2;
M_stre2 << M_int;
M_stre2 >> dm2;
string M_str = "insert into wanjia(`账号`,`密码`,`名称`,`代码`) values ('";
M_str.append(zh);
M_str.append("','");
M_str.append(mm);
M_str.append("','");
M_str.append(nc);
M_str.append("','");
M_str.append(dm);
M_str.append("')");
if (mysql_query(&mysql, M_str.c_str()) != 0)
{
outtextxy(150, 250, "MySQL存储失败");
getchar();
exit(3);
}
M_str = "update rs set `人数`='";
M_str.append(dm2);
M_str.append("'where `人数`='");
M_str.append(dm);
M_str.append("'");
if (mysql_query(&mysql, M_str.c_str()) != 0)
{
outtextxy(150, 250, "MySQL存储失败");
getchar();
exit(3);
}
mysql_close(&mysql);//关闭MySQL连接
mysql_library_end();//关闭MySQL库
return 1;
}
else
{
dl:
if (mysql_query(&mysql, "select * from `wanjia`") != 0)
{
outtextxy(150, 250, "访问数据库失败");
getchar();
exit(3);
}
result = mysql_store_result(&mysql);
while (1)
{
if ((M_mysql = mysql_fetch_row(result)) == NULL)
{
settextstyle(50, 0, "宋体");//大小+文字体
outtextxy(90, 250, "账号或密码输入错误");
settextstyle(25, 0, "宋体");//大小+文字体
Sleep(700);
zh = "未命名";
goto cl;
}
num = mysql_num_fields(result);
for (int i = 0; i < num; i++)
{
if (M_mysql[i] == zh && M_mysql[i + 1] == mm)
{
nc = M_mysql[i + 2];
return 1;
}
}
}
}
}
//登录账号
void liaotians()
{
MYSQL_ROW M_mysql;
MYSQL_RES* result = 0;
MYSQL mysql2;
mysql_init(&mysql2);
mysql_real_connect(&mysql2, host, "root", "MCmhls357753", "neice", port, NULL, 0);
mysql_query(&mysql2, "SET NAMES GBK");
BeginBatchDraw();//设置缓冲区
while (1)
{
cl:
if (xw_[0] == 'T' && xw_[1] == 'D')
break;
cleardevice();
mysql_query(&mysql2, "select * from liaotian");
do
{
result = mysql_store_result(&mysql2);
mysql_free_result(result);
} while (!mysql_next_result(&mysql2));
if (result == NULL)
goto cl;
M_mysql = mysql_fetch_row(result);//将地址转换成数组
for (int i = 0; i < 5; i++)
{
m_mysql[i] = M_mysql[i]/*U2G(M_mysql[i])*/;
char shuchu[1000];
strcpy(shuchu, m_mysql[i].c_str());//用到 c_str()函数
outtextxy(0, i * 64, shuchu);
}
FlushBatchDraw();//绘制缓冲区
// Sleep(500);
}
EndBatchDraw();//关闭缓冲区
mysql_close(&mysql2);
// mysql_library_end();
}
int liaotian()
{
xw_[0] = 'a';
//mysql_free_result(result);
mysql_init(&mysql);
mysql_real_connect(&mysql, host, "root", "MCmhls357753", "neice", port, NULL, 0);
mysql_query(&mysql, "SET NAMES GBK");
//if (mysql_query(&mysql, "select * from liaotian") != 0) //连接到mysql
//{
// cout << "\n\t-----MySQL查询失败----" << mysql_error(&mysql)<<endl;
// return 1;
//}
//if (result != NULL)
// mysql_free_result(result);//释放结果资源
// mysql_store_result(&mysql);
// mysql_free_result(result);
thread liaotians_(liaotians);
while (1)
{
InputBox(xw_, 1000, "请输入要发送的消息(输入 TD 即可退出)");
if (xw_[0] == 'T' && xw_[1] == 'D')
goto gb;
mysql_query(&mysql, "update liaotian set `存储` = '0' where `存储` = '1'");
string M_str = "update liaotian set `yi` = '" + m_mysql[1] + "' where `存储` = '0'";
mysql_query(&mysql, M_str.c_str());
cout << mysql_error(&mysql);
M_str = "update liaotian set `er` = '" + m_mysql[2] + "' where `存储` = '0'";
mysql_query(&mysql, M_str.c_str());
M_str = "update liaotian set `san` = '" + m_mysql[3] + "' where `存储` = '0'";
mysql_query(&mysql, M_str.c_str());
M_str = "update liaotian set `si` = '" + m_mysql[4] + "' where `存储` = '0'";
mysql_query(&mysql, M_str.c_str());
M_str = "update liaotian set `wu` = '" + nc + ":" + xw_ + "' where `存储` = '0'";
mysql_query(&mysql, M_str.c_str());
mysql_query(&mysql, "update liaotian set `存储` = '1' where `存储` = '0'");
//string M_str = "insert into liaotian(yi,er,san,si,wu) values ('" + m_mysql[1] + "','" + m_mysql[2] + "','" + m_mysql[3] + "','" + m_mysql[4] + "','" + nc + ":" + xw_ + "')";
//mysql_query(&mysql, M_str.c_str());
//M_str = "DELETE FROM liaotian WHERE yi='" + m_mysql[0] + "'";
//mysql_query(&mysql, M_str.c_str());
}
gb:
liaotians_.join();
return 0;
}
void wrighttxt()//退出
{
ofstream OutFile("内测服存档.txt");
OutFile << banben;
OutFile << "\n" << qianbi;
OutFile << "\n" << nl;
OutFile << "\n" << h;
OutFile << "\n" << sh;
OutFile << "\n" << ditu.cdt;
OutFile << "\n" << ditu.dtnl<<"\n";
for (int i = 1; i <= 4; i++)
{
for (int j = 1; j <= 5; j++)
{
OutFile << bag[i][j].dx << ' ';
}
OutFile << '\n';
}
for (int i = 1; i <= 4; i++)
{
for (int j = 1; j <= 5; j++)
{
OutFile << bag[i][j].sl << ' ';
}
OutFile << '\n';
}
ofstream OutFile1("账号.txt");
OutFile1 << zh;
OutFile1 << "\n" << mm;
}
//写入存档
bool CZPLAYER()
{
for (player_y = 0; player_y <= 35; player_y++)
for (player_x = 0; player_x <= 35; player_x++)
{
if (Map[player_y][player_x].lei == PLAYER)
{
// cout << player_y << ' ' << player_x << '\n';
return 0;
}
if (Map[player_y][player_x].lei == PLAYER + JX)
{
Map[player_y][player_x].lei = JX;
return 1;
}
}
}
//寻找玩家坐标(x,y)
void scdt(int jz)
{
for (int i = 3; i < 33; i++)
for (int j = 3; j < 33; j++)
Map[i][j].lei = JX;
for (int i = 4; i < 32; i++)
for (int j = 4; j < 32; j++)
Map[i][j].lei = SPACE;
srand(time(NULL));
if (jz == 0)
{
int zombie_sl = 10, stone_sl = 15, terr_ds_sl = 60, stone_ds_sl = 60;;
for (int i = 0; zombie_sl > 0; i++)
{
int x = rand() % 30 + 3, y = rand() % 30 + 3;
if (Map[x][y].lei == SPACE)
{
zombie_sl--;
Map[x][y].lei = ZOMBIE;
Map[x][y].zom_xl = 40;
Map[x][y].zom_zl = PTZOMBIE;
}
}
for (int i = 0; stone_sl > 0; i++)
{
int x = rand() % 30 + 3, y = rand() % 30 + 3;
if (Map[x][y].lei == SPACE)
{
stone_sl--;
Map[x][y].lei = STONE;
}
}
for (int i = 0; terr_ds_sl > 0; i++)
{
int x = rand() % 30 + 3, y = rand() % 30 + 3;
if (Map[x][y].lei == SPACE)
{
terr_ds_sl--;
Map[x][y].lei = TERR_DS;
}
}
for (int i = 0; stone_ds_sl > 0; i++)
{
int x = rand() % 30 + 3, y = rand() % 30 + 3;
if (Map[x][y].lei == SPACE)
{
stone_ds_sl--;
Map[x][y].lei = STONE_DS;
}
}
//for (int i = 22; i < 69; i++)
//{
// for (int j = 22; j < 69; j++)
// {
// if (i != 23 || j != 23 || i != 68 || j != 68)
// {
// int sj = rand() % 5 + 0;
// cout << sj << '\n';
// if (sj == 0 || sj == 1)
// {
// Map[i][j][1].lei = SPACE;
// }
// else if (sj == 2 && stone_sl > 0)
// {
// stone_sl--;
// Map[i][j][1].lei = STONE;
// }
// else if (sj == 3 && zombie_sl > 0)
// {
// zombie_sl--;
// Map[i][j][1].lei = ZOMBIE;
// Map[i][j][1].zom_xl = 40;
// }
// else if (sj == 4)
// {
// Map[i][j][1].lei = TERR_DS;
// }
// }
// }
//}
}
}
//生成地图
void SCXL(int cc)
{
if (cc == 0)
{
setfillcolor(GREEN);//设置填充颜色
char cha[100];
strcpy(cha, nc.c_str());//转换
settextstyle(25, 0, "宋体");//大小+文字体
outtextxy(0, 0, cha);//输出名字
settextcolor(GREEN);
snprintf(cha, sizeof(cha), "%d", xl);
outtextxy(260, 0, cha);//输出血量
solidrectangle(0, 25, xl*3, 44);//输出血量条
setfillcolor(RGB(123, 126, 105));//设置填充颜色
solidrectangle(xl*3, 25, 300, 44);
settextstyle(50, 0, "宋体");//大小+文字体
setfillcolor(WHITE);//设置填充颜色
/*putimage(0, 50, img + 2);
snprintf(qianbi_cha, sizeof(qianbi_cha), "%d", qianbi);
outtextxy(80, 60, qianbi_cha);*/
}
else if(cc==1)
{
setfillcolor(YELLOW);//设置填充颜色
settextstyle(30, 0, "宋体");//大小+文字体
outtextxy(0, 15, "能量");
solidrectangle(60, 25, nl*4+60, 44);//输出能量条
setfillcolor(RGB(123, 126, 105));//设置填充颜色
solidrectangle(nl*4+60, 25, 460, 44);
char cha[100];
snprintf(cha, sizeof(cha), "%d", nl);
outtextxy(460, 0, cha);//输出能量
settextcolor(BLACK);
settextstyle(50, 0, "宋体");//大小+文字体
if (h > 19 || h < 5)
outtextxy(540, 10, "晚上");
else if (h > 5 || h < 12)
outtextxy(540, 10, "早上");
else if (h > 12 || h < 19)
outtextxy(540, 10, "中午");
putimage(0, 50, img + 2);
snprintf(qianbi_cha, sizeof(qianbi_cha), "%d", qianbi);
outtextxy(80, 60, qianbi_cha);
}
settextstyle(25, 0, "宋体");//大小+文字体
settextcolor(BLACK);
return;
}
//输出血量/能量
void HZDT()
{
char cha[100];
for (int i = player_y - 5, y = 0; i <= player_y + 5; i++, y++)
{
for (int j = player_x - 5, x = 0; j <= player_x + 5; j++, x++)
{
setfillcolor(WHITE);//设置填充颜色
settextstyle(25, 0, "宋体");//大小+文字体
switch (Map[i][j].lei)
{
case SPACE:
putimage(x * 64, y * 64, img_map_zom + SPACE);
break;
case PLAYER:
putimage(x * 64, y * 64, img_map_zom + PLAYER);
break;
case ZOMBIE:
if (Map[i][j].zom_zl == PTZOMBIE)
{
setfillcolor(RED);//设置填充颜色
settextstyle(15, 0, "宋体");//大小+文字体
putimage(x * 64, y * 64, img_map_zom + PTZOMBIE + ZOMBIE);
snprintf(cha, sizeof(cha), "%d", Map[i][j].zom_xl);
outtextxy(x * 64, y * 64, cha);//输出血量
solidrectangle(x * 64, y * 64 - 15, Map[i][j].zom_xl + x * 68, y * 64 - 10);//输出血量条
}
break;
case STONE:
putimage(x * 64, y * 64, img_map_zom + STONE);
break;
case TERR_DS:
putimage(x * 64, y * 64, img_map_zom + TERR_DS);
break;
case STONE_DS:
putimage(x * 64, y * 64, img_map_zom + STONE_DS);
break;
case JX:
outtextxy(x * 64, y * 64, "界限");
break;
case home_jieshuchu:
putimage(x * 64, y * 64, img_home + 0);
break;
case home_luzi:
putimage(x * 64, y * 64, img_home + 1);
break;
}
}
}
if (bag_ml != 0)//输出“背包满了”
{
outtextxy(458, 440, "背包格子已满");
bag_ml--;
}
SCXL(0);//输出血量
}
//输出地图
void bag_()
{
char cha[100];
MOUSEMSG msg;
while (1)
{
setbkcolor(RGB(65, 58, 48));
settextcolor(WHITE);
setfillcolor(GREEN);//设置填充颜色
setbkmode(GREEN);
cleardevice();
putimage(530, 0, img_bag_xs + 3);//关闭
putimage(0, 0, img_bag_xs + 9);//物品栏
putimage(0, 90, img_bag_xs + 4);//口袋
putimage(70, 430, img_bag_xs + 7);//使用
putimage(190, 430, img_bag_xs);//分开
putimage(310, 430, img_bag_xs + 5);//删除
putimage(350, 180, img_bag_xs + 12);//正手
putimage(350, 290, img_bag_xs + 2);//副手
putimage(500, 180, img_bag_xs + 14);//装备_头
putimage(500, 241, img_bag_xs + 16);//装备_胸
putimage(500, 308, img_bag_xs + 13);//装备_裤
putimage(500, 368, img_bag_xs + 15);//装备_鞋
for (int i = 1; i <= 4; i++)
{
for (int j = 1; j <= 5; j++)
{
switch (bag[i][j].dx)
{
case SPACE:
putimage(i * 64 + 7, j * 64 + 30, img_bag + SPACE);
break;
case MUTOU:
putimage(i * 64 + 7, j * 64 + 30, img_bag + MUTOU);
sprintf(cha, "%d", bag[i][j].sl);
outtextxy(i * 64 + 7, j * 64 + 30, cha);
break;
}
}
}
strcpy(cha, nc.c_str());//转换
settextstyle(25, 0, "宋体");//大小+文字体
outtextxy(350, 110, cha);
snprintf(cha, sizeof(cha), "%d", xl);
outtextxy(510, 110, cha);//输出血量
solidrectangle(350, 142, xl * 2 + 350, 162);//输出血量条
FlushBatchDraw();//绘制缓冲区'
msg = GetMouseMsg();
if (msg.y >= 22 && msg.y <= 103 && msg.x >= 588 && msg.x <= 640 && msg.uMsg == WM_LBUTTONDOWN)
break;
if (_kbhit())
{
anjian = _getch();
if (anjian == 'e' || anjian == 'E')
break;
}
}
setfillcolor(WHITE);//设置填充颜色
setbkmode(WHITE);
settextcolor(BLACK);//文字颜色
setbkcolor(WHITE);
anjian = '1';
return;
}
//背包改动
void HQWP()
{
if (Map[player_y + 1][player_x].lei == TERR_DS || Map[player_y - 1][player_x].lei == TERR_DS || Map[player_y][player_x + 1].lei == TERR_DS || Map[player_y][player_x - 1].lei == TERR_DS)
{
for (int i = 1; i <= 4; i++)
{
for (int j = 1; j <= 4; j++)
{
if (bag[j][i].dx == MUTOU && bag[j][i].sl < 20)
{
bag[j][i].sl++;
if (Map[player_y + 1][player_x].lei == TERR_DS)
Map[player_y + 1][player_x].lei = SPACE;
else if (Map[player_y - 1][player_x].lei == TERR_DS)
Map[player_y - 1][player_x].lei = SPACE;
else if (Map[player_y][player_x + 1].lei == TERR_DS)
Map[player_y][player_x + 1].lei = SPACE;
else if (Map[player_y][player_x - 1].lei == TERR_DS)
Map[player_y][player_x - 1].lei = SPACE;
this_thread::sleep_for(chrono::milliseconds(400));
return;
}
}
}
if (bag_sl > 0)
{
for (int i = 1; i <= 4; i++)
{
for (int j = 1; j <= 4; j++)
{
if (bag[j][i].dx == SPACE)
{
bag[j][i].dx = MUTOU;
bag[j][i].sl++;
bag_sl--;
goto end;
}
}
}
end:
if (Map[player_y + 1][player_x].lei == TERR_DS)
Map[player_y + 1][player_x].lei = SPACE;
else if (Map[player_y - 1][player_x].lei == TERR_DS)
Map[player_y - 1][player_x].lei = SPACE;
else if (Map[player_y][player_x + 1].lei