view libmaputils.h @ 1783:fe17380576ac

Remove unused function from the lib.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 29 Oct 2017 03:08:49 +0200
parents 7c254d090221
children 79dd960610cb
line wrap: on
line source

/*
 * maputils - Generic functions/tables for maputils package
 * Programmed by Matti 'ccr' Hämäläinen (Ggr Pupunen)
 * (C) Copyright 2006-2017 Tecnic Software productions (TNSP)
 */
#ifndef LIBMAPUTILS_H
#define LIBMAPUTILS_H

#include "libutil.h"
#include <stdio.h>
#include <stdarg.h>


/* Map diff format header and version
 */
#define DIFF_MAGIC      "MAPDIFF"
#define DIFF_VERSION    2

#define BLOCK_SCAN_ALIGN	8

/* Typedefs
 */
typedef struct
{
    char symbol;
    char *desc;
    int  r, g, b;
    int  color;
    char oldSymbol;
} MapPiece;


typedef struct
{
    unsigned char *data;
    int width, height, scansize, size;
    int x, y;
    BOOL mark;
} MapBlock;


typedef struct
{
    int r, g, b;
    int ansi;
    int ansiAttr;
    BOOL bold;
} MapColor;


enum
{
    ANSI_OFF           = 0,
    ANSI_BOLD          = 1,
    ANSI_UNDERSCORE    = 4,
    ANSI_BLINK         = 5,
    ANSI_REVERSE       = 7,
    ANSI_CONCEALED     = 8
};


enum
{
    col_black = 0,
    col_blue,
    col_red,
    col_yellow,
    col_green,
    col_white,
    col_cyan,
    col_magenta,

    col_light_black,
    col_light_blue,
    col_light_red,
    col_light_yellow,
    col_light_green,
    col_light_white,
    col_light_cyan,
    col_light_magenta,

    col_very_light_red,
};


/* Some global tables
 */
extern const MapColor mapColors[];
extern const int nmapColors;

extern const MapPiece mapPieces[];
extern const int nmapPieces;


/* Misc functions
 */
int         fputse(const char *str, FILE *outFile);
int         fprintve(FILE *outFile, const char *fmt, va_list ap);
int         fprintfe(FILE *outFile, const char *fmt, ...);

int         fprintvesc1(FILE *outFile, const char *fmt, va_list ap);
int         fprintfesc1(FILE *outFile, const char *fmt, ...);
int         fputsesc1(const char *str, FILE *f);
int         fputsesc2(const char *str, FILE *f);
int         fputsesc3(const char *str, FILE *f);

int         muGetMapPieceIndex(int symbol, BOOL getOld, BOOL getCity);
int         muGetMapPieceColor(int symbol, BOOL getOld, BOOL getCity);
void        muPrintHTMLhead(FILE *outFile, const char *title, BOOL html5);
void        muPrintHTMLcolors(FILE *outFile, const char *tagName, const char *propName, const char *extra);
char *      muColorToCSSColor(char *buf, const size_t len, const int c);
int         muCopyFileToStream(FILE *outFile, const char *filename);


/* Mapblock handling
 */
MapBlock *  mapBlockAlloc(int width, int height);
MapBlock *  mapBlockCopy(const MapBlock *block);
void        mapBlockFree(MapBlock *block);
MapBlock *  mapBlockParseStream(const char *filename, FILE *fh, BOOL isDiff);
MapBlock *  mapBlockParseFile(const char *filename, BOOL isDiff);
void        mapBlockPrint(FILE *fh, const MapBlock *block);
int         mapBlockPutDo(MapBlock *map, const MapBlock *src, const int ox, const int oy);
int         mapBlockPut(MapBlock **pmap, const MapBlock *src, const int ox, const int oy);
void        mapBlockClean(MapBlock *block, const char *symbols);
void        mapBlockPrintRaw(FILE *fh, const MapBlock *block);


#endif