← Back to team overview

widelands-dev team mailing list archive

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

 

answer inline. Sorry, the original comment by me was not particularly understandable :/

Diff comments:

> 
> === modified file 'src/ai/defaultai.h'
> --- src/ai/defaultai.h	2016-01-06 19:11:20 +0000
> +++ src/ai/defaultai.h	2016-01-20 20:12:20 +0000
> @@ -348,13 +349,16 @@
>  	uint32_t ai_productionsites_ratio_;
>  	uint32_t ai_personality_early_militarysites;
>  
> +	//this points to persistent data stored in Player object

No, I just meant to add to the documentation that this object is not owned. Something along the lines

// This points to data owned by class Player that will be persisted on game save.

Ownership simply means: who will clean up this object, i.e. delete it, free it's memory. In really modern codebases, unique_ptr<> signalizes ownership. A bare pointer (like this) automatically always means not owned. Unfortunately in Widelands we have a mix of modern and old code, so a code comment is better than freeing twice or not at all

> +	Widelands::Player::AiPersistentState* persistent_data;
> +
>  	// this is a bunch of patterns that have to identify weapons and armors for input queues of trainingsites
>  	std::vector<std::string> const armors_and_weapons =
>  		{"ax", "lance", "armor", "helm", "lance", "trident", "tabard", "shield", "mask"};
>  
>  	enum {kReprioritize, kStopShipyard, kStapShipyard};
>  
> -	std::vector<int16_t> marineTaskQueue_;
> +	std::vector<int16_t> marine_task_queue;
>  
>  	std::unique_ptr<Notifications::Subscriber<Widelands::NoteFieldPossession>>
>  	   field_possession_subscriber_;


-- 
https://code.launchpad.net/~widelands-dev/widelands/ai_ship_tweaks/+merge/280192
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/ai_ship_tweaks.


References