<commit_before>#ifndef MAP_H
#define MAP_H

#include "datastructures.h"
#include "ingameelements/movingentity.h"
#include "ingameelements/character.h"

#include <allegro5/allegro.h>
#include <string>

class Map
{
    public:
        Map(std::string name);
        ~Map();
        void renderbackground(double cam_x, double cam_y);
        void renderwallground(double cam_x, double cam_y);
        bool collides(Gamestate *state, MovingEntity *entity);
        bool collides(Gamestate *state, Character *entity);
        bool collides(Rect rect);
        bool collides(double rotx, double roty, Rect rect, double angle);
        bool collideline(double x1, double y1, double x2, double y2);
        bool testpixel(double x, double y) {return al_get_pixel(wallmask, x, y).a != 0;}
    protected:
    private:
        ALLEGRO_BITMAP *background;
        ALLEGRO_BITMAP *wallground;
        ALLEGRO_BITMAP *wallmask;
};

#endif // MAP_H<commit_msg>Added out of bounds check for map testpixel.<commit_after>#ifndef MAP_H
#define MAP_H

#include "datastructures.h"
#include "ingameelements/movingentity.h"
#include "ingameelements/character.h"

#include <allegro5/allegro.h>
#include <string>

class Map
{
    public:
        Map(std::string name);
        ~Map();
        void renderbackground(double cam_x, double cam_y);
        void renderwallground(double cam_x, double cam_y);
        bool collides(Gamestate *state, MovingEntity *entity);
        bool collides(Gamestate *state, Character *entity);
        bool collides(Rect rect);
        bool collides(double rotx, double roty, Rect rect, double angle);
        bool collideline(double x1, double y1, double x2, double y2);
        bool testpixel(double x, double y) {return x < 0 or y < 0 or x > al_get_bitmap_width(wallmask) or y > al_get_bitmap_height(wallmask) or al_get_pixel(wallmask, x, y).a != 0;}
    protected:
    private:
        ALLEGRO_BITMAP *background;
        ALLEGRO_BITMAP *wallground;
        ALLEGRO_BITMAP *wallmask;
};

#endif // MAP_H
{'fraction_non_alphanumeric': 0.10278053624627606, 'fraction_numerical': 0.006951340615690168, 'mean_word_length': 3.4481236203090506, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4711331', 'n_tokens_mistral': 671, 'n_tokens_neox': 658, 'n_words': 180}