forked from github/server
Der Editiermodus für den Mapper (mit 'E').
This commit is contained in:
parent
4859d603c4
commit
0336eb2ff3
|
@ -94,7 +94,7 @@ blockcoord(int x)
|
|||
static char newblock[BLOCKSIZE][BLOCKSIZE];
|
||||
static int g_maxluxuries;
|
||||
|
||||
static void
|
||||
void
|
||||
block_create(int x1, int y1, int size, char chaotisch, int special, char terrain)
|
||||
{
|
||||
int local_climate;
|
||||
|
@ -103,9 +103,9 @@ block_create(int x1, int y1, int size, char chaotisch, int special, char terrain
|
|||
|
||||
vset_init(&fringe);
|
||||
|
||||
x1 = blockcoord(x1);
|
||||
/* x1 = blockcoord(x1);
|
||||
y1 = blockcoord(y1);
|
||||
local_climate = climate(y1);
|
||||
*/ local_climate = climate(y1);
|
||||
|
||||
memset(newblock, T_OCEAN, sizeof newblock);
|
||||
x = BLOCKSIZE / 2;
|
||||
|
@ -198,9 +198,9 @@ block_create(int x1, int y1, int size, char chaotisch, int special, char terrain
|
|||
for (x = 0; x != BLOCKSIZE; x++) {
|
||||
for (y = 0; y != BLOCKSIZE; y++) {
|
||||
const luxury_type * sale = (rand()%2)?p1:p2;
|
||||
r = findregion(x1 + x, y1 + y);
|
||||
if (r) continue;
|
||||
r = new_region(x1 + x, y1 + y);
|
||||
r = findregion(x1 + x - BLOCKSIZE/2, y1 + y - BLOCKSIZE/2);
|
||||
if (r && r->terrain!=T_OCEAN) continue;
|
||||
if (r==NULL) r = new_region(x1 + x - BLOCKSIZE/2, y1 + y - BLOCKSIZE/2);
|
||||
if (chaotisch) fset(r, RF_CHAOTIC);
|
||||
if (special == 1) {
|
||||
terraform(r, terrain);
|
||||
|
@ -1302,7 +1302,8 @@ Create_Island(region *r, int * n, terrain_t t, int x, int y) {
|
|||
}
|
||||
|
||||
void
|
||||
create_island(region *r, int n, terrain_t t) {
|
||||
create_island(region *r, int n, terrain_t t)
|
||||
{
|
||||
int sx=r->x, sy=r->y, i, x = 0, y = 0;
|
||||
direction_t d;
|
||||
boolean abbruch=false;
|
||||
|
|
|
@ -747,6 +747,7 @@ movearound(int rx, int ry) {
|
|||
int hx = -1, hy = -1, ch, x, y, Rand, d, a, b, p, q, oldx=0, oldy=0;
|
||||
int oldrx=0, oldry=0, Hx=0, Hy=0;
|
||||
int sel;
|
||||
static int editmode=0;
|
||||
char *selc;
|
||||
region *c, *r = NULL, *r2;
|
||||
tagregion *tag;
|
||||
|
@ -788,11 +789,28 @@ movearound(int rx, int ry) {
|
|||
} else
|
||||
#endif
|
||||
{
|
||||
int edit=0;
|
||||
ch = getch();
|
||||
unmark(x, y, rx, ry);
|
||||
|
||||
oldx=x; oldy=y; oldrx=rx; oldry=ry;
|
||||
switch (ch) {
|
||||
if (editmode) {
|
||||
if (ch=='E') {
|
||||
editmode=0;
|
||||
edit=1;
|
||||
} else {
|
||||
region * r = findregion(rx, ry);
|
||||
if (r) {
|
||||
int terrai = 0;
|
||||
while (terrai!=MAXTERRAINS && tolower(terrain[terrai].symbol)!=tolower(ch)) ++terrai;
|
||||
if (terrai!=MAXTERRAINS) {
|
||||
edit=1;
|
||||
terraform(r, (terrain_t)terrai);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!edit) switch (ch) {
|
||||
case KEY_HELP:
|
||||
case '?':
|
||||
if (reglist) {
|
||||
|
@ -1048,6 +1066,7 @@ movearound(int rx, int ry) {
|
|||
case 'I':
|
||||
a=map_input(0,0,0,"Wieviele Regionen?",0,500,0);
|
||||
if (a) {
|
||||
/* block_create(rx, ry, a, 0, 0, T_GLACIER); */
|
||||
create_island(r, a, (terrain_t)(rand()%(T_GLACIER)+1));
|
||||
modified=1;
|
||||
}
|
||||
|
@ -1138,10 +1157,9 @@ movearound(int rx, int ry) {
|
|||
}
|
||||
}
|
||||
break;
|
||||
case 'E':
|
||||
clipunit = 0;
|
||||
clipregion = 0;
|
||||
break;
|
||||
case 'E':
|
||||
editmode = !editmode;
|
||||
break;
|
||||
case 'i':
|
||||
case 'r':
|
||||
showregion(r, 1);
|
||||
|
|
|
@ -121,6 +121,7 @@ typedef struct selection {
|
|||
struct selection * do_selection(struct selection * sel, const char * title, void (*perform)(struct selection *, void *), void * data);
|
||||
struct selection ** push_selection(struct selection ** p_sel, char * str, void * payload);
|
||||
void insert_selection(struct selection ** p_sel, struct selection * prev, char * str, void * payload);
|
||||
void block_create(int x1, int y1, int size, char chaotisch, int special, char terrain);
|
||||
|
||||
extern void read_newfactions(const char * filename);
|
||||
extern void read_orders(const char * filename);
|
||||
|
|
Loading…
Reference in New Issue