mirror of
https://github.com/ApfelTeeSaft/PlanetFleet.git
synced 2026-08-26 19:33:38 +00:00
creating civilian player when creating the map
fixed map file copy error
This commit is contained in:
@@ -477,6 +477,8 @@ namespace battleship{
|
||||
}
|
||||
|
||||
void Map::preprareScene(bool empty){
|
||||
Game::getSingleton()->setCivilianPlayer(new Player(0, 0, 0, .5 * Vector3::VEC_IJK));
|
||||
|
||||
Root *root = Root::getSingleton();
|
||||
Node *rootNode = root->getRootNode();
|
||||
string libPath = root->getLibPath();
|
||||
@@ -579,9 +581,11 @@ namespace battleship{
|
||||
loadTerrainObject(i);
|
||||
}
|
||||
|
||||
void Map::create(string mapName){
|
||||
void Map::create(string mapName, Vector3 mapSize){
|
||||
this->mapName = mapName;
|
||||
addSpawnPoint(Vector3::VEC_ZERO);
|
||||
this->mapSize = mapSize;
|
||||
|
||||
//addSpawnPoint(Vector3::VEC_ZERO);
|
||||
preprareScene(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace battleship{
|
||||
static std::vector<Edge> generateAdjacentNodeEdges(int, int, int, int, int);
|
||||
void update();
|
||||
void load(std::string);
|
||||
void create(std::string);
|
||||
void create(std::string, vb01::Vector3);
|
||||
void unload();
|
||||
std::vector<vb01::RayCaster::CollisionResult> raycastTerrain(vb01::Vector3, vb01::Vector3, bool);
|
||||
int getCellId(vb01::Vector3, bool = true);
|
||||
|
||||
@@ -59,8 +59,7 @@ namespace battleship{
|
||||
|
||||
if(newMap){
|
||||
game->addPlayer(new Player(0, 0, 0, Vector3(1, 1, 1)));
|
||||
map->setMapSize(Vector3(size.x, 0, size.y));
|
||||
map->create(name);
|
||||
map->create(name, Vector3(size.x, 0, size.y));
|
||||
generatePlane(size);
|
||||
}
|
||||
else{
|
||||
@@ -583,7 +582,7 @@ namespace battleship{
|
||||
string assetsPath = GameManager::getSingleton()->getPath();
|
||||
string mapFolder = assetsPath + "Models/Maps/" + map->getMapName() + "/";
|
||||
create_directory(mapFolder);
|
||||
copy_file(assetsPath + DEFAULT_TEXTURE, mapFolder + map->getMapName() + ".jpg");
|
||||
copy_file(assetsPath + DEFAULT_TEXTURE, mapFolder + map->getMapName() + ".jpg", filesystem::copy_options::overwrite_existing);
|
||||
|
||||
vector<Map::Cell> cells = generateMapCells();
|
||||
generateLandmassXml();
|
||||
|
||||
@@ -66,8 +66,6 @@ namespace battleship{
|
||||
string name = (cpuPlayer ? "CPU player #" + to_string(i) : "Player");
|
||||
game->addPlayer(new Player(difficulty, faction, team, color, cpuPlayer, i, name));
|
||||
}
|
||||
|
||||
game->setCivilianPlayer(new Player(0, 0, 0, .5 * Vector3::VEC_IJK));
|
||||
|
||||
handleLoadingGui(new LoadingAppState(new InGameAppState(mapName), "inGame.lua"));
|
||||
}
|
||||
|
||||
@@ -513,15 +513,18 @@ namespace battleship{
|
||||
|
||||
//TODO select only the closest cells based on unit size
|
||||
void Unit::placeAt(Vector3 p){
|
||||
//check twice in case the unit is warped over a long distance
|
||||
Map::getSingleton()->blockCells(this);
|
||||
GameObject::placeAt(p);
|
||||
Map::getSingleton()->blockCells(this);
|
||||
|
||||
ActiveGameState *activeState = (ActiveGameState*)GameManager::getSingleton()->getStateManager()->getAppStateByType(AppStateType::ACTIVE_STATE);
|
||||
|
||||
if(activeState && activeState->getPlayer())
|
||||
Map::Minimap::getSingleton()->updateImage();
|
||||
//check twice in case the unit is warped over a long distance
|
||||
if(activeState) Map::getSingleton()->blockCells(this);
|
||||
GameObject::placeAt(p);
|
||||
|
||||
if(activeState){
|
||||
Map::getSingleton()->blockCells(this);
|
||||
|
||||
if(activeState->getPlayer())
|
||||
Map::Minimap::getSingleton()->updateImage();
|
||||
}
|
||||
}
|
||||
|
||||
vector<Player*> Unit::getSelectingPlayers(){
|
||||
|
||||
Reference in New Issue
Block a user