#!sdl_chomik

include "fantasy_choose_graphical_sprites_location_for_keys.sdl_chomik"
include "fantasy_choose_graphical_sprites_location_for_persons.sdl_chomik"


let choose graphical sprites initial location for place (PLACE:integer)=value code
{
    let my place id = value integer [(PLACE:integer)];

    <print "choose graphical sprites initial location for place" <my place id>>;
    <choose graphical sprites location for current place and key (KEY:key_id)>;
    <choose graphical sprites initial location for current place and person (PERSON:person_id)>;
};

let choose graphical sprites terminal location for place (PLACE:integer)=value code
{
    let my place id = value integer [(PLACE:integer)];

    <print "choose graphical sprites terminal location for place" <my place id>>;
    <choose graphical sprites location for current place and key (KEY:key_id)>;
    <choose graphical sprites terminal location for current place and person (PERSON:person_id)>;
};

let make all person widgets invisible (PERSON:integer)=value code
{
    let my person id = value integer [(PERSON:integer)];
    let my person widget index = <my widget for the person <my person id>>;
    let my widget <my person widget index> is visible = value boolean false;
};

let choose graphical sprites terminal location=value code
{
    <make all key widgets invisible (KEY:key_id)>;
    <make all person widgets invisible (PERSON:person_id)>;
    let terminal amount of graphical sprites in place (PLACE:place_id) = value integer 0;
    <choose graphical sprites terminal location for place (PLACE:place_id)>;
};

#
#
let copy graphical sprites initial location to actual location for person (PERSON:person_id)=value code
{
    let my person id = value integer [(PERSON:integer)];
    let my person widget index = <my widget for the person <my person id>>;
    let the widget position x of the widget <my person widget index> = <the widget initial position x of the widget <my person widget index>>;
    let the widget position y of the widget <my person widget index> = <the widget initial position y of the widget <my person widget index>>;
};

#
#
let choose graphical sprites initial location=value code
{
    <make all key widgets invisible (KEY:key_id)>;
    <make all person widgets invisible (PERSON:person_id)>;
    let initial amount of graphical sprites in place (PLACE:place_id) = value integer 0;
    <choose graphical sprites initial location for place (PLACE:place_id)>;
    <copy graphical sprites initial location to actual location for person (PERSON:person_id)>;
};
