richelbilderbeek / djog_unos_2018

Project by the Uno's at DJOG 2018-2019: Nature Zen
GNU General Public License v3.0
6 stars 2 forks source link

Remove agent_type::none #512

Closed richelbilderbeek closed 5 years ago

richelbilderbeek commented 5 years ago

Is your feature request related to a problem? Please describe.

I've never observed a use of a null-type agent_type.

Take for example this line:

  agent nearest_f(agent_type::none, INFINITY, INFINITY);

The line above indicates that no agent is yet found,

A superior way to indicate the same:

std::vector<agent> nearest_agent;

Drawback of the current approach are abominations like this:

  //An agent of type none is used when a 'null' agent is needed
  assert(type != agent_type::none || type == agent_type::none);

I suggest to do ourselves a favour and remove agent_type::none.

Describe the solution you'd like

Remove agent_type::none. When a null-agents is needed, use an empty std::vector<agent> instead.

Describe alternatives you've considered

None.

Additional context

None.

DynCoder commented 5 years ago

It is used in saving and loading and is an inportant part of making the game work on incorrect save files (for when people try to mod the game)

Op vr 22 mrt. 2019 18:52 schreef Richel Bilderbeek <notifications@github.com

:

Is your feature request related to a problem? Please describe.

I've never observed a use of a null-type agent_type.

Take for example this line:

agent nearest_f(agent_type::none, INFINITY, INFINITY);

The line above indicates that no agent is yet found,

A superior way to indicate the same:

std::vector nearest_agent;

Drawback of the current approach are abominations like this:

//An agent of type none is used when a 'null' agent is needed assert(type != agent_type::none || type == agent_type::none);

I suggest to do ourselves a favour and remove agent_type::none.

Describe the solution you'd like

Remove agent_type::none. When a null-agents is needed, use an empty std::vector instead.

Describe alternatives you've considered

None.

Additional context

None.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/richelbilderbeek/djog_unos_2018/issues/512, or mute the thread https://github.com/notifications/unsubscribe-auth/Ab-TktRoOZsRsvtdlAl3_ngdsnRIWkLCks5vZRhmgaJpZM4cEHH- .

DynCoder commented 5 years ago

Replace the usages with a cow

richelbilderbeek commented 5 years ago

Well done @AramPetiet, but it did break the build due to OCLint.

Address the OCLint feedback, then push again, then move this Issue in 'To be merged with develop' :+1: