src/texteff.cpp
branchnoai
changeset 9723 eee46cb39750
parent 9722 ebf0ece7d8f6
child 9724 b39bc69bb2f2
equal deleted inserted replaced
9722:ebf0ece7d8f6 9723:eee46cb39750
     2 
     2 
     3 /** @file texteff.cpp */
     3 /** @file texteff.cpp */
     4 
     4 
     5 #include "stdafx.h"
     5 #include "stdafx.h"
     6 #include "openttd.h"
     6 #include "openttd.h"
     7 #include "functions.h"
     7 #include "tile_cmd.h"
     8 #include "macros.h"
       
     9 #include "strings.h"
       
    10 #include "gfx.h"
       
    11 #include "landscape.h"
     8 #include "landscape.h"
    12 #include "viewport.h"
     9 #include "gfx_func.h"
    13 #include "saveload.h"
    10 #include "saveload.h"
    14 #include "console.h"
    11 #include "console.h"
    15 #include "string.h"
       
    16 #include "variables.h"
    12 #include "variables.h"
    17 #include "table/sprites.h"
    13 #include "table/sprites.h"
    18 #include "blitter/factory.hpp"
    14 #include "blitter/factory.hpp"
    19 #include <stdarg.h> /* va_list */
    15 #include <stdarg.h> /* va_list */
    20 #include "date.h"
       
    21 #include "texteff.hpp"
    16 #include "texteff.hpp"
    22 #include "video/video_driver.hpp"
    17 #include "video/video_driver.hpp"
    23 #include "transparency.h"
    18 #include "transparency.h"
       
    19 #include "strings_func.h"
       
    20 #include "core/alloc_func.hpp"
       
    21 #include "date_func.h"
       
    22 #include "functions.h"
       
    23 #include "viewport_func.h"
    24 
    24 
    25 enum {
    25 enum {
    26 	MAX_TEXTMESSAGE_LENGTH = 200,
    26 	MAX_TEXTMESSAGE_LENGTH = 200,
    27 	INIT_NUM_TEXT_MESSAGES =  20,
    27 	INIT_NUM_TEXT_MESSAGES =  20,
    28 	MAX_CHAT_MESSAGES      =  10,
    28 	MAX_CHAT_MESSAGES      =  10,
    56 static bool _chatmessage_dirty = false;
    56 static bool _chatmessage_dirty = false;
    57 static bool _chatmessage_visible = false;
    57 static bool _chatmessage_visible = false;
    58 
    58 
    59 /* The chatbox grows from the bottom so the coordinates are pixels from
    59 /* The chatbox grows from the bottom so the coordinates are pixels from
    60  * the left and pixels from the bottom. The height is the maximum height */
    60  * the left and pixels from the bottom. The height is the maximum height */
    61 static const Oblong _chatmsg_box = {10, 30, 500, 150};
    61 static const PointDimension _chatmsg_box = {10, 30, 500, 150};
    62 static uint8 _chatmessage_backup[150 * 500 * 6]; // (height * width)
    62 static uint8 _chatmessage_backup[150 * 500 * 6]; // (height * width)
    63 
    63 
    64 static inline uint GetChatMessageCount()
    64 static inline uint GetChatMessageCount()
    65 {
    65 {
    66 	uint i;
    66 	uint i;
   290 	}
   290 	}
   291 
   291 
   292 	/* If there is none found, we grow the array */
   292 	/* If there is none found, we grow the array */
   293 	if (i == _num_text_effects) {
   293 	if (i == _num_text_effects) {
   294 		_num_text_effects += 25;
   294 		_num_text_effects += 25;
   295 		_text_effect_list = (TextEffect*) realloc(_text_effect_list, _num_text_effects * sizeof(TextEffect));
   295 		_text_effect_list = ReallocT<TextEffect>(_text_effect_list, _num_text_effects);
   296 		for (; i < _num_text_effects; i++) _text_effect_list[i].string_id = INVALID_STRING_ID;
   296 		for (; i < _num_text_effects; i++) _text_effect_list[i].string_id = INVALID_STRING_ID;
   297 		i = _num_text_effects - 1;
   297 		i = _num_text_effects - 1;
   298 	}
   298 	}
   299 
   299 
   300 	te = &_text_effect_list[i];
   300 	te = &_text_effect_list[i];