Magic complexity header tweaks
Novice=0, Advanced=2, so we can test "complexity >= SOME_LEVEL" if a tool works in both Beginner and Advanced modes (vs. "<=" which seemed backwards). Add some print-able string names for the complexity levels. When a Magic plugin fails to init (e.g., now the Clone tool does, in "novice" mode), show the message as "Notice", not "Error", and helpfully remind us of the complexity level. Provide a "_DEFAULT" #define that tuxpaint.c can use, rather than hard-coding "_ADVANCED", in case things change in the future.
This commit is contained in:
parent
4b2b746d52
commit
972195e38b
2 changed files with 14 additions and 4 deletions
|
|
@ -195,10 +195,20 @@ enum {
|
|||
/* Magic complexity level requested by the user (allowing plugins to simplify) */
|
||||
|
||||
enum {
|
||||
MAGIC_COMPLEXITY_ADVANCED,
|
||||
MAGIC_COMPLEXITY_BEGINNER,
|
||||
MAGIC_COMPLEXITY_NOVICE,
|
||||
MAGIC_COMPLEXITY_BEGINNER,
|
||||
MAGIC_COMPLEXITY_ADVANCED,
|
||||
NUM_MAGIC_COMPLEXITY_LEVELS
|
||||
};
|
||||
|
||||
#define MAGIC_COMPLEXITY_DEFAULT MAGIC_COMPLEXITY_ADVANCED
|
||||
|
||||
char * MAGIC_COMPLEXITY_LEVEL_NAMES[NUM_MAGIC_COMPLEXITY_LEVELS] = {
|
||||
"novice",
|
||||
"beginner",
|
||||
"advanced",
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1543,7 +1543,7 @@ extern char *GetUserImageDir(void);
|
|||
#include "tp_magic_api.h"
|
||||
|
||||
static Uint8 magic_disabled_features = 0x00000000;
|
||||
static Uint8 magic_complexity_level = MAGIC_COMPLEXITY_ADVANCED;
|
||||
static Uint8 magic_complexity_level = MAGIC_COMPLEXITY_DEFAULT;
|
||||
|
||||
static void update_progress_bar(void);
|
||||
static void special_notify(int flags);
|
||||
|
|
@ -21681,7 +21681,7 @@ static void load_magic_plugins(void)
|
|||
|
||||
if (n == 0)
|
||||
{
|
||||
fprintf(stderr, "Error: plugin %s failed to startup or reported 0 magic tools\n", fname);
|
||||
fprintf(stderr, "Notice: plugin %1$s failed to startup or reported 0 magic tools (Tux Paint is in complexity mode \"%2$s\")\n", fname, MAGIC_COMPLEXITY_LEVEL_NAMES[magic_complexity_level]);
|
||||
fflush(stderr);
|
||||
SDL_UnloadObject(magic_handle[num_plugin_files]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue