forked from Mirrors/openclonk
Handle-ify the random seed setting
parent
7f452643aa
commit
b2be39b576
|
@ -565,6 +565,8 @@ set(MAPE_SOURCES
|
|||
src/mape/cpp-handles/mapgen-handle.cpp
|
||||
src/mape/cpp-handles/material-handle.h
|
||||
src/mape/cpp-handles/material-handle.cpp
|
||||
src/mape/cpp-handles/random-handle.h
|
||||
src/mape/cpp-handles/random-handle.cpp
|
||||
src/mape/cpp-handles/texture-handle.h
|
||||
src/mape/cpp-handles/texture-handle.cpp
|
||||
src/mape/configfile.c
|
||||
|
@ -595,7 +597,7 @@ set(MAPE_SOURCES
|
|||
src/mape/preferencesdialog.h
|
||||
src/mape/preview.c
|
||||
src/mape/preview.h
|
||||
src/mape/random.cpp
|
||||
src/mape/random.c
|
||||
src/mape/random.h
|
||||
src/mape/statusbar.c
|
||||
src/mape/statusbar.h
|
||||
|
|
|
@ -15,19 +15,15 @@
|
|||
* See clonk_trademark_license.txt for full license.
|
||||
*/
|
||||
|
||||
#define MAPE_COMPILING_CPP
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <C4Include.h>
|
||||
#include <C4Random.h>
|
||||
|
||||
#include "mape/random.h"
|
||||
#include "C4Include.h"
|
||||
#include "C4Random.h"
|
||||
#include "mape/cpp-handles/random-handle.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
void mape_random_seed(unsigned int seed)
|
||||
void c4_random_handle_seed(unsigned int seed)
|
||||
{
|
||||
FixedRandom(seed);
|
||||
FixedRandom(seed);
|
||||
}
|
||||
|
||||
} // extern "C"
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* mape - C4 Landscape.txt editor
|
||||
*
|
||||
* Copyright (c) 2005-2009 Armin Burgmeier
|
||||
*
|
||||
* Portions might be copyrighted by other authors who have contributed
|
||||
* to OpenClonk.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
* See isc_license.txt for full license and disclaimer.
|
||||
*
|
||||
* "Clonk" is a registered trademark of Matthes Bender.
|
||||
* See clonk_trademark_license.txt for full license.
|
||||
*/
|
||||
|
||||
#ifndef INC_MAPE_C4_RANDOM_HANDLE_H
|
||||
#define INC_MAPE_C4_RANDOM_HANDLE_H
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void c4_random_handle_seed(unsigned int seed);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* INC_MAPE_C4_RANDOM_HANDLE_H */
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* mape - C4 Landscape.txt editor
|
||||
*
|
||||
* Copyright (c) 2005-2009 Armin Burgmeier
|
||||
*
|
||||
* Portions might be copyrighted by other authors who have contributed
|
||||
* to OpenClonk.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
* See isc_license.txt for full license and disclaimer.
|
||||
*
|
||||
* "Clonk" is a registered trademark of Matthes Bender.
|
||||
* See clonk_trademark_license.txt for full license.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:mape-random
|
||||
* @title: MapeRandom
|
||||
* @short_description: Interface to the random number generator
|
||||
* @include: mape/random.h
|
||||
* @stability: Unstable
|
||||
*
|
||||
* These functions provide a simple interface to the random number generator
|
||||
* used for map generation in the Clonk engine.
|
||||
**/
|
||||
|
||||
#include "mape/cpp-handles/random-handle.h"
|
||||
#include "mape/random.h"
|
||||
|
||||
/*
|
||||
* Public API.
|
||||
*/
|
||||
|
||||
/**
|
||||
* mape_random_seed:
|
||||
* @seed: Value to seed the random number generator with.
|
||||
*
|
||||
* Sets the random seed for the Clonk random number generator that is used
|
||||
* when generating a map with C4MapCreatorS2.
|
||||
*/
|
||||
void
|
||||
mape_random_seed(unsigned int seed)
|
||||
{
|
||||
c4_random_handle_seed(seed);
|
||||
}
|
||||
|
||||
/* vim:set et sw=2 ts=2: */
|
|
@ -18,18 +18,14 @@
|
|||
#ifndef INC_MAPE_RANDOM_H
|
||||
#define INC_MAPE_RANDOM_H
|
||||
|
||||
#include "mape/forward.h"
|
||||
#include <glib.h>
|
||||
|
||||
/* Simple C-based interface to C4Random */
|
||||
|
||||
#ifdef MAPE_COMPILING_CPP
|
||||
extern "C" {
|
||||
#endif
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void mape_random_seed(unsigned int seed);
|
||||
|
||||
#ifdef MAPE_COMPILING_CPP
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* INC_MAPE_RANDOM_H */
|
||||
|
||||
/* vim:set et sw=2 ts=2: */
|
||||
|
|
Loading…
Reference in New Issue