Skip to content

Commit 91275fc

Browse files
authored
Codefix: Fix typos and grammar errors (#389)
1 parent 9584597 commit 91275fc

35 files changed

+75
-76
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# NML NewGRF meta language
22

3-
NML is a a python-based compiler, capable of compiling NML files (along
3+
NML is a Python-based compiler, capable of compiling NML files (along
44
with their associated language, sound and graphic files) into grf
55
and / or nfo files.
66

nml/actions/action0.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class BlockAllocation:
4848
@ivar allocated: Mapping of allocated blocks.
4949
@type allocated: C{dict} of C{int} to allocation information.
5050
51-
@ivar filled: Mapping of block size to smallest address that may contain free space.
51+
@ivar filled: Mapping of block size to the smallest address that may contain free space.
5252
Serves as a cache to speed up searches.
5353
@type filled: C{dict} of C{int}
5454
"""
@@ -72,7 +72,7 @@ def get_num_allocated(self):
7272

7373
def get_max_allocated(self):
7474
"""
75-
Return maximum number of allocateable ids.
75+
Return maximum number of allocatable ids.
7676
"""
7777
if self.dynamic_allocation:
7878
return self.last - self.first + 1
@@ -90,7 +90,7 @@ def in_range(self, addr, length):
9090
@param length: Number of addresses in the block.
9191
@type length: C{int}
9292
93-
@return: Whether the block fits enitrely in the available address space.
93+
@return: Whether the block fits entirely in the available address space.
9494
@rtype: C{bool}
9595
"""
9696
return addr >= 0 and addr + length - 1 <= self.last
@@ -923,7 +923,7 @@ def get_basecost_action(basecost):
923923

924924
num_ids = 1 # Number of values that will be written in one go
925925
values = []
926-
# try to capture as much values as possible
926+
# try to capture as many values as possible
927927
while True:
928928
cost = basecost.costs[i]
929929
if isinstance(cost.value, expression.ConstantNumeric):

nml/actions/action0properties.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def get_size(self):
108108
# Summary: If 'string' or 'string_literal' is set, the value should be a
109109
# string or literal string, else the value is a number. 'unit_type' and
110110
# 'unit_conversion' are used to convert user-entered values to nfo values.
111-
# If some more arithmetic is needed to convert the entered value into an nfo
111+
# If some more arithmetic is needed to convert the entered value into a nfo
112112
# value, 'value_function' can be used. For even more complicated things,
113113
# 'custom_function' can be used to create a special mapping of the value to nfo
114114
# properties, else 'num' and 'size' are used to provide a 'normal' action0.
@@ -214,7 +214,7 @@ def two_byte_property(low_prop, high_prop, low_prop_info=None, high_prop_info=No
214214
def animation_info(value, loop_bit=8, max_frame=253):
215215
"""
216216
Convert animation info array of two elements to an animation info property.
217-
The first is 0/1, and defines whether or not the animation loops.
217+
The first is 0/1, and defines whether the animation loops.
218218
The second is the number of frames, at most 253 frames.
219219
220220
@param value: Array of animation info.
@@ -440,12 +440,12 @@ def single_or_list(prop_name, single_num, multiple_num, value):
440440
"unit_conversion": (5000, 1397),
441441
"adjust_value": lambda val, unit: ottd_display_speed(val, 1, 1, unit)
442442
},
443-
# 09 doesn"t exist
443+
# 09 doesn't exist
444444
"power": {"size": 2, "num": 0x0B, "unit_type": "power"},
445-
# 0A doesn"t exist
445+
# 0A doesn't exist
446446
"running_cost_factor": {"size": 1, "num": 0x0D},
447447
"running_cost_base": {"size": 4, "num": 0x0E},
448-
# 0F -11 don"t exist
448+
# 0F -11 don't exist
449449
"sprite_id": {"size": 1, "num": 0x12},
450450
"dual_headed": {"size": 1, "num": 0x13},
451451
"cargo_capacity": {"size": 1, "num": 0x14},
@@ -729,7 +729,7 @@ def aircraft_is_large(value):
729729

730730
def station_platforms_length(value):
731731
# Writing bitmask(2) to disable platform/length 3 is not very intuitive.
732-
# Instead we expect the user will write bitmask(3) and we shift the result.
732+
# Instead, we expect the user will write bitmask(3) and we shift the result.
733733
return nmlop.SHIFT_RIGHT(value, 1, value.pos).reduce()
734734

735735

@@ -1578,7 +1578,7 @@ def label_list(value, prop_num, description):
15781578
properties[0x11] = {
15791579
"substitute": {"size": 1, "num": 0x08, "first": None},
15801580
"override": {"size": 1, "num": 0x09},
1581-
# 0A - 0D don"t exist (yet?)
1581+
# 0A - 0D don't exist (yet?)
15821582
# 0E (callback flags) is not set by user
15831583
"animation_info": {"size": 2, "num": 0x0F, "value_function": animation_info},
15841584
"animation_speed": {"size": 1, "num": 0x10},

nml/actions/action1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def get_action_list(self):
145145
Create a list of actions needed to write this collection to the output. This
146146
will generate a single Action1 and as many realsprites as needed.
147147
148-
@return: A list of actions needed to represet this collection in a GRF.
148+
@return: A list of actions needed to represent this collection in a GRF.
149149
@rtype: C{list} of L{BaseAction}
150150
"""
151151
actions = [Action1(self.feature, self.first_set, len(self.spritesets), self.num_sprites_per_spriteset)]

nml/actions/action2.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def skip_needed(self):
139139
def remove_tmp_location(self, location, force_recursive):
140140
"""
141141
Recursively remove a location from the list of available temporary
142-
storage locations. It is not only removed from the the list of the
142+
storage locations. It is not only removed from the list of the
143143
current Action2Var but also from all Action2Var it calls. If an
144144
Action2Var is referenced as a procedure call, the location is always
145145
removed recursively, otherwise only if force_recursive is True.
@@ -230,7 +230,7 @@ def make_sprite_group_class(cls_is_spriteset, cls_is_referenced, cls_has_explici
230230
Metaclass factory which makes base classes for all nodes 'Action 2 graph'
231231
This graph is made up of all blocks that are eventually compiled to Action2,
232232
which use the same name space. Spritesets do inherit from this class to make
233-
referencing them possible, but they are not part of the refernce graph that
233+
referencing them possible, but they are not part of the reference graph that
234234
is built.
235235
236236
@param cls_is_spriteset: Whether this class represents a spriteset
@@ -244,7 +244,7 @@ def make_sprite_group_class(cls_is_spriteset, cls_is_referenced, cls_has_explici
244244
@type cls_has_explicit_feature: C{bool}
245245
246246
@param cls_is_relocatable: Whether instances of this class can be freely moved around or whether they need
247-
to to be converted to nfo code at the same location as they are in the nml code.
247+
to be converted to nfo code at the same location as they are in the nml code.
248248
@type cls_is_relocatable: C{bool}
249249
250250
@return: The constructed class
@@ -262,7 +262,7 @@ class ASTSpriteGroup(base_statement.BaseStatement):
262262
Child classes should do the following:
263263
- Implement their own __init__ method
264264
- Call BaseStatement.__init__
265-
- Call initialize, pre_process and perpare_output (in that order)
265+
- Call initialize, pre_process and prepare_output (in that order)
266266
- Implement collect_references
267267
- Call set_action2 after generating the corresponding action2 (if applicable)
268268
@@ -294,8 +294,8 @@ class ASTSpriteGroup(base_statement.BaseStatement):
294294
def __init__(self):
295295
"""
296296
Subclasses should implement their own __init__ method.
297-
This method should not be called, because calling a method on a meta class can be troublesome.
298-
Instead, call initialize(..).
297+
This method should not be called, because calling a method on a metaclass can be troublesome.
298+
Instead, call initialize(...).
299299
"""
300300
raise NotImplementedError(
301301
(

nml/actions/action2layout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def write_flags(self, file):
117117
flags |= 1 << 2
118118
if self.palette_from_action1:
119119
flags |= 1 << 3
120-
# for building sprites: bit 4 => xoffset+yoffset, bit 5 => zoffset (x and y always set totgether)
120+
# for building sprites: bit 4 => xoffset+yoffset, bit 5 => zoffset (x and y always set together)
121121
# for child sprites: bit 4 => xoffset, bit 5 => yoffset
122122
if self.type == Action2LayoutSpriteType.BUILDING:
123123
assert (self.get_register("xoffset") is not None) == (self.get_register("yoffset") is not None)

nml/actions/action2random.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def __init__(self, result, prob, comment):
105105

106106
def parse_randomswitch_type(random_switch):
107107
"""
108-
Parse the type of a random switch to determine the type and random bits to use.
108+
Parse the type of random switch to determine the type and random bits to use.
109109
110110
@param random_switch: Random switch to parse the type of
111111
@type random_switch: L{RandomSwitch}
@@ -203,7 +203,7 @@ def parse_randomswitch_dependencies(random_switch, start_bit, bits_available, nr
203203
204204
@return: A tuple of two values:
205205
- The first random bit to use
206-
- The number of random choices to use. This may be higher the the original amount passed as paramter
206+
- The number of random choices to use. This may be higher than the original amount passed as parameter
207207
@rtype: C{tuple} of (C{int}, C{int})
208208
"""
209209
# Dependent random chains
@@ -240,7 +240,7 @@ def parse_randomswitch_dependencies(random_switch, start_bit, bits_available, nr
240240
else:
241241
randbit = -1
242242

243-
# INdependent random chains
243+
# Independent random chains
244244
possible_mask = ((1 << bits_available) - 1) << start_bit
245245
for indep in random_switch.independent:
246246
act2 = lookup_random_action2(indep)

nml/actions/action2var_variables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def vehicle_tramtype(name, args, pos, info):
298298
varact2vars_stations = {
299299
**varact2vars_base_stations,
300300
# Vars 40, 41, 46, 47, 49 are implemented as 60+x vars,
301-
# except for the 'tile type' part which is always the same anyways
301+
# except for the 'tile type' part which is always the same anyway
302302
'tile_type' : {'var': 0x40, 'start': 24, 'size': 8},
303303
'terrain_type' : {'var': 0x42, 'start': 0, 'size': 8},
304304
'track_type' : {'var': 0x42, 'start': 8, 'size': 8},

nml/actions/action3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ def parse_graphics_block_single_id(
474474
# Special case for vehicle cb 36, maps var10 values to spritegroups
475475
cb36_mapping = {}
476476
cb36_buy_mapping = {}
477-
# Sspecial case for industry production CB, maps var18 values to spritegroups
477+
# Special case for industry production CB, maps var18 values to spritegroups
478478
prod_cb_mapping = {}
479479

480480
for cb_info, gfx in callbacks:

nml/actions/action3_callbacks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
general_vehicle_cbs = {
3030
'default' : {'type': 'cargo', 'num': None},
3131
'purchase' : {'type': 'cargo', 'num': 0xFF},
32-
'random_trigger' : {'type': 'cb', 'num': 0x01}, # Almost undocumented, but really neccesary!
32+
'random_trigger' : {'type': 'cb', 'num': 0x01}, # Almost undocumented, but really necessary!
3333
'loading_speed' : {'type': 'cb', 'num': 0x36, 'var10': 0x07},
3434
'cargo_subtype_text' : {'type': 'cb', 'num': 0x19, 'flag_bit': 5},
3535
'additional_text' : {'type': 'cb', 'num': 0x23, 'purchase': 2},

0 commit comments

Comments
 (0)