1 /* ResidualVM - A 3D game interpreter
2  *
3  * ResidualVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the AUTHORS
5  * file distributed with this source distribution.
6  *
7  * Additional copyright for this file:
8  * Copyright (C) 1999-2000 Revolution Software Ltd.
9  * This code is based on source code created by Revolution Software,
10  * used with permission.
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25  *
26  */
27 
28 #include "engines/icb/mission.h"
29 #include "engines/icb/string_vest.h"
30 
31 namespace ICB {
32 
33 // stop initing these in multiple routines and use this instead
34 char temp_buf[ENGINE_STRING_LEN];
35 
Set_string_and_len(const char * from,char * to,uint32 * length)36 void Set_string_and_len(const char *from, char *to, uint32 *length) {
37 	// copy a string and set length flag
38 
39 	if (strlen(from) >= ENGINE_STRING_LEN)
40 		Fatal_error("Set_string_and_len length violation [%s]", from);
41 
42 	strcpy(to, from);
43 
44 	*length = strlen(to);
45 }
46 
Set_string(const char * from,char * to)47 void Set_string(const char *from, char *to) {
48 	// copy a string
49 
50 	if (strlen(from) >= ENGINE_STRING_LEN)
51 		Fatal_error("Set_string length violation [%s]", from);
52 
53 	strcpy(to, from);
54 }
55 
Set_string(const char * from,char * to,uint32 length)56 void Set_string(const char *from, char *to, uint32 length) {
57 	// copy a string
58 
59 	if (strlen(from) >= length)
60 		Fatal_error("Set_string length violation [%s] - max length = %d", from, length);
61 
62 	strcpy(to, from);
63 }
64 
65 } // End of namespace ICB
66