Documenting my AI with Doxygen

Discuss the new AI features ("NoAI") introduced into OpenTTD 0.7, allowing you to implement custom AIs, and the new Game Scripts available in OpenTTD 1.2 and higher.

Moderator: OpenTTD Developers

Post Reply
Yasser
Engineer
Engineer
Posts: 1
Joined: 19 Apr 2015 09:58
Location: Salisbury, UK

Documenting my AI with Doxygen

Post by Yasser »

Hi

I have been learning Doxygen for my job (embedded software development in C) and was wondering if I could use Doxygen to document my attempt at an AI (YasserAI).

Is there a Doxyfile that anyone has used to do this for their AI I can borrow ?

Regards

Yasser
Brumi
President
President
Posts: 920
Joined: 18 Jul 2009 17:54

Re: Documenting my AI with Doxygen

Post by Brumi »

Quite some time ago I asked the same question: http://www.tt-forums.net/viewtopic.php?p=953289#p953289

Nevertheless if anyone has a solution since then I'm also interested :)
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Documenting my AI with Doxygen

Post by Alberth »

I find that just having the doxygen text in the source file is enough, and I did some documenting in Busy Bee that way:

Code: Select all

// Find cargo sources.
// @param cargo_index Cargo index (index in this.cargoes).
// @return List of resources that produce the requested cargo, list of
//      'ind' or 'town' number, 'prod' produced amount, 'transp' transported amount, and 'loc' location.
function BusyBeeClass::FindSources(cargo_index)
It is not quite satisfactory though, as there is no good place to put the type of the data.
In CosrixTH (Lua code), they do

Code: Select all

--! Spawn a patient from a spawn point for the given hospital.
--!param hospital (Hospital) Hospital that the new patient should visit.
--!return (Patient entity) The spawned patient, or 'nil' if no patient spawned.
function World:spawnPatient(hospital)
An alternative that I use in Python is 'epydoc' (epydoc.sourceforge.net), which does

Code: Select all

def load_dom(fname):
    """
    Load the XML file as DOM into memory.

    @param fname: File to load.
    @type  fname: C{str}
    """
You the type explicitly at a line here.
Being a retired OpenTTD developer does not mean I know what I am doing.
Post Reply

Return to “OpenTTD AIs and Game Scripts”

Who is online

Users browsing this forum: No registered users and 19 guests