Skip to content

Commit

Permalink
Harvest season of type 'season_type' instead of 'int'
Browse files Browse the repository at this point in the history
  • Loading branch information
codemime committed Apr 25, 2016
1 parent 200f2b5 commit 7b31689
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lua/class_definitions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1425,7 +1425,7 @@ classes = {

attributes = {
close = { type = "ter_str_id", writable = true },
harvest_season = { type = "int", writable = true },
harvest_season = { type = "season_type", writable = true },
harvestable = { type = "string", writable = true },
name = { type = "string", writable = false },
open = { type = "ter_str_id", writable = true },
Expand Down
13 changes: 6 additions & 7 deletions src/mapdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "output.h"
#include "item.h"
#include "item_group.h"
#include "calendar.h"

#include <unordered_map>

Expand Down Expand Up @@ -937,16 +936,16 @@ void ter_t::load( JsonObject &jo )
if( jo.has_member("harvest_season") ) {
const std::string season = jo.get_string( "harvest_season" );

if ( season == "SPRING" ) {
harvest_season = 0;
if( season == "SPRING" ) {
harvest_season = season_type::SPRING;
} else if( season == "SUMMER" ) {
harvest_season = 1;
harvest_season = season_type::SUMMER;
} else if( season == "AUTUMN" ) {
harvest_season = 2;
harvest_season = season_type::AUTUMN;
} else if( season == "WINTER" ) {
harvest_season = 3;
harvest_season = season_type::WINTER;
} else {
harvest_season = 3;
harvest_season = season_type::AUTUMN;
debugmsg( "Invalid harvest season \"%s\" in \"%s\".", season.c_str(), id.c_str() );
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/mapdata.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define MAPDATA_H

#include "game_constants.h"
#include "color.h"
#include "calendar.h"
#include "enums.h"
#include "iexamine.h"
#include "int_id.h"
Expand Down Expand Up @@ -259,15 +259,15 @@ struct ter_t : map_data_common_t {

trap_id trap; // The id of the trap located at this terrain. Limit one trap per tile currently.

int harvest_season; // When will this terrain get harvested?
season_type harvest_season; // When will this terrain get harvested?

ter_t() :
open( NULL_ID ),
close( NULL_ID ),
transforms_into( NULL_ID ),
roof( NULL_ID ),
trap( tr_null ),
harvest_season( 0 ) {};
harvest_season( season_type::AUTUMN ) {};

static size_t count();

Expand Down

0 comments on commit 7b31689

Please sign in to comment.