Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove mapRain data structure #9716

Merged
merged 1 commit into from Oct 29, 2014
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -540,15 +540,13 @@ void cata_tiles::draw(int destx, int desty, int centerx, int centery, int width,
// Draw lighting
draw_lighting(x, y, l);
// continue on to next part of loop
g->mapRain[my][mx] = false;
continue;
}
// light is no longer being considered, for now.
// Draw Terrain if possible. If not possible then we need to continue on to the next part of loop
if (!draw_terrain(x, y)) {
continue;
}
g->mapRain[my][mx] = g->m.is_outside(x, y);
draw_furniture(x, y);
draw_trap(x, y);
draw_field_or_item(x, y);
@@ -2964,11 +2964,21 @@ input_context game::get_player_input(std::string &action)

wPrint.vdrops.clear();


const int light_sight_range = u.sight_range( g->light_level() );
for (int i = 0; i < dropCount; i++) {
const int iRandX = rng(iStartX, iEndX - 1);
const int iRandY = rng(iStartY, iEndY - 1);

if (mapRain[iRandY][iRandX]) {
const int mapx = iRandX + offset_x;
const int mapy = iRandY + offset_y;
const int distance = rl_dist( u.posx, u.posy, mapx, mapy );

if( m.is_outside( mapx, mapy ) &&
( m.light_at( mapx, mapy ) > LL_LOW ||
distance <= light_sight_range ) &&
m.pl_sees( u.posx, u.posy, mapx, mapy, distance ) &&
!critter_at(mapx, mapy) ) {
// Supress if a critter is there
wPrint.vdrops.push_back(std::make_pair(iRandX, iRandY));
}
}
@@ -5505,7 +5515,6 @@ void game::draw_critter(const Creature &critter, const point &center)
}
if( u.sees( &critter ) || &critter == &u ) {
critter.draw( w_terrain, center.x, center.y, false );
mapRain[my][mx] = false;
return;
}
const bool has_ir = u.has_active_bionic( "bio_infrared" ) ||
@@ -5516,13 +5525,11 @@ void game::draw_critter(const Creature &critter, const point &center)
u.sight_range( DAYLIGHT_LEVEL ) );
if( critter.is_warm() && has_ir && can_see ) {
mvwputch( w_terrain, my, mx, c_red, '?' );
mapRain[my][mx] = false;
}
}

void game::draw_ter(int posx, int posy)
{
mapRain.clear();
// posx/posy default to -999
if (posx == -999) {
posx = u.posx + u.view_offset_x;
@@ -395,8 +395,6 @@ class game
std::vector<item> items_dragged;
int weight_dragged; // Computed once, when you start dragging

std::map<int, std::map<int, bool> > mapRain;

int ter_view_x, ter_view_y;
WINDOW *w_terrain;
WINDOW *w_overmap;
@@ -461,8 +459,7 @@ class game
void draw_weather(weather_printable wPrint);
void draw_sct();
void draw_zones(const point &p_pointStart, const point &p_pointEnd, const point &p_pointOffset);
// Draw critter (if visible!) on its current position into w_terrain,
// also update mapRain to protect it from been overdrawn by rain.
// Draw critter (if visible!) on its current position into w_terrain.
// @param center the center of view, same as when calling map::draw
void draw_critter(const Creature &critter, const point &center);

@@ -3885,15 +3885,13 @@ void map::draw(WINDOW* w, const point center)
const int dist = rl_dist(g->u.posx, g->u.posy, realx, realy);
int sight_range = light_sight_range;
int low_sight_range = lowlight_sight_range;
bool bRainOutside = false;
// While viewing indoor areas use lightmap model
if (!is_outside(realx, realy)) {
sight_range = natural_sight_range;
// Don't display area as shadowy if it's outside and illuminated by natural light
//and illuminated by source of light
} else if (this->light_at(realx, realy) > LL_LOW || dist <= light_sight_range) {
low_sight_range = std::max(g_light_level, natural_sight_range);
bRainOutside = true;
}

// I've moved this part above loops without even thinking that
@@ -3939,8 +3937,6 @@ void map::draw(WINDOW* w, const point center)
else
mvwputch(w, realy+getmaxy(w)/2 - center.y, realx+getmaxx(w)/2 - center.x, c_ltgray, '#');
} else if (dist <= u_clairvoyance || can_see) {
if (bRainOutside && INBOUNDS(realx, realy) && is_outside(realx, realy))
g->mapRain[realy + getmaxy(w)/2 - center.y][realx + getmaxx(w)/2 - center.x] = true;
drawsq(w, g->u, realx, realy, false, true, center.x, center.y,
(dist > low_sight_range && LL_LIT > lit) ||
(dist > sight_range && LL_LOW == lit),
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.