~ubuntu-branches/debian/squeeze/openttd/squeeze

« back to all changes in this revision

Viewing changes to src/ai/ai_info.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Matthijs Kooijman
  • Date: 2009-06-09 21:46:28 UTC
  • mfrom: (1.1.7 upstream) (2.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090609214628-6z5uodi6178z050l
[ Matthijs Kooijman ]
* New upstream release.
* Link against libicu to enable right-to-left language support. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: ai_info.cpp 15470 2009-02-13 18:43:56Z yexo $ */
 
1
/* $Id: ai_info.cpp 16121 2009-04-22 09:00:19Z rubidium $ */
2
2
 
3
3
/** @file ai_info.cpp Implementation of AIFileInfo */
4
4
 
36
36
        free((void *)this->description);
37
37
        free((void *)this->date);
38
38
        free((void *)this->instance_name);
 
39
        free((void *)this->url);
39
40
        free(this->main_script);
40
41
        free(this->SQ_instance);
41
42
}
98
99
        if (!info->engine->CallIntegerMethod(*info->SQ_instance, "GetVersion", &info->version)) return SQ_ERROR;
99
100
        if (!info->engine->CallStringMethodStrdup(*info->SQ_instance, "CreateInstance", &info->instance_name)) return SQ_ERROR;
100
101
 
 
102
        /* The GetURL function is optional. */
 
103
        if (info->engine->MethodExists(*info->SQ_instance, "GetURL")) {
 
104
                if (!info->engine->CallStringMethodStrdup(*info->SQ_instance, "GetURL", &info->url)) return SQ_ERROR;
 
105
        }
 
106
 
101
107
        return 0;
102
108
}
103
109
 
125
131
        } else {
126
132
                info->min_loadable_version = info->GetVersion();
127
133
        }
 
134
        /* When there is an UseAsRandomAI function, call it. */
 
135
        if (info->engine->MethodExists(*info->SQ_instance, "UseAsRandomAI")) {
 
136
                if (!info->engine->CallBoolMethod(*info->SQ_instance, "UseAsRandomAI", &info->use_as_random)) return SQ_ERROR;
 
137
        } else {
 
138
                info->use_as_random = true;
 
139
        }
128
140
 
129
141
        /* Remove the link to the real instance, else it might get deleted by RegisterAI() */
130
142
        sq_setinstanceup(vm, 2, NULL);