_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

edmap.cpp File Reference
#include <chrono>
#include <random>
#include <cmath>
#include "stratagus.h"
#include "editor.h"
#include "map.h"
#include "tileset.h"
#include "ui.h"
#include "player.h"
#include "unit.h"
#include "unit_manager.h"
#include "unittype.h"

Functions

edmap.cpp - Editor map functions.
static void EditorChangeSurrounding (const Vec2i &pos, const Vec2i &lock_pos)
 Callback for changed tile (with locked position) More...
 
void ChangeTile (const Vec2i &pos, int tile)
 
static unsigned QuadFromTile (const Vec2i &pos)
 
void EditorChangeTile (const Vec2i &pos, int tileIndex, const Vec2i &lock_pos, bool changeSurroundings)
 
void EditorTileChanged (const Vec2i &pos)
 Update surroundings for tile changes. More...
 
static void TileFill (const Vec2i &pos, int tile, int size)
 
static std::mt19937 MersenneTwister (std::chrono::steady_clock::now().time_since_epoch().count())
 
static int rng ()
 
static void EditorRandomizeTile (int tile, int count, int max_size)
 
static void EditorRandomizeUnit (const char *unit_type, int count, int value, int tileIndexUnderUnit)
 
static void EditorDestroyAllUnits ()
 
static void RandomizeTransition (int x, int y)
 

Function Documentation

◆ ChangeTile()

void ChangeTile ( const Vec2i pos,
int  tile 
)

Change tile from abstract tile-type.

Parameters
posmap tile coordinate.
tiletile type to edit.
Note
this is a rather dumb function, doesn't do any tile fixing.

◆ EditorChangeSurrounding()

static void EditorChangeSurrounding ( const Vec2i pos,
const Vec2i lock_pos 
)
static

Callback for changed tile (with locked position)

Update surroundings for tile changes.

Parameters
posMap tile position of change.
lock_posOriginal change position, that should not be altered.

◆ EditorChangeTile()

void EditorChangeTile ( const Vec2i pos,
int  tileIndex,
const Vec2i lock_pos,
bool  changeSurroundings 
)

Editor change tile.

Parameters
posmap tile coordinate.
tileIndexTile type to edit.
lock_posmap tile coordinate, that should not be changed in callback.

◆ EditorDestroyAllUnits()

static void EditorDestroyAllUnits ( )
static

Destroy all units

◆ EditorRandomizeTile()

static void EditorRandomizeTile ( int  tile,
int  count,
int  max_size 
)
static

Randomize tiles and fill in map

Parameters
tiletile number to use
countnumber of times to apply randomization
max_sizemaximum size of the fill rectangle

◆ EditorRandomizeUnit()

static void EditorRandomizeUnit ( const char *  unit_type,
int  count,
int  value,
int  tileIndexUnderUnit 
)
static

Add a unit to random locations on the map, unit will be neutral

Parameters
unit_typeunit type to add to map as a character string
countthe number of times to add the unit
valueresources to be stored in that unit

◆ EditorTileChanged()

void EditorTileChanged ( const Vec2i pos)

Update surroundings for tile changes.

Update surroundings for tile changes.

Parameters
posMap tile position of change.

◆ MersenneTwister()

static std::mt19937 MersenneTwister ( std::chrono::steady_clock::now().time_since_epoch().count()  )
static

◆ QuadFromTile()

static unsigned QuadFromTile ( const Vec2i pos)
static

Get quad from tile.

A quad is a 32 bit value defining the content of the tile.

A tile is split into 4 parts, the basic tile type of this part is stored as 8bit value in the quad.

ab cd -> abcd

◆ RandomizeTransition()

static void RandomizeTransition ( int  x,
int  y 
)
static

◆ rng()

static int rng ( )
static

◆ TileFill()

static void TileFill ( const Vec2i pos,
int  tile,
int  size 
)
static

Make random map FIXME: vladi: we should have parameters control here... TileFill

Parameters
posmap tile coordinate for area center.
tileTile type to edit.
sizeSize of surrounding rectangle.

TileFill(centerx, centery, tile_type_water, map_width) will fill map with water...

(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.