← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands/warehouse_worker into lp:widelands

 

Answered :)

Diff comments:

> === modified file 'src/logic/warehouse.cc'
> --- src/logic/warehouse.cc	2015-10-18 15:42:01 +0000
> +++ src/logic/warehouse.cc	2015-11-11 09:47:46 +0000
> @@ -883,30 +883,30 @@
>  						worker->set_location(this); //  back in a economy
>  						incorporated_workers.erase(worker_iter);
>  
> -						m_supply->remove_workers(ware, 1);
> +						m_supply->remove_workers(worker_id, 1);
>  						return *worker;
>  					}
>  				}
>  			}
>  
> -			assert(unincorporated <= m_supply->stock_workers(ware));
> +			assert(unincorporated <= m_supply->stock_workers(worker_id));
>  
>  			if (unincorporated) {
>  				// Create a new one
>  				// NOTE: This code lies about the TrainingAttributes of the new worker
> -				m_supply->remove_workers(ware, 1);
> -				const WorkerDescr & workerdescr = *game.tribes().get_worker_descr(ware);
> +				m_supply->remove_workers(worker_id, 1);
> +				const WorkerDescr & workerdescr = *game.tribes().get_worker_descr(worker_id);
>  				return workerdescr.create(game, owner(), this, m_position);
>  			}
>  		}
>  
> -		if (can_create_worker(game, ware)) {
> +		if (can_create_worker(game, worker_id)) {
>  			// don't want to use an upgraded worker, so create new one.
> -			create_worker(game, ware);
> +			create_worker(game, worker_id);
>  		} else {
> -			ware = game.tribes().get_worker_descr(ware)->becomes();
> +			worker_id = game.tribes().get_worker_descr(worker_id)->becomes();
>  		}
> -	} while (owner().tribe().has_ware(ware));
> +	} while (owner().tribe().has_worker(worker_id));

Correct :)

I also renamed the variable to make it clear we are talking about workers here and not wares.

>  
>  	throw wexception
>  		("Warehouse::launch_worker: worker does not actually exist");


-- 
https://code.launchpad.net/~widelands-dev/widelands/warehouse_worker/+merge/277221
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/warehouse_worker into lp:widelands.


References