This commit is contained in:
aozhiwei 2019-07-03 18:03:07 +08:00
parent cbb78fed41
commit ec506459b2
3 changed files with 13 additions and 5 deletions

View File

@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 2.8)
set(GAME_ID 2002)
set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_BUILD_TYPE "Release")
#set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DA8_TCP_SESSION2=1")
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DA8_TCP_SESSION2=1")

View File

@ -333,16 +333,25 @@ void Room::CreateThings()
std::vector<MetaData::MapTplThing>* things = MetaMgr::Instance()->GetMapTplThing(map_tpl_name);
if (things) {
for (auto& thing_tpl : *things) {
if (thing_tpl.i->is_born_point()) {
continue;
}
if (thing_tpl.i->weight() >= rand() % 10000) {
int thing_id = thing_tpl.RandThing();
MetaData::MapThing* thing_meta = MetaMgr::Instance()->GetMapThing(thing_id);
#if 0
assert(thing_meta);
#endif
if (thing_meta) {
#if 1
CreateObstacle(thing_id, thing_tpl.i->x(), thing_tpl.i->y());
#else
if (thing_meta->i->is_house()) {
CreateBuilding(thing_id, thing_tpl.i->x(), thing_tpl.i->y());
} else {
CreateObstacle(thing_id, thing_tpl.i->x(), thing_tpl.i->y());
}
#endif
}
}
}
@ -369,6 +378,7 @@ void Room::DropItem(a8::Vec2 pos, int item_id, int item_count, int item_lv)
void Room::CreateBuilding(int thing_id, float building_x, float building_y)
{
#if 0
MetaData::MapThing* thing_meta = MetaMgr::Instance()->GetMapThing(thing_id);
if (!thing_meta) {
return;
@ -431,6 +441,7 @@ void Room::CreateBuilding(int thing_id, float building_x, float building_y)
);
}
}
#endif
}
Obstacle* Room::CreateObstacle(int id, float x, float y)

View File

@ -30,10 +30,6 @@ message MapThing
optional float damage_dia = 7; //
optional int32 drop = 8; //
optional int32 attack_type = 9; // 0: 1 2穿
optional int32 is_door = 10; //
optional int32 is_house = 11; //
optional int32 is_tree = 12; //
optional int32 house_id = 13; //id
}
message SafeArea
@ -229,4 +225,5 @@ message MapTplThingJson
optional int32 weight = 4;
optional float x = 5;
optional float y = 6;
optional int32 is_born_point = 7;
}